diff options
Diffstat (limited to 'drivers/media')
343 files changed, 7684 insertions, 2197 deletions
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 121b0110af3c..d2a436ce77f8 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | # Used by common drivers, when they need to ask questions | ||
| 2 | config MEDIA_COMMON_OPTIONS | ||
| 3 | bool | ||
| 4 | |||
| 5 | comment "common driver options" | ||
| 6 | depends on MEDIA_COMMON_OPTIONS | ||
| 7 | |||
| 1 | source "drivers/media/common/b2c2/Kconfig" | 8 | source "drivers/media/common/b2c2/Kconfig" |
| 2 | source "drivers/media/common/saa7146/Kconfig" | 9 | source "drivers/media/common/saa7146/Kconfig" |
| 3 | source "drivers/media/common/siano/Kconfig" | 10 | source "drivers/media/common/siano/Kconfig" |
diff --git a/drivers/media/common/b2c2/Kconfig b/drivers/media/common/b2c2/Kconfig index 1df9e578daa5..a8c6cdfaa2f5 100644 --- a/drivers/media/common/b2c2/Kconfig +++ b/drivers/media/common/b2c2/Kconfig | |||
| @@ -17,11 +17,6 @@ config DVB_B2C2_FLEXCOP | |||
| 17 | select DVB_CX24123 if MEDIA_SUBDRV_AUTOSELECT | 17 | select DVB_CX24123 if MEDIA_SUBDRV_AUTOSELECT |
| 18 | select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT | 18 | select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT |
| 19 | select DVB_TUNER_CX24113 if MEDIA_SUBDRV_AUTOSELECT | 19 | select DVB_TUNER_CX24113 if MEDIA_SUBDRV_AUTOSELECT |
| 20 | help | ||
| 21 | Support for the digital TV receiver chip made by B2C2 Inc. included in | ||
| 22 | Technisats PCI cards and USB boxes. | ||
| 23 | |||
| 24 | Say Y if you own such a device and want to use it. | ||
| 25 | 20 | ||
| 26 | # Selected via the PCI or USB flexcop drivers | 21 | # Selected via the PCI or USB flexcop drivers |
| 27 | config DVB_B2C2_FLEXCOP_DEBUG | 22 | config DVB_B2C2_FLEXCOP_DEBUG |
diff --git a/drivers/media/common/siano/Kconfig b/drivers/media/common/siano/Kconfig index 425aeadfb49d..68f0f604678e 100644 --- a/drivers/media/common/siano/Kconfig +++ b/drivers/media/common/siano/Kconfig | |||
| @@ -4,14 +4,16 @@ | |||
| 4 | 4 | ||
| 5 | config SMS_SIANO_MDTV | 5 | config SMS_SIANO_MDTV |
| 6 | tristate | 6 | tristate |
| 7 | depends on DVB_CORE && RC_CORE && HAS_DMA | 7 | depends on DVB_CORE && HAS_DMA |
| 8 | depends on !RC_CORE || RC_CORE | ||
| 8 | depends on SMS_USB_DRV || SMS_SDIO_DRV | 9 | depends on SMS_USB_DRV || SMS_SDIO_DRV |
| 9 | default y | 10 | default y |
| 10 | ---help--- | ||
| 11 | Choose Y or M here if you have MDTV receiver with a Siano chipset. | ||
| 12 | |||
| 13 | To compile this driver as a module, choose M here | ||
| 14 | (The module will be called smsmdtv). | ||
| 15 | 11 | ||
| 16 | Further documentation on this driver can be found on the WWW | 12 | config SMS_SIANO_RC |
| 17 | at http://www.siano-ms.com/ | 13 | bool "Enable Remote Controller support for Siano devices" |
| 14 | depends on SMS_SIANO_MDTV && RC_CORE | ||
| 15 | depends on SMS_USB_DRV || SMS_SDIO_DRV | ||
| 16 | depends on MEDIA_COMMON_OPTIONS | ||
| 17 | default y | ||
| 18 | ---help--- | ||
| 19 | Choose Y to select Remote Controller support for Siano driver. | ||
diff --git a/drivers/media/common/siano/Makefile b/drivers/media/common/siano/Makefile index 2a09279e0648..81b1e985bea5 100644 --- a/drivers/media/common/siano/Makefile +++ b/drivers/media/common/siano/Makefile | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o | 1 | smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o |
| 2 | 2 | ||
| 3 | obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o | 3 | obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o |
| 4 | 4 | ||
| 5 | ifeq ($(CONFIG_SMS_SIANO_RC),y) | ||
| 6 | smsmdtv-objs += smsir.o | ||
| 7 | endif | ||
| 8 | |||
| 5 | ccflags-y += -Idrivers/media/dvb-core | 9 | ccflags-y += -Idrivers/media/dvb-core |
| 6 | ccflags-y += $(extra-cflags-y) $(extra-cflags-m) | 10 | ccflags-y += $(extra-cflags-y) $(extra-cflags-m) |
| 7 | 11 | ||
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 9cc55546cc30..1842e64e6338 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c | |||
| @@ -1092,7 +1092,7 @@ EXPORT_SYMBOL_GPL(smscore_onresponse); | |||
| 1092 | * @return pointer to descriptor on success, NULL on error. | 1092 | * @return pointer to descriptor on success, NULL on error. |
| 1093 | */ | 1093 | */ |
| 1094 | 1094 | ||
| 1095 | struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev) | 1095 | static struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev) |
| 1096 | { | 1096 | { |
| 1097 | struct smscore_buffer_t *cb = NULL; | 1097 | struct smscore_buffer_t *cb = NULL; |
| 1098 | unsigned long flags; | 1098 | unsigned long flags; |
diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c index 37bc5c4b8ad8..b8c5cad78537 100644 --- a/drivers/media/common/siano/smsir.c +++ b/drivers/media/common/siano/smsir.c | |||
| @@ -88,7 +88,7 @@ int sms_ir_init(struct smscore_device_t *coredev) | |||
| 88 | 88 | ||
| 89 | dev->priv = coredev; | 89 | dev->priv = coredev; |
| 90 | dev->driver_type = RC_DRIVER_IR_RAW; | 90 | dev->driver_type = RC_DRIVER_IR_RAW; |
| 91 | dev->allowed_protos = RC_TYPE_ALL; | 91 | dev->allowed_protos = RC_BIT_ALL; |
| 92 | dev->map_name = sms_get_board(board_id)->rc_codes; | 92 | dev->map_name = sms_get_board(board_id)->rc_codes; |
| 93 | dev->driver_name = MODULE_NAME; | 93 | dev->driver_name = MODULE_NAME; |
| 94 | 94 | ||
diff --git a/drivers/media/common/siano/smsir.h b/drivers/media/common/siano/smsir.h index ae92b3a8587e..69b59b9eee28 100644 --- a/drivers/media/common/siano/smsir.h +++ b/drivers/media/common/siano/smsir.h | |||
| @@ -46,10 +46,19 @@ struct ir_t { | |||
| 46 | u32 controller; | 46 | u32 controller; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_SMS_SIANO_RC | ||
| 49 | int sms_ir_init(struct smscore_device_t *coredev); | 50 | int sms_ir_init(struct smscore_device_t *coredev); |
| 50 | void sms_ir_exit(struct smscore_device_t *coredev); | 51 | void sms_ir_exit(struct smscore_device_t *coredev); |
| 51 | void sms_ir_event(struct smscore_device_t *coredev, | 52 | void sms_ir_event(struct smscore_device_t *coredev, |
| 52 | const char *buf, int len); | 53 | const char *buf, int len); |
| 54 | #else | ||
| 55 | inline static int sms_ir_init(struct smscore_device_t *coredev) { | ||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | inline static void sms_ir_exit(struct smscore_device_t *coredev) {}; | ||
| 59 | inline static void sms_ir_event(struct smscore_device_t *coredev, | ||
| 60 | const char *buf, int len) {}; | ||
| 61 | #endif | ||
| 53 | 62 | ||
| 54 | #endif /* __SMS_IR_H__ */ | 63 | #endif /* __SMS_IR_H__ */ |
| 55 | 64 | ||
diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 889c9c16c6df..d81dbb22aa81 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c | |||
| @@ -877,7 +877,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, | |||
| 877 | dvb_dmxdev_filter_stop(dmxdevfilter); | 877 | dvb_dmxdev_filter_stop(dmxdevfilter); |
| 878 | dvb_dmxdev_filter_reset(dmxdevfilter); | 878 | dvb_dmxdev_filter_reset(dmxdevfilter); |
| 879 | 879 | ||
| 880 | if (params->pes_type > DMX_PES_OTHER || params->pes_type < 0) | 880 | if ((unsigned)params->pes_type > DMX_PES_OTHER) |
| 881 | return -EINVAL; | 881 | return -EINVAL; |
| 882 | 882 | ||
| 883 | dmxdevfilter->type = DMXDEV_TYPE_PES; | 883 | dmxdevfilter->type = DMXDEV_TYPE_PES; |
diff --git a/drivers/media/dvb-core/dmxdev.h b/drivers/media/dvb-core/dmxdev.h index 02ebe28f830d..48c6cf92ab99 100644 --- a/drivers/media/dvb-core/dmxdev.h +++ b/drivers/media/dvb-core/dmxdev.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| 29 | #include <linux/time.h> | ||
| 29 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
| 30 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
| 31 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 58e0220447c0..388c2eb4d747 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h | |||
| @@ -250,6 +250,7 @@ | |||
| 250 | #define USB_PID_TERRATEC_T3 0x10a0 | 250 | #define USB_PID_TERRATEC_T3 0x10a0 |
| 251 | #define USB_PID_TERRATEC_T5 0x10a1 | 251 | #define USB_PID_TERRATEC_T5 0x10a1 |
| 252 | #define USB_PID_NOXON_DAB_STICK 0x00b3 | 252 | #define USB_PID_NOXON_DAB_STICK 0x00b3 |
| 253 | #define USB_PID_NOXON_DAB_STICK_REV2 0x00e0 | ||
| 253 | #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e | 254 | #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e |
| 254 | #define USB_PID_PINNACLE_PCTV2000E 0x022c | 255 | #define USB_PID_PINNACLE_PCTV2000E 0x022c |
| 255 | #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 | 256 | #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 |
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 7e92793260f0..49d95040096a 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c | |||
| @@ -1029,12 +1029,6 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { | |||
| 1029 | /* Get */ | 1029 | /* Get */ |
| 1030 | _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1), | 1030 | _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1), |
| 1031 | _DTV_CMD(DTV_API_VERSION, 0, 0), | 1031 | _DTV_CMD(DTV_API_VERSION, 0, 0), |
| 1032 | _DTV_CMD(DTV_CODE_RATE_HP, 0, 0), | ||
| 1033 | _DTV_CMD(DTV_CODE_RATE_LP, 0, 0), | ||
| 1034 | _DTV_CMD(DTV_GUARD_INTERVAL, 0, 0), | ||
| 1035 | _DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0), | ||
| 1036 | _DTV_CMD(DTV_HIERARCHY, 0, 0), | ||
| 1037 | _DTV_CMD(DTV_INTERLEAVING, 0, 0), | ||
| 1038 | 1032 | ||
| 1039 | _DTV_CMD(DTV_ENUM_DELSYS, 0, 0), | 1033 | _DTV_CMD(DTV_ENUM_DELSYS, 0, 0), |
| 1040 | 1034 | ||
| @@ -1042,13 +1036,11 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { | |||
| 1042 | _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 1, 0), | 1036 | _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 1, 0), |
| 1043 | 1037 | ||
| 1044 | _DTV_CMD(DTV_ATSCMH_FIC_VER, 0, 0), | 1038 | _DTV_CMD(DTV_ATSCMH_FIC_VER, 0, 0), |
| 1045 | _DTV_CMD(DTV_ATSCMH_PARADE_ID, 0, 0), | ||
| 1046 | _DTV_CMD(DTV_ATSCMH_NOG, 0, 0), | 1039 | _DTV_CMD(DTV_ATSCMH_NOG, 0, 0), |
| 1047 | _DTV_CMD(DTV_ATSCMH_TNOG, 0, 0), | 1040 | _DTV_CMD(DTV_ATSCMH_TNOG, 0, 0), |
| 1048 | _DTV_CMD(DTV_ATSCMH_SGN, 0, 0), | 1041 | _DTV_CMD(DTV_ATSCMH_SGN, 0, 0), |
| 1049 | _DTV_CMD(DTV_ATSCMH_PRC, 0, 0), | 1042 | _DTV_CMD(DTV_ATSCMH_PRC, 0, 0), |
| 1050 | _DTV_CMD(DTV_ATSCMH_RS_FRAME_MODE, 0, 0), | 1043 | _DTV_CMD(DTV_ATSCMH_RS_FRAME_MODE, 0, 0), |
| 1051 | _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 0, 0), | ||
| 1052 | _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_PRI, 0, 0), | 1044 | _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_PRI, 0, 0), |
| 1053 | _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_SEC, 0, 0), | 1045 | _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_SEC, 0, 0), |
| 1054 | _DTV_CMD(DTV_ATSCMH_SCCC_BLOCK_MODE, 0, 0), | 1046 | _DTV_CMD(DTV_ATSCMH_SCCC_BLOCK_MODE, 0, 0), |
| @@ -1056,8 +1048,6 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { | |||
| 1056 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0), | 1048 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0), |
| 1057 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0), | 1049 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0), |
| 1058 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0), | 1050 | _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0), |
| 1059 | |||
| 1060 | _DTV_CMD(DTV_LNA, 0, 0), | ||
| 1061 | }; | 1051 | }; |
| 1062 | 1052 | ||
| 1063 | static void dtv_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp) | 1053 | static void dtv_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp) |
diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c index f2a90f990ce3..3d399d9a6343 100644 --- a/drivers/media/dvb-frontends/cx22700.c +++ b/drivers/media/dvb-frontends/cx22700.c | |||
| @@ -139,7 +139,7 @@ static int cx22700_set_tps(struct cx22700_state *state, | |||
| 139 | if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) | 139 | if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) |
| 140 | return -EINVAL; | 140 | return -EINVAL; |
| 141 | 141 | ||
| 142 | if (p->guard_interval < GUARD_INTERVAL_1_32 || | 142 | if ((int)p->guard_interval < GUARD_INTERVAL_1_32 || |
| 143 | p->guard_interval > GUARD_INTERVAL_1_4) | 143 | p->guard_interval > GUARD_INTERVAL_1_4) |
| 144 | return -EINVAL; | 144 | return -EINVAL; |
| 145 | 145 | ||
| @@ -152,7 +152,7 @@ static int cx22700_set_tps(struct cx22700_state *state, | |||
| 152 | p->modulation != QAM_64) | 152 | p->modulation != QAM_64) |
| 153 | return -EINVAL; | 153 | return -EINVAL; |
| 154 | 154 | ||
| 155 | if (p->hierarchy < HIERARCHY_NONE || | 155 | if ((int)p->hierarchy < HIERARCHY_NONE || |
| 156 | p->hierarchy > HIERARCHY_4) | 156 | p->hierarchy > HIERARCHY_4) |
| 157 | return -EINVAL; | 157 | return -EINVAL; |
| 158 | 158 | ||
diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 7e28b4ee7d4f..68c88ab58e71 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c | |||
| @@ -338,7 +338,7 @@ static int cx24123_set_fec(struct cx24123_state *state, fe_code_rate_t fec) | |||
| 338 | { | 338 | { |
| 339 | u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; | 339 | u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07; |
| 340 | 340 | ||
| 341 | if ((fec < FEC_NONE) || (fec > FEC_AUTO)) | 341 | if (((int)fec < FEC_NONE) || (fec > FEC_AUTO)) |
| 342 | fec = FEC_AUTO; | 342 | fec = FEC_AUTO; |
| 343 | 343 | ||
| 344 | /* Set the soft decision threshold */ | 344 | /* Set the soft decision threshold */ |
diff --git a/drivers/media/dvb-frontends/dib9000.h b/drivers/media/dvb-frontends/dib9000.h index b5781a48034c..de1cc91fd833 100644 --- a/drivers/media/dvb-frontends/dib9000.h +++ b/drivers/media/dvb-frontends/dib9000.h | |||
| @@ -97,7 +97,7 @@ static inline int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb | |||
| 97 | return -ENODEV; | 97 | return -ENODEV; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | int dib9000_remove_slave_frontend(struct dvb_frontend *fe) | 100 | static inline int dib9000_remove_slave_frontend(struct dvb_frontend *fe) |
| 101 | { | 101 | { |
| 102 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 102 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
| 103 | return -ENODEV; | 103 | return -ENODEV; |
diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c index 6d9853750d2b..e71cc60851e7 100644 --- a/drivers/media/dvb-frontends/drxd_hard.c +++ b/drivers/media/dvb-frontends/drxd_hard.c | |||
| @@ -1748,7 +1748,8 @@ static int DRX_Stop(struct drxd_state *state) | |||
| 1748 | return status; | 1748 | return status; |
| 1749 | } | 1749 | } |
| 1750 | 1750 | ||
| 1751 | int SetOperationMode(struct drxd_state *state, int oMode) | 1751 | #if 0 /* Currently unused */ |
| 1752 | static int SetOperationMode(struct drxd_state *state, int oMode) | ||
| 1752 | { | 1753 | { |
| 1753 | int status; | 1754 | int status; |
| 1754 | 1755 | ||
| @@ -1788,6 +1789,7 @@ int SetOperationMode(struct drxd_state *state, int oMode) | |||
| 1788 | state->operation_mode = oMode; | 1789 | state->operation_mode = oMode; |
| 1789 | return status; | 1790 | return status; |
| 1790 | } | 1791 | } |
| 1792 | #endif | ||
| 1791 | 1793 | ||
| 1792 | static int StartDiversity(struct drxd_state *state) | 1794 | static int StartDiversity(struct drxd_state *state) |
| 1793 | { | 1795 | { |
| @@ -2612,7 +2614,7 @@ static int CDRXD(struct drxd_state *state, u32 IntermediateFrequency) | |||
| 2612 | return 0; | 2614 | return 0; |
| 2613 | } | 2615 | } |
| 2614 | 2616 | ||
| 2615 | int DRXD_init(struct drxd_state *state, const u8 * fw, u32 fw_size) | 2617 | static int DRXD_init(struct drxd_state *state, const u8 *fw, u32 fw_size) |
| 2616 | { | 2618 | { |
| 2617 | int status = 0; | 2619 | int status = 0; |
| 2618 | u32 driverVersion; | 2620 | u32 driverVersion; |
| @@ -2774,7 +2776,7 @@ int DRXD_init(struct drxd_state *state, const u8 * fw, u32 fw_size) | |||
| 2774 | return status; | 2776 | return status; |
| 2775 | } | 2777 | } |
| 2776 | 2778 | ||
| 2777 | int DRXD_status(struct drxd_state *state, u32 * pLockStatus) | 2779 | static int DRXD_status(struct drxd_state *state, u32 *pLockStatus) |
| 2778 | { | 2780 | { |
| 2779 | DRX_GetLockStatus(state, pLockStatus); | 2781 | DRX_GetLockStatus(state, pLockStatus); |
| 2780 | 2782 | ||
diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index 8b4c6d5f8f36..c2fc7da0d6bf 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c | |||
| @@ -65,16 +65,6 @@ static bool IsQAM(struct drxk_state *state) | |||
| 65 | state->m_OperationMode == OM_QAM_ITU_C; | 65 | state->m_OperationMode == OM_QAM_ITU_C; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | bool IsA1WithPatchCode(struct drxk_state *state) | ||
| 69 | { | ||
| 70 | return state->m_DRXK_A1_PATCH_CODE; | ||
| 71 | } | ||
| 72 | |||
| 73 | bool IsA1WithRomCode(struct drxk_state *state) | ||
| 74 | { | ||
| 75 | return state->m_DRXK_A1_ROM_CODE; | ||
| 76 | } | ||
| 77 | |||
| 78 | #define NOA1ROM 0 | 68 | #define NOA1ROM 0 |
| 79 | 69 | ||
| 80 | #define DRXDAP_FASI_SHORT_FORMAT(addr) (((addr) & 0xFC30FF80) == 0) | 70 | #define DRXDAP_FASI_SHORT_FORMAT(addr) (((addr) & 0xFC30FF80) == 0) |
| @@ -189,7 +179,7 @@ static inline u32 MulDiv32(u32 a, u32 b, u32 c) | |||
| 189 | return (u32) tmp64; | 179 | return (u32) tmp64; |
| 190 | } | 180 | } |
| 191 | 181 | ||
| 192 | inline u32 Frac28a(u32 a, u32 c) | 182 | static inline u32 Frac28a(u32 a, u32 c) |
| 193 | { | 183 | { |
| 194 | int i = 0; | 184 | int i = 0; |
| 195 | u32 Q1 = 0; | 185 | u32 Q1 = 0; |
| @@ -587,7 +577,7 @@ static int write_block(struct drxk_state *state, u32 Address, | |||
| 587 | #define DRXK_MAX_RETRIES_POWERUP 20 | 577 | #define DRXK_MAX_RETRIES_POWERUP 20 |
| 588 | #endif | 578 | #endif |
| 589 | 579 | ||
| 590 | int PowerUpDevice(struct drxk_state *state) | 580 | static int PowerUpDevice(struct drxk_state *state) |
| 591 | { | 581 | { |
| 592 | int status; | 582 | int status; |
| 593 | u8 data = 0; | 583 | u8 data = 0; |
| @@ -720,11 +710,6 @@ static int init_state(struct drxk_state *state) | |||
| 720 | 710 | ||
| 721 | state->m_bPowerDown = (ulPowerDown != 0); | 711 | state->m_bPowerDown = (ulPowerDown != 0); |
| 722 | 712 | ||
| 723 | state->m_DRXK_A1_PATCH_CODE = false; | ||
| 724 | state->m_DRXK_A1_ROM_CODE = false; | ||
| 725 | state->m_DRXK_A2_ROM_CODE = false; | ||
| 726 | state->m_DRXK_A3_ROM_CODE = false; | ||
| 727 | state->m_DRXK_A2_PATCH_CODE = false; | ||
| 728 | state->m_DRXK_A3_PATCH_CODE = false; | 713 | state->m_DRXK_A3_PATCH_CODE = false; |
| 729 | 714 | ||
| 730 | /* Init AGC and PGA parameters */ | 715 | /* Init AGC and PGA parameters */ |
| @@ -921,7 +906,7 @@ static int GetDeviceCapabilities(struct drxk_state *state) | |||
| 921 | status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); | 906 | status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); |
| 922 | if (status < 0) | 907 | if (status < 0) |
| 923 | goto error; | 908 | goto error; |
| 924 | status = write16(state, SIO_TOP_COMM_KEY__A, 0xFABA); | 909 | status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); |
| 925 | if (status < 0) | 910 | if (status < 0) |
| 926 | goto error; | 911 | goto error; |
| 927 | status = read16(state, SIO_PDR_OHW_CFG__A, &sioPdrOhwCfg); | 912 | status = read16(state, SIO_PDR_OHW_CFG__A, &sioPdrOhwCfg); |
| @@ -948,7 +933,7 @@ static int GetDeviceCapabilities(struct drxk_state *state) | |||
| 948 | state->m_oscClockFreq = 20250; | 933 | state->m_oscClockFreq = 20250; |
| 949 | break; | 934 | break; |
| 950 | default: | 935 | default: |
| 951 | printk(KERN_ERR "drxk: Clock Frequency is unkonwn\n"); | 936 | printk(KERN_ERR "drxk: Clock Frequency is unknown\n"); |
| 952 | return -EINVAL; | 937 | return -EINVAL; |
| 953 | } | 938 | } |
| 954 | /* | 939 | /* |
| @@ -1217,7 +1202,7 @@ static int MPEGTSConfigurePins(struct drxk_state *state, bool mpegEnable) | |||
| 1217 | goto error; | 1202 | goto error; |
| 1218 | 1203 | ||
| 1219 | /* MPEG TS pad configuration */ | 1204 | /* MPEG TS pad configuration */ |
| 1220 | status = write16(state, SIO_TOP_COMM_KEY__A, 0xFABA); | 1205 | status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); |
| 1221 | if (status < 0) | 1206 | if (status < 0) |
| 1222 | goto error; | 1207 | goto error; |
| 1223 | 1208 | ||
| @@ -5461,6 +5446,7 @@ static int QAMDemodulatorCommand(struct drxk_state *state, | |||
| 5461 | } else { | 5446 | } else { |
| 5462 | printk(KERN_WARNING "drxk: Unknown QAM demodulator parameter " | 5447 | printk(KERN_WARNING "drxk: Unknown QAM demodulator parameter " |
| 5463 | "count %d\n", numberOfParameters); | 5448 | "count %d\n", numberOfParameters); |
| 5449 | status = -EINVAL; | ||
| 5464 | } | 5450 | } |
| 5465 | 5451 | ||
| 5466 | error: | 5452 | error: |
diff --git a/drivers/media/dvb-frontends/drxk_hard.h b/drivers/media/dvb-frontends/drxk_hard.h index 6bb9fc4a7b96..d18a896a9835 100644 --- a/drivers/media/dvb-frontends/drxk_hard.h +++ b/drivers/media/dvb-frontends/drxk_hard.h | |||
| @@ -320,11 +320,7 @@ struct drxk_state { | |||
| 320 | 320 | ||
| 321 | u8 *m_microcode; | 321 | u8 *m_microcode; |
| 322 | int m_microcode_length; | 322 | int m_microcode_length; |
| 323 | bool m_DRXK_A1_PATCH_CODE; | 323 | bool m_DRXK_A3_ROM_CODE; |
| 324 | bool m_DRXK_A1_ROM_CODE; | ||
| 325 | bool m_DRXK_A2_ROM_CODE; | ||
| 326 | bool m_DRXK_A3_ROM_CODE; | ||
| 327 | bool m_DRXK_A2_PATCH_CODE; | ||
| 328 | bool m_DRXK_A3_PATCH_CODE; | 324 | bool m_DRXK_A3_PATCH_CODE; |
| 329 | 325 | ||
| 330 | bool m_rfmirror; | 326 | bool m_rfmirror; |
diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index 5b639087ce45..60a529e3833f 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include "ds3000.h" | 30 | #include "ds3000.h" |
| 31 | 31 | ||
| 32 | static int debug; | 32 | static int debug; |
| 33 | static int force_fw_upload; | ||
| 34 | 33 | ||
| 35 | #define dprintk(args...) \ | 34 | #define dprintk(args...) \ |
| 36 | do { \ | 35 | do { \ |
| @@ -234,7 +233,6 @@ struct ds3000_state { | |||
| 234 | struct i2c_adapter *i2c; | 233 | struct i2c_adapter *i2c; |
| 235 | const struct ds3000_config *config; | 234 | const struct ds3000_config *config; |
| 236 | struct dvb_frontend frontend; | 235 | struct dvb_frontend frontend; |
| 237 | u8 skip_fw_load; | ||
| 238 | /* previous uncorrected block counter for DVB-S2 */ | 236 | /* previous uncorrected block counter for DVB-S2 */ |
| 239 | u16 prevUCBS2; | 237 | u16 prevUCBS2; |
| 240 | }; | 238 | }; |
| @@ -397,9 +395,6 @@ static int ds3000_firmware_ondemand(struct dvb_frontend *fe) | |||
| 397 | if (ret < 0) | 395 | if (ret < 0) |
| 398 | return ret; | 396 | return ret; |
| 399 | 397 | ||
| 400 | if (state->skip_fw_load || !force_fw_upload) | ||
| 401 | return 0; /* Firmware already uploaded, skipping */ | ||
| 402 | |||
| 403 | /* Load firmware */ | 398 | /* Load firmware */ |
| 404 | /* request the firmware, this will block until someone uploads it */ | 399 | /* request the firmware, this will block until someone uploads it */ |
| 405 | printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n", __func__, | 400 | printk(KERN_INFO "%s: Waiting for firmware upload (%s)...\n", __func__, |
| @@ -413,9 +408,6 @@ static int ds3000_firmware_ondemand(struct dvb_frontend *fe) | |||
| 413 | return ret; | 408 | return ret; |
| 414 | } | 409 | } |
| 415 | 410 | ||
| 416 | /* Make sure we don't recurse back through here during loading */ | ||
| 417 | state->skip_fw_load = 1; | ||
| 418 | |||
| 419 | ret = ds3000_load_firmware(fe, fw); | 411 | ret = ds3000_load_firmware(fe, fw); |
| 420 | if (ret) | 412 | if (ret) |
| 421 | printk("%s: Writing firmware to device failed\n", __func__); | 413 | printk("%s: Writing firmware to device failed\n", __func__); |
| @@ -425,9 +417,6 @@ static int ds3000_firmware_ondemand(struct dvb_frontend *fe) | |||
| 425 | dprintk("%s: Firmware upload %s\n", __func__, | 417 | dprintk("%s: Firmware upload %s\n", __func__, |
| 426 | ret == 0 ? "complete" : "failed"); | 418 | ret == 0 ? "complete" : "failed"); |
| 427 | 419 | ||
| 428 | /* Ensure firmware is always loaded if required */ | ||
| 429 | state->skip_fw_load = 0; | ||
| 430 | |||
| 431 | return ret; | 420 | return ret; |
| 432 | } | 421 | } |
| 433 | 422 | ||
| @@ -1309,10 +1298,8 @@ static struct dvb_frontend_ops ds3000_ops = { | |||
| 1309 | module_param(debug, int, 0644); | 1298 | module_param(debug, int, 0644); |
| 1310 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | 1299 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); |
| 1311 | 1300 | ||
| 1312 | module_param(force_fw_upload, int, 0644); | ||
| 1313 | MODULE_PARM_DESC(force_fw_upload, "Force firmware upload (default:0)"); | ||
| 1314 | |||
| 1315 | MODULE_DESCRIPTION("DVB Frontend module for Montage Technology " | 1301 | MODULE_DESCRIPTION("DVB Frontend module for Montage Technology " |
| 1316 | "DS3000/TS2020 hardware"); | 1302 | "DS3000/TS2020 hardware"); |
| 1317 | MODULE_AUTHOR("Konstantin Dimitrov"); | 1303 | MODULE_AUTHOR("Konstantin Dimitrov"); |
| 1318 | MODULE_LICENSE("GPL"); | 1304 | MODULE_LICENSE("GPL"); |
| 1305 | MODULE_FIRMWARE(DS3000_DEFAULT_FIRMWARE); | ||
diff --git a/drivers/media/dvb-frontends/l64781.c b/drivers/media/dvb-frontends/l64781.c index 36fcf559e361..ddf866c46f8b 100644 --- a/drivers/media/dvb-frontends/l64781.c +++ b/drivers/media/dvb-frontends/l64781.c | |||
| @@ -180,11 +180,11 @@ static int apply_frontend_param(struct dvb_frontend *fe) | |||
| 180 | p->transmission_mode != TRANSMISSION_MODE_8K) | 180 | p->transmission_mode != TRANSMISSION_MODE_8K) |
| 181 | return -EINVAL; | 181 | return -EINVAL; |
| 182 | 182 | ||
| 183 | if (p->guard_interval < GUARD_INTERVAL_1_32 || | 183 | if ((int)p->guard_interval < GUARD_INTERVAL_1_32 || |
| 184 | p->guard_interval > GUARD_INTERVAL_1_4) | 184 | p->guard_interval > GUARD_INTERVAL_1_4) |
| 185 | return -EINVAL; | 185 | return -EINVAL; |
| 186 | 186 | ||
| 187 | if (p->hierarchy < HIERARCHY_NONE || | 187 | if ((int)p->hierarchy < HIERARCHY_NONE || |
| 188 | p->hierarchy > HIERARCHY_4) | 188 | p->hierarchy > HIERARCHY_4) |
| 189 | return -EINVAL; | 189 | return -EINVAL; |
| 190 | 190 | ||
diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c index e20bf13aa860..ec388c1d6913 100644 --- a/drivers/media/dvb-frontends/mt312.c +++ b/drivers/media/dvb-frontends/mt312.c | |||
| @@ -549,7 +549,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe) | |||
| 549 | || (p->frequency > fe->ops.info.frequency_max)) | 549 | || (p->frequency > fe->ops.info.frequency_max)) |
| 550 | return -EINVAL; | 550 | return -EINVAL; |
| 551 | 551 | ||
| 552 | if ((p->inversion < INVERSION_OFF) | 552 | if (((int)p->inversion < INVERSION_OFF) |
| 553 | || (p->inversion > INVERSION_ON)) | 553 | || (p->inversion > INVERSION_ON)) |
| 554 | return -EINVAL; | 554 | return -EINVAL; |
| 555 | 555 | ||
| @@ -557,7 +557,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe) | |||
| 557 | || (p->symbol_rate > fe->ops.info.symbol_rate_max)) | 557 | || (p->symbol_rate > fe->ops.info.symbol_rate_max)) |
| 558 | return -EINVAL; | 558 | return -EINVAL; |
| 559 | 559 | ||
| 560 | if ((p->fec_inner < FEC_NONE) | 560 | if (((int)p->fec_inner < FEC_NONE) |
| 561 | || (p->fec_inner > FEC_AUTO)) | 561 | || (p->fec_inner > FEC_AUTO)) |
| 562 | return -EINVAL; | 562 | return -EINVAL; |
| 563 | 563 | ||
diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index b0f6ec03d1eb..362d26d11e82 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c | |||
| @@ -130,7 +130,7 @@ static int rtl2830_rd_reg(struct rtl2830_priv *priv, u16 reg, u8 *val) | |||
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | /* write single register with mask */ | 132 | /* write single register with mask */ |
| 133 | int rtl2830_wr_reg_mask(struct rtl2830_priv *priv, u16 reg, u8 val, u8 mask) | 133 | static int rtl2830_wr_reg_mask(struct rtl2830_priv *priv, u16 reg, u8 val, u8 mask) |
| 134 | { | 134 | { |
| 135 | int ret; | 135 | int ret; |
| 136 | u8 tmp; | 136 | u8 tmp; |
| @@ -150,7 +150,7 @@ int rtl2830_wr_reg_mask(struct rtl2830_priv *priv, u16 reg, u8 val, u8 mask) | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | /* read single register with mask */ | 152 | /* read single register with mask */ |
| 153 | int rtl2830_rd_reg_mask(struct rtl2830_priv *priv, u16 reg, u8 *val, u8 mask) | 153 | static int rtl2830_rd_reg_mask(struct rtl2830_priv *priv, u16 reg, u8 *val, u8 mask) |
| 154 | { | 154 | { |
| 155 | int ret, i; | 155 | int ret, i; |
| 156 | u8 tmp; | 156 | u8 tmp; |
| @@ -256,7 +256,7 @@ static int rtl2830_sleep(struct dvb_frontend *fe) | |||
| 256 | return 0; | 256 | return 0; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | int rtl2830_get_tune_settings(struct dvb_frontend *fe, | 259 | static int rtl2830_get_tune_settings(struct dvb_frontend *fe, |
| 260 | struct dvb_frontend_tune_settings *s) | 260 | struct dvb_frontend_tune_settings *s) |
| 261 | { | 261 | { |
| 262 | s->min_delay_ms = 500; | 262 | s->min_delay_ms = 500; |
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 80c8e5f1182f..73887690b046 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c | |||
| @@ -265,7 +265,7 @@ static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val) | |||
| 265 | return rtl2832_rd_regs(priv, reg, page, val, 1); | 265 | return rtl2832_rd_regs(priv, reg, page, val, 1); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | int rtl2832_rd_demod_reg(struct rtl2832_priv *priv, int reg, u32 *val) | 268 | static int rtl2832_rd_demod_reg(struct rtl2832_priv *priv, int reg, u32 *val) |
| 269 | { | 269 | { |
| 270 | int ret; | 270 | int ret; |
| 271 | 271 | ||
| @@ -305,7 +305,7 @@ err: | |||
| 305 | 305 | ||
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | int rtl2832_wr_demod_reg(struct rtl2832_priv *priv, int reg, u32 val) | 308 | static int rtl2832_wr_demod_reg(struct rtl2832_priv *priv, int reg, u32 val) |
| 309 | { | 309 | { |
| 310 | int ret, i; | 310 | int ret, i; |
| 311 | u8 len; | 311 | u8 len; |
| @@ -510,7 +510,7 @@ static int rtl2832_sleep(struct dvb_frontend *fe) | |||
| 510 | return 0; | 510 | return 0; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | int rtl2832_get_tune_settings(struct dvb_frontend *fe, | 513 | static int rtl2832_get_tune_settings(struct dvb_frontend *fe, |
| 514 | struct dvb_frontend_tune_settings *s) | 514 | struct dvb_frontend_tune_settings *s) |
| 515 | { | 515 | { |
| 516 | struct rtl2832_priv *priv = fe->demodulator_priv; | 516 | struct rtl2832_priv *priv = fe->demodulator_priv; |
diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 79e29de87fb7..cc278b3d6d5a 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c | |||
| @@ -1260,7 +1260,7 @@ static inline void CONVERT32(u32 x, char *str) | |||
| 1260 | *str = '\0'; | 1260 | *str = '\0'; |
| 1261 | } | 1261 | } |
| 1262 | 1262 | ||
| 1263 | int stb0899_get_dev_id(struct stb0899_state *state) | 1263 | static int stb0899_get_dev_id(struct stb0899_state *state) |
| 1264 | { | 1264 | { |
| 1265 | u8 chip_id, release; | 1265 | u8 chip_id, release; |
| 1266 | u16 id; | 1266 | u16 id; |
diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 2a8aaeb1112d..0c8e45949b11 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c | |||
| @@ -879,7 +879,8 @@ static u8 stv0367_readbits(struct stv0367_state *state, u32 label) | |||
| 879 | return val; | 879 | return val; |
| 880 | } | 880 | } |
| 881 | 881 | ||
| 882 | u8 stv0367_getbits(u8 reg, u32 label) | 882 | #if 0 /* Currently, unused */ |
| 883 | static u8 stv0367_getbits(u8 reg, u32 label) | ||
| 883 | { | 884 | { |
| 884 | u8 mask, pos; | 885 | u8 mask, pos; |
| 885 | 886 | ||
| @@ -887,7 +888,7 @@ u8 stv0367_getbits(u8 reg, u32 label) | |||
| 887 | 888 | ||
| 888 | return (reg & mask) >> pos; | 889 | return (reg & mask) >> pos; |
| 889 | } | 890 | } |
| 890 | 891 | #endif | |
| 891 | static int stv0367ter_gate_ctrl(struct dvb_frontend *fe, int enable) | 892 | static int stv0367ter_gate_ctrl(struct dvb_frontend *fe, int enable) |
| 892 | { | 893 | { |
| 893 | struct stv0367_state *state = fe->demodulator_priv; | 894 | struct stv0367_state *state = fe->demodulator_priv; |
| @@ -1263,8 +1264,8 @@ stv0367_ter_signal_type stv0367ter_check_cpamp(struct stv0367_state *state, | |||
| 1263 | return CPAMPStatus; | 1264 | return CPAMPStatus; |
| 1264 | } | 1265 | } |
| 1265 | 1266 | ||
| 1266 | enum | 1267 | static enum stv0367_ter_signal_type |
| 1267 | stv0367_ter_signal_type stv0367ter_lock_algo(struct stv0367_state *state) | 1268 | stv0367ter_lock_algo(struct stv0367_state *state) |
| 1268 | { | 1269 | { |
| 1269 | enum stv0367_ter_signal_type ret_flag; | 1270 | enum stv0367_ter_signal_type ret_flag; |
| 1270 | short int wd, tempo; | 1271 | short int wd, tempo; |
| @@ -1528,7 +1529,7 @@ static int stv0367ter_sleep(struct dvb_frontend *fe) | |||
| 1528 | return stv0367ter_standby(fe, 1); | 1529 | return stv0367ter_standby(fe, 1); |
| 1529 | } | 1530 | } |
| 1530 | 1531 | ||
| 1531 | int stv0367ter_init(struct dvb_frontend *fe) | 1532 | static int stv0367ter_init(struct dvb_frontend *fe) |
| 1532 | { | 1533 | { |
| 1533 | struct stv0367_state *state = fe->demodulator_priv; | 1534 | struct stv0367_state *state = fe->demodulator_priv; |
| 1534 | struct stv0367ter_state *ter_state = state->ter_state; | 1535 | struct stv0367ter_state *ter_state = state->ter_state; |
| @@ -2378,9 +2379,9 @@ static u32 stv0367cab_get_adc_freq(struct dvb_frontend *fe, u32 ExtClk_Hz) | |||
| 2378 | return ADCClk_Hz; | 2379 | return ADCClk_Hz; |
| 2379 | } | 2380 | } |
| 2380 | 2381 | ||
| 2381 | enum stv0367cab_mod stv0367cab_SetQamSize(struct stv0367_state *state, | 2382 | static enum stv0367cab_mod stv0367cab_SetQamSize(struct stv0367_state *state, |
| 2382 | u32 SymbolRate, | 2383 | u32 SymbolRate, |
| 2383 | enum stv0367cab_mod QAMSize) | 2384 | enum stv0367cab_mod QAMSize) |
| 2384 | { | 2385 | { |
| 2385 | /* Set QAM size */ | 2386 | /* Set QAM size */ |
| 2386 | stv0367_writebits(state, F367CAB_QAM_MODE, QAMSize); | 2387 | stv0367_writebits(state, F367CAB_QAM_MODE, QAMSize); |
| @@ -2762,7 +2763,7 @@ static int stv0367cab_sleep(struct dvb_frontend *fe) | |||
| 2762 | return stv0367cab_standby(fe, 1); | 2763 | return stv0367cab_standby(fe, 1); |
| 2763 | } | 2764 | } |
| 2764 | 2765 | ||
| 2765 | int stv0367cab_init(struct dvb_frontend *fe) | 2766 | static int stv0367cab_init(struct dvb_frontend *fe) |
| 2766 | { | 2767 | { |
| 2767 | struct stv0367_state *state = fe->demodulator_priv; | 2768 | struct stv0367_state *state = fe->demodulator_priv; |
| 2768 | struct stv0367cab_state *cab_state = state->cab_state; | 2769 | struct stv0367cab_state *cab_state = state->cab_state; |
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c index 262dfa503c2a..b551ca350e00 100644 --- a/drivers/media/dvb-frontends/stv0900_core.c +++ b/drivers/media/dvb-frontends/stv0900_core.c | |||
| @@ -300,15 +300,15 @@ static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32 | |||
| 300 | { | 300 | { |
| 301 | u32 m_div, clk_sel; | 301 | u32 m_div, clk_sel; |
| 302 | 302 | ||
| 303 | dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk, | ||
| 304 | intp->quartz); | ||
| 305 | |||
| 306 | if (intp == NULL) | 303 | if (intp == NULL) |
| 307 | return STV0900_INVALID_HANDLE; | 304 | return STV0900_INVALID_HANDLE; |
| 308 | 305 | ||
| 309 | if (intp->errs) | 306 | if (intp->errs) |
| 310 | return STV0900_I2C_ERROR; | 307 | return STV0900_I2C_ERROR; |
| 311 | 308 | ||
| 309 | dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk, | ||
| 310 | intp->quartz); | ||
| 311 | |||
| 312 | clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); | 312 | clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); |
| 313 | m_div = ((clk_sel * mclk) / intp->quartz) - 1; | 313 | m_div = ((clk_sel * mclk) / intp->quartz) - 1; |
| 314 | stv0900_write_bits(intp, F0900_M_DIV, m_div); | 314 | stv0900_write_bits(intp, F0900_M_DIV, m_div); |
diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index a83bf6802345..16a4bc54dbe7 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c | |||
| @@ -96,7 +96,8 @@ static int tda10071_rd_reg(struct tda10071_priv *priv, u8 reg, u8 *val) | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | /* write single register with mask */ | 98 | /* write single register with mask */ |
| 99 | int tda10071_wr_reg_mask(struct tda10071_priv *priv, u8 reg, u8 val, u8 mask) | 99 | static int tda10071_wr_reg_mask(struct tda10071_priv *priv, |
| 100 | u8 reg, u8 val, u8 mask) | ||
| 100 | { | 101 | { |
| 101 | int ret; | 102 | int ret; |
| 102 | u8 tmp; | 103 | u8 tmp; |
| @@ -116,7 +117,8 @@ int tda10071_wr_reg_mask(struct tda10071_priv *priv, u8 reg, u8 val, u8 mask) | |||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | /* read single register with mask */ | 119 | /* read single register with mask */ |
| 119 | int tda10071_rd_reg_mask(struct tda10071_priv *priv, u8 reg, u8 *val, u8 mask) | 120 | static int tda10071_rd_reg_mask(struct tda10071_priv *priv, |
| 121 | u8 reg, u8 *val, u8 mask) | ||
| 120 | { | 122 | { |
| 121 | int ret, i; | 123 | int ret, i; |
| 122 | u8 tmp; | 124 | u8 tmp; |
diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index ad7c72e8f517..d281f77d5c28 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <asm/div64.h> | 32 | #include <asm/div64.h> |
| 33 | 33 | ||
| 34 | #include "dvb_frontend.h" | 34 | #include "dvb_frontend.h" |
| 35 | #include "tda18271c2dd.h" | ||
| 35 | 36 | ||
| 36 | struct SStandardParam { | 37 | struct SStandardParam { |
| 37 | s32 m_IFFrequency; | 38 | s32 m_IFFrequency; |
diff --git a/drivers/media/firewire/firedtv.h b/drivers/media/firewire/firedtv.h index 4fdcd8cb7530..c2ba085e0d20 100644 --- a/drivers/media/firewire/firedtv.h +++ b/drivers/media/firewire/firedtv.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #ifndef _FIREDTV_H | 13 | #ifndef _FIREDTV_H |
| 14 | #define _FIREDTV_H | 14 | #define _FIREDTV_H |
| 15 | 15 | ||
| 16 | #include <linux/time.h> | ||
| 16 | #include <linux/dvb/dmx.h> | 17 | #include <linux/dvb/dmx.h> |
| 17 | #include <linux/dvb/frontend.h> | 18 | #include <linux/dvb/frontend.h> |
| 18 | #include <linux/list.h> | 19 | #include <linux/list.h> |
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index 18a38b38fcb8..df163800c8e1 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008--2011 Nokia Corporation | 4 | * Copyright (C) 2008--2011 Nokia Corporation |
| 5 | * | 5 | * |
| 6 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 6 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 7 | * | 7 | * |
| 8 | * Contributors: | 8 | * Contributors: |
| 9 | * Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 9 | * Sakari Ailus <sakari.ailus@iki.fi> |
| 10 | * Tuukka Toivonen <tuukkat76@gmail.com> | 10 | * Tuukka Toivonen <tuukkat76@gmail.com> |
| 11 | * | 11 | * |
| 12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 45ecf8db1eae..64d71fb87a96 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c | |||
| @@ -540,8 +540,8 @@ static int init_device(struct i2c_client *client, struct adv7180_state *state) | |||
| 540 | return 0; | 540 | return 0; |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | static __devinit int adv7180_probe(struct i2c_client *client, | 543 | static int adv7180_probe(struct i2c_client *client, |
| 544 | const struct i2c_device_id *id) | 544 | const struct i2c_device_id *id) |
| 545 | { | 545 | { |
| 546 | struct adv7180_state *state; | 546 | struct adv7180_state *state; |
| 547 | struct v4l2_subdev *sd; | 547 | struct v4l2_subdev *sd; |
| @@ -587,7 +587,7 @@ err: | |||
| 587 | return ret; | 587 | return ret; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | static __devexit int adv7180_remove(struct i2c_client *client) | 590 | static int adv7180_remove(struct i2c_client *client) |
| 591 | { | 591 | { |
| 592 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 592 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 593 | struct adv7180_state *state = to_state(sd); | 593 | struct adv7180_state *state = to_state(sd); |
| @@ -652,7 +652,7 @@ static struct i2c_driver adv7180_driver = { | |||
| 652 | .name = KBUILD_MODNAME, | 652 | .name = KBUILD_MODNAME, |
| 653 | }, | 653 | }, |
| 654 | .probe = adv7180_probe, | 654 | .probe = adv7180_probe, |
| 655 | .remove = __devexit_p(adv7180_remove), | 655 | .remove = adv7180_remove, |
| 656 | #ifdef CONFIG_PM | 656 | #ifdef CONFIG_PM |
| 657 | .suspend = adv7180_suspend, | 657 | .suspend = adv7180_suspend, |
| 658 | .resume = adv7180_resume, | 658 | .resume = adv7180_resume, |
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c index e1d4c89d7140..6fed5b74e743 100644 --- a/drivers/media/i2c/adv7183.c +++ b/drivers/media/i2c/adv7183.c | |||
| @@ -677,22 +677,11 @@ static struct i2c_driver adv7183_driver = { | |||
| 677 | .name = "adv7183", | 677 | .name = "adv7183", |
| 678 | }, | 678 | }, |
| 679 | .probe = adv7183_probe, | 679 | .probe = adv7183_probe, |
| 680 | .remove = __devexit_p(adv7183_remove), | 680 | .remove = adv7183_remove, |
| 681 | .id_table = adv7183_id, | 681 | .id_table = adv7183_id, |
| 682 | }; | 682 | }; |
| 683 | 683 | ||
| 684 | static __init int adv7183_init(void) | 684 | module_i2c_driver(adv7183_driver); |
| 685 | { | ||
| 686 | return i2c_add_driver(&adv7183_driver); | ||
| 687 | } | ||
| 688 | |||
| 689 | static __exit void adv7183_exit(void) | ||
| 690 | { | ||
| 691 | i2c_del_driver(&adv7183_driver); | ||
| 692 | } | ||
| 693 | |||
| 694 | module_init(adv7183_init); | ||
| 695 | module_exit(adv7183_exit); | ||
| 696 | 685 | ||
| 697 | MODULE_DESCRIPTION("Analog Devices ADV7183 video decoder driver"); | 686 | MODULE_DESCRIPTION("Analog Devices ADV7183 video decoder driver"); |
| 698 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); | 687 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 109bc9b12e74..f47555b1000a 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
| @@ -53,8 +53,7 @@ MODULE_LICENSE("GPL"); | |||
| 53 | /* ADV7604 system clock frequency */ | 53 | /* ADV7604 system clock frequency */ |
| 54 | #define ADV7604_fsc (28636360) | 54 | #define ADV7604_fsc (28636360) |
| 55 | 55 | ||
| 56 | #define DIGITAL_INPUT ((state->prim_mode == ADV7604_PRIM_MODE_HDMI_COMP) || \ | 56 | #define DIGITAL_INPUT (state->mode == ADV7604_MODE_HDMI) |
| 57 | (state->prim_mode == ADV7604_PRIM_MODE_HDMI_GR)) | ||
| 58 | 57 | ||
| 59 | /* | 58 | /* |
| 60 | ********************************************************************** | 59 | ********************************************************************** |
| @@ -68,7 +67,7 @@ struct adv7604_state { | |||
| 68 | struct v4l2_subdev sd; | 67 | struct v4l2_subdev sd; |
| 69 | struct media_pad pad; | 68 | struct media_pad pad; |
| 70 | struct v4l2_ctrl_handler hdl; | 69 | struct v4l2_ctrl_handler hdl; |
| 71 | enum adv7604_prim_mode prim_mode; | 70 | enum adv7604_mode mode; |
| 72 | struct v4l2_dv_timings timings; | 71 | struct v4l2_dv_timings timings; |
| 73 | u8 edid[256]; | 72 | u8 edid[256]; |
| 74 | unsigned edid_blocks; | 73 | unsigned edid_blocks; |
| @@ -77,6 +76,7 @@ struct adv7604_state { | |||
| 77 | struct workqueue_struct *work_queues; | 76 | struct workqueue_struct *work_queues; |
| 78 | struct delayed_work delayed_work_enable_hotplug; | 77 | struct delayed_work delayed_work_enable_hotplug; |
| 79 | bool connector_hdmi; | 78 | bool connector_hdmi; |
| 79 | bool restart_stdi_once; | ||
| 80 | 80 | ||
| 81 | /* i2c clients */ | 81 | /* i2c clients */ |
| 82 | struct i2c_client *i2c_avlink; | 82 | struct i2c_client *i2c_avlink; |
| @@ -106,7 +106,6 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
| 106 | V4L2_DV_BT_CEA_720X576P50, | 106 | V4L2_DV_BT_CEA_720X576P50, |
| 107 | V4L2_DV_BT_CEA_1280X720P24, | 107 | V4L2_DV_BT_CEA_1280X720P24, |
| 108 | V4L2_DV_BT_CEA_1280X720P25, | 108 | V4L2_DV_BT_CEA_1280X720P25, |
| 109 | V4L2_DV_BT_CEA_1280X720P30, | ||
| 110 | V4L2_DV_BT_CEA_1280X720P50, | 109 | V4L2_DV_BT_CEA_1280X720P50, |
| 111 | V4L2_DV_BT_CEA_1280X720P60, | 110 | V4L2_DV_BT_CEA_1280X720P60, |
| 112 | V4L2_DV_BT_CEA_1920X1080P24, | 111 | V4L2_DV_BT_CEA_1920X1080P24, |
| @@ -115,6 +114,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
| 115 | V4L2_DV_BT_CEA_1920X1080P50, | 114 | V4L2_DV_BT_CEA_1920X1080P50, |
| 116 | V4L2_DV_BT_CEA_1920X1080P60, | 115 | V4L2_DV_BT_CEA_1920X1080P60, |
| 117 | 116 | ||
| 117 | /* sorted by DMT ID */ | ||
| 118 | V4L2_DV_BT_DMT_640X350P85, | 118 | V4L2_DV_BT_DMT_640X350P85, |
| 119 | V4L2_DV_BT_DMT_640X400P85, | 119 | V4L2_DV_BT_DMT_640X400P85, |
| 120 | V4L2_DV_BT_DMT_720X400P85, | 120 | V4L2_DV_BT_DMT_720X400P85, |
| @@ -164,6 +164,89 @@ static const struct v4l2_dv_timings adv7604_timings[] = { | |||
| 164 | { }, | 164 | { }, |
| 165 | }; | 165 | }; |
| 166 | 166 | ||
| 167 | struct adv7604_video_standards { | ||
| 168 | struct v4l2_dv_timings timings; | ||
| 169 | u8 vid_std; | ||
| 170 | u8 v_freq; | ||
| 171 | }; | ||
| 172 | |||
| 173 | /* sorted by number of lines */ | ||
| 174 | static const struct adv7604_video_standards adv7604_prim_mode_comp[] = { | ||
| 175 | /* { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, TODO flickering */ | ||
| 176 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
| 177 | { V4L2_DV_BT_CEA_1280X720P50, 0x19, 0x01 }, | ||
| 178 | { V4L2_DV_BT_CEA_1280X720P60, 0x19, 0x00 }, | ||
| 179 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
| 180 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
| 181 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
| 182 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
| 183 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
| 184 | /* TODO add 1920x1080P60_RB (CVT timing) */ | ||
| 185 | { }, | ||
| 186 | }; | ||
| 187 | |||
| 188 | /* sorted by number of lines */ | ||
| 189 | static const struct adv7604_video_standards adv7604_prim_mode_gr[] = { | ||
| 190 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
| 191 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
| 192 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
| 193 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
| 194 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
| 195 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
| 196 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
| 197 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
| 198 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
| 199 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
| 200 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
| 201 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
| 202 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
| 203 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
| 204 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
| 205 | { V4L2_DV_BT_DMT_1360X768P60, 0x12, 0x00 }, | ||
| 206 | { V4L2_DV_BT_DMT_1366X768P60, 0x13, 0x00 }, | ||
| 207 | { V4L2_DV_BT_DMT_1400X1050P60, 0x14, 0x00 }, | ||
| 208 | { V4L2_DV_BT_DMT_1400X1050P75, 0x15, 0x00 }, | ||
| 209 | { V4L2_DV_BT_DMT_1600X1200P60, 0x16, 0x00 }, /* TODO not tested */ | ||
| 210 | /* TODO add 1600X1200P60_RB (not a DMT timing) */ | ||
| 211 | { V4L2_DV_BT_DMT_1680X1050P60, 0x18, 0x00 }, | ||
| 212 | { V4L2_DV_BT_DMT_1920X1200P60_RB, 0x19, 0x00 }, /* TODO not tested */ | ||
| 213 | { }, | ||
| 214 | }; | ||
| 215 | |||
| 216 | /* sorted by number of lines */ | ||
| 217 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_comp[] = { | ||
| 218 | { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, | ||
| 219 | { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 }, | ||
| 220 | { V4L2_DV_BT_CEA_1280X720P50, 0x13, 0x01 }, | ||
| 221 | { V4L2_DV_BT_CEA_1280X720P60, 0x13, 0x00 }, | ||
| 222 | { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 }, | ||
| 223 | { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 }, | ||
| 224 | { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 }, | ||
| 225 | { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 }, | ||
| 226 | { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 }, | ||
| 227 | { }, | ||
| 228 | }; | ||
| 229 | |||
| 230 | /* sorted by number of lines */ | ||
| 231 | static const struct adv7604_video_standards adv7604_prim_mode_hdmi_gr[] = { | ||
| 232 | { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 }, | ||
| 233 | { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 }, | ||
| 234 | { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 }, | ||
| 235 | { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 }, | ||
| 236 | { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 }, | ||
| 237 | { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 }, | ||
| 238 | { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 }, | ||
| 239 | { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 }, | ||
| 240 | { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 }, | ||
| 241 | { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 }, | ||
| 242 | { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 }, | ||
| 243 | { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 }, | ||
| 244 | { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 }, | ||
| 245 | { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 }, | ||
| 246 | { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 }, | ||
| 247 | { }, | ||
| 248 | }; | ||
| 249 | |||
| 167 | /* ----------------------------------------------------------------------- */ | 250 | /* ----------------------------------------------------------------------- */ |
| 168 | 251 | ||
| 169 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) | 252 | static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) |
| @@ -403,9 +486,19 @@ static inline int edid_read_block(struct v4l2_subdev *sd, unsigned len, u8 *val) | |||
| 403 | struct i2c_client *client = state->i2c_edid; | 486 | struct i2c_client *client = state->i2c_edid; |
| 404 | u8 msgbuf0[1] = { 0 }; | 487 | u8 msgbuf0[1] = { 0 }; |
| 405 | u8 msgbuf1[256]; | 488 | u8 msgbuf1[256]; |
| 406 | struct i2c_msg msg[2] = { { client->addr, 0, 1, msgbuf0 }, | 489 | struct i2c_msg msg[2] = { |
| 407 | { client->addr, 0 | I2C_M_RD, len, msgbuf1 } | 490 | { |
| 408 | }; | 491 | .addr = client->addr, |
| 492 | .len = 1, | ||
| 493 | .buf = msgbuf0 | ||
| 494 | }, | ||
| 495 | { | ||
| 496 | .addr = client->addr, | ||
| 497 | .flags = I2C_M_RD, | ||
| 498 | .len = len, | ||
| 499 | .buf = msgbuf1 | ||
| 500 | }, | ||
| 501 | }; | ||
| 409 | 502 | ||
| 410 | if (i2c_transfer(client->adapter, msg, 2) < 0) | 503 | if (i2c_transfer(client->adapter, msg, 2) < 0) |
| 411 | return -EIO; | 504 | return -EIO; |
| @@ -672,64 +765,144 @@ static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd) | |||
| 672 | ((io_read(sd, 0x6f) & 0x10) >> 4)); | 765 | ((io_read(sd, 0x6f) & 0x10) >> 4)); |
| 673 | } | 766 | } |
| 674 | 767 | ||
| 675 | static void configure_free_run(struct v4l2_subdev *sd, const struct v4l2_bt_timings *timings) | 768 | static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd, |
| 769 | u8 prim_mode, | ||
| 770 | const struct adv7604_video_standards *predef_vid_timings, | ||
| 771 | const struct v4l2_dv_timings *timings) | ||
| 676 | { | 772 | { |
| 773 | struct adv7604_state *state = to_state(sd); | ||
| 774 | int i; | ||
| 775 | |||
| 776 | for (i = 0; predef_vid_timings[i].timings.bt.width; i++) { | ||
| 777 | if (!v4l_match_dv_timings(timings, &predef_vid_timings[i].timings, | ||
| 778 | DIGITAL_INPUT ? 250000 : 1000000)) | ||
| 779 | continue; | ||
| 780 | io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */ | ||
| 781 | io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + | ||
| 782 | prim_mode); /* v_freq and prim mode */ | ||
| 783 | return 0; | ||
| 784 | } | ||
| 785 | |||
| 786 | return -1; | ||
| 787 | } | ||
| 788 | |||
| 789 | static int configure_predefined_video_timings(struct v4l2_subdev *sd, | ||
| 790 | struct v4l2_dv_timings *timings) | ||
| 791 | { | ||
| 792 | struct adv7604_state *state = to_state(sd); | ||
| 793 | int err; | ||
| 794 | |||
| 795 | v4l2_dbg(1, debug, sd, "%s", __func__); | ||
| 796 | |||
| 797 | /* reset to default values */ | ||
| 798 | io_write(sd, 0x16, 0x43); | ||
| 799 | io_write(sd, 0x17, 0x5a); | ||
| 800 | /* disable embedded syncs for auto graphics mode */ | ||
| 801 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
| 802 | cp_write(sd, 0x8f, 0x00); | ||
| 803 | cp_write(sd, 0x90, 0x00); | ||
| 804 | cp_write(sd, 0xa2, 0x00); | ||
| 805 | cp_write(sd, 0xa3, 0x00); | ||
| 806 | cp_write(sd, 0xa4, 0x00); | ||
| 807 | cp_write(sd, 0xa5, 0x00); | ||
| 808 | cp_write(sd, 0xa6, 0x00); | ||
| 809 | cp_write(sd, 0xa7, 0x00); | ||
| 810 | cp_write(sd, 0xab, 0x00); | ||
| 811 | cp_write(sd, 0xac, 0x00); | ||
| 812 | |||
| 813 | switch (state->mode) { | ||
| 814 | case ADV7604_MODE_COMP: | ||
| 815 | case ADV7604_MODE_GR: | ||
| 816 | err = find_and_set_predefined_video_timings(sd, | ||
| 817 | 0x01, adv7604_prim_mode_comp, timings); | ||
| 818 | if (err) | ||
| 819 | err = find_and_set_predefined_video_timings(sd, | ||
| 820 | 0x02, adv7604_prim_mode_gr, timings); | ||
| 821 | break; | ||
| 822 | case ADV7604_MODE_HDMI: | ||
| 823 | err = find_and_set_predefined_video_timings(sd, | ||
| 824 | 0x05, adv7604_prim_mode_hdmi_comp, timings); | ||
| 825 | if (err) | ||
| 826 | err = find_and_set_predefined_video_timings(sd, | ||
| 827 | 0x06, adv7604_prim_mode_hdmi_gr, timings); | ||
| 828 | break; | ||
| 829 | default: | ||
| 830 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", | ||
| 831 | __func__, state->mode); | ||
| 832 | err = -1; | ||
| 833 | break; | ||
| 834 | } | ||
| 835 | |||
| 836 | |||
| 837 | return err; | ||
| 838 | } | ||
| 839 | |||
| 840 | static void configure_custom_video_timings(struct v4l2_subdev *sd, | ||
| 841 | const struct v4l2_bt_timings *bt) | ||
| 842 | { | ||
| 843 | struct adv7604_state *state = to_state(sd); | ||
| 677 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 844 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 678 | u32 width = htotal(timings); | 845 | u32 width = htotal(bt); |
| 679 | u32 height = vtotal(timings); | 846 | u32 height = vtotal(bt); |
| 680 | u16 ch1_fr_ll = (((u32)timings->pixelclock / 100) > 0) ? | 847 | u16 cp_start_sav = bt->hsync + bt->hbackporch - 4; |
| 681 | ((width * (ADV7604_fsc / 100)) / ((u32)timings->pixelclock / 100)) : 0; | 848 | u16 cp_start_eav = width - bt->hfrontporch; |
| 849 | u16 cp_start_vbi = height - bt->vfrontporch; | ||
| 850 | u16 cp_end_vbi = bt->vsync + bt->vbackporch; | ||
| 851 | u16 ch1_fr_ll = (((u32)bt->pixelclock / 100) > 0) ? | ||
| 852 | ((width * (ADV7604_fsc / 100)) / ((u32)bt->pixelclock / 100)) : 0; | ||
| 853 | const u8 pll[2] = { | ||
| 854 | 0xc0 | ((width >> 8) & 0x1f), | ||
| 855 | width & 0xff | ||
| 856 | }; | ||
| 682 | 857 | ||
| 683 | v4l2_dbg(2, debug, sd, "%s\n", __func__); | 858 | v4l2_dbg(2, debug, sd, "%s\n", __func__); |
| 684 | 859 | ||
| 685 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); /* CH1_FR_LL */ | 860 | switch (state->mode) { |
| 686 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); /* CH1_FR_LL */ | 861 | case ADV7604_MODE_COMP: |
| 687 | cp_write(sd, 0xab, (height >> 4) & 0xff); /* CP_LCOUNT_MAX */ | 862 | case ADV7604_MODE_GR: |
| 688 | cp_write(sd, 0xac, (height & 0x0f) << 4); /* CP_LCOUNT_MAX */ | 863 | /* auto graphics */ |
| 689 | /* TODO support interlaced */ | 864 | io_write(sd, 0x00, 0x07); /* video std */ |
| 690 | cp_write(sd, 0x91, 0x10); /* INTERLACED */ | 865 | io_write(sd, 0x01, 0x02); /* prim mode */ |
| 691 | 866 | /* enable embedded syncs for auto graphics mode */ | |
| 692 | /* Should only be set in auto-graphics mode [REF_02 p. 91-92] */ | 867 | cp_write_and_or(sd, 0x81, 0xef, 0x10); |
| 693 | if ((io_read(sd, 0x00) == 0x07) && (io_read(sd, 0x01) == 0x02)) { | ||
| 694 | u16 cp_start_sav, cp_start_eav, cp_start_vbi, cp_end_vbi; | ||
| 695 | const u8 pll[2] = { | ||
| 696 | (0xc0 | ((width >> 8) & 0x1f)), | ||
| 697 | (width & 0xff) | ||
| 698 | }; | ||
| 699 | 868 | ||
| 869 | /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */ | ||
| 700 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ | 870 | /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ |
| 701 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ | 871 | /* IO-map reg. 0x16 and 0x17 should be written in sequence */ |
| 702 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { | 872 | if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { |
| 703 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); | 873 | v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); |
| 704 | return; | 874 | break; |
| 705 | } | 875 | } |
| 706 | 876 | ||
| 707 | /* active video - horizontal timing */ | 877 | /* active video - horizontal timing */ |
| 708 | cp_start_sav = timings->hsync + timings->hbackporch - 4; | ||
| 709 | cp_start_eav = width - timings->hfrontporch; | ||
| 710 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); | 878 | cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); |
| 711 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | ((cp_start_eav >> 8) & 0x0f)); | 879 | cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | |
| 880 | ((cp_start_eav >> 8) & 0x0f)); | ||
| 712 | cp_write(sd, 0xa4, cp_start_eav & 0xff); | 881 | cp_write(sd, 0xa4, cp_start_eav & 0xff); |
| 713 | 882 | ||
| 714 | /* active video - vertical timing */ | 883 | /* active video - vertical timing */ |
| 715 | cp_start_vbi = height - timings->vfrontporch; | ||
| 716 | cp_end_vbi = timings->vsync + timings->vbackporch; | ||
| 717 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); | 884 | cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); |
| 718 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | ((cp_end_vbi >> 8) & 0xf)); | 885 | cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | |
| 886 | ((cp_end_vbi >> 8) & 0xf)); | ||
| 719 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); | 887 | cp_write(sd, 0xa7, cp_end_vbi & 0xff); |
| 720 | } else { | 888 | break; |
| 721 | /* reset to default values */ | 889 | case ADV7604_MODE_HDMI: |
| 722 | io_write(sd, 0x16, 0x43); | 890 | /* set default prim_mode/vid_std for HDMI |
| 723 | io_write(sd, 0x17, 0x5a); | 891 | accoring to [REF_03, c. 4.2] */ |
| 724 | cp_write(sd, 0xa2, 0x00); | 892 | io_write(sd, 0x00, 0x02); /* video std */ |
| 725 | cp_write(sd, 0xa3, 0x00); | 893 | io_write(sd, 0x01, 0x06); /* prim mode */ |
| 726 | cp_write(sd, 0xa4, 0x00); | 894 | break; |
| 727 | cp_write(sd, 0xa5, 0x00); | 895 | default: |
| 728 | cp_write(sd, 0xa6, 0x00); | 896 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
| 729 | cp_write(sd, 0xa7, 0x00); | 897 | __func__, state->mode); |
| 898 | break; | ||
| 730 | } | 899 | } |
| 731 | } | ||
| 732 | 900 | ||
| 901 | cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); | ||
| 902 | cp_write(sd, 0x90, ch1_fr_ll & 0xff); | ||
| 903 | cp_write(sd, 0xab, (height >> 4) & 0xff); | ||
| 904 | cp_write(sd, 0xac, (height & 0x0f) << 4); | ||
| 905 | } | ||
| 733 | 906 | ||
| 734 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) | 907 | static void set_rgb_quantization_range(struct v4l2_subdev *sd) |
| 735 | { | 908 | { |
| @@ -738,12 +911,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) | |||
| 738 | switch (state->rgb_quantization_range) { | 911 | switch (state->rgb_quantization_range) { |
| 739 | case V4L2_DV_RGB_RANGE_AUTO: | 912 | case V4L2_DV_RGB_RANGE_AUTO: |
| 740 | /* automatic */ | 913 | /* automatic */ |
| 741 | if ((hdmi_read(sd, 0x05) & 0x80) || | 914 | if (DIGITAL_INPUT && !(hdmi_read(sd, 0x05) & 0x80)) { |
| 742 | (state->prim_mode == ADV7604_PRIM_MODE_COMP) || | ||
| 743 | (state->prim_mode == ADV7604_PRIM_MODE_RGB)) { | ||
| 744 | /* receiving HDMI or analog signal */ | ||
| 745 | io_write_and_or(sd, 0x02, 0x0f, 0xf0); | ||
| 746 | } else { | ||
| 747 | /* receiving DVI-D signal */ | 915 | /* receiving DVI-D signal */ |
| 748 | 916 | ||
| 749 | /* ADV7604 selects RGB limited range regardless of | 917 | /* ADV7604 selects RGB limited range regardless of |
| @@ -756,6 +924,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) | |||
| 756 | /* RGB full range (0-255) */ | 924 | /* RGB full range (0-255) */ |
| 757 | io_write_and_or(sd, 0x02, 0x0f, 0x10); | 925 | io_write_and_or(sd, 0x02, 0x0f, 0x10); |
| 758 | } | 926 | } |
| 927 | } else { | ||
| 928 | /* receiving HDMI or analog signal, set automode */ | ||
| 929 | io_write_and_or(sd, 0x02, 0x0f, 0xf0); | ||
| 759 | } | 930 | } |
| 760 | break; | 931 | break; |
| 761 | case V4L2_DV_RGB_RANGE_LIMITED: | 932 | case V4L2_DV_RGB_RANGE_LIMITED: |
| @@ -967,8 +1138,10 @@ static int stdi2dv_timings(struct v4l2_subdev *sd, | |||
| 967 | state->aspect_ratio, timings)) | 1138 | state->aspect_ratio, timings)) |
| 968 | return 0; | 1139 | return 0; |
| 969 | 1140 | ||
| 970 | v4l2_dbg(2, debug, sd, "%s: No format candidate found for lcf=%d, bl = %d\n", | 1141 | v4l2_dbg(2, debug, sd, |
| 971 | __func__, stdi->lcf, stdi->bl); | 1142 | "%s: No format candidate found for lcvs = %d, lcf=%d, bl = %d, %chsync, %cvsync\n", |
| 1143 | __func__, stdi->lcvs, stdi->lcf, stdi->bl, | ||
| 1144 | stdi->hs_pol, stdi->vs_pol); | ||
| 972 | return -1; | 1145 | return -1; |
| 973 | } | 1146 | } |
| 974 | 1147 | ||
| @@ -1123,7 +1296,7 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, | |||
| 1123 | adv7604_fill_optional_dv_timings_fields(sd, timings); | 1296 | adv7604_fill_optional_dv_timings_fields(sd, timings); |
| 1124 | } else { | 1297 | } else { |
| 1125 | /* find format | 1298 | /* find format |
| 1126 | * Since LCVS values are inaccurate (REF_03, page 275-276), | 1299 | * Since LCVS values are inaccurate [REF_03, p. 275-276], |
| 1127 | * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. | 1300 | * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. |
| 1128 | */ | 1301 | */ |
| 1129 | if (!stdi2dv_timings(sd, &stdi, timings)) | 1302 | if (!stdi2dv_timings(sd, &stdi, timings)) |
| @@ -1135,9 +1308,31 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, | |||
| 1135 | stdi.lcvs -= 2; | 1308 | stdi.lcvs -= 2; |
| 1136 | v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); | 1309 | v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); |
| 1137 | if (stdi2dv_timings(sd, &stdi, timings)) { | 1310 | if (stdi2dv_timings(sd, &stdi, timings)) { |
| 1311 | /* | ||
| 1312 | * The STDI block may measure wrong values, especially | ||
| 1313 | * for lcvs and lcf. If the driver can not find any | ||
| 1314 | * valid timing, the STDI block is restarted to measure | ||
| 1315 | * the video timings again. The function will return an | ||
| 1316 | * error, but the restart of STDI will generate a new | ||
| 1317 | * STDI interrupt and the format detection process will | ||
| 1318 | * restart. | ||
| 1319 | */ | ||
| 1320 | if (state->restart_stdi_once) { | ||
| 1321 | v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__); | ||
| 1322 | /* TODO restart STDI for Sync Channel 2 */ | ||
| 1323 | /* enter one-shot mode */ | ||
| 1324 | cp_write_and_or(sd, 0x86, 0xf9, 0x00); | ||
| 1325 | /* trigger STDI restart */ | ||
| 1326 | cp_write_and_or(sd, 0x86, 0xf9, 0x04); | ||
| 1327 | /* reset to continuous mode */ | ||
| 1328 | cp_write_and_or(sd, 0x86, 0xf9, 0x02); | ||
| 1329 | state->restart_stdi_once = false; | ||
| 1330 | return -ENOLINK; | ||
| 1331 | } | ||
| 1138 | v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); | 1332 | v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); |
| 1139 | return -ERANGE; | 1333 | return -ERANGE; |
| 1140 | } | 1334 | } |
| 1335 | state->restart_stdi_once = true; | ||
| 1141 | } | 1336 | } |
| 1142 | found: | 1337 | found: |
| 1143 | 1338 | ||
| @@ -1166,6 +1361,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
| 1166 | { | 1361 | { |
| 1167 | struct adv7604_state *state = to_state(sd); | 1362 | struct adv7604_state *state = to_state(sd); |
| 1168 | struct v4l2_bt_timings *bt; | 1363 | struct v4l2_bt_timings *bt; |
| 1364 | int err; | ||
| 1169 | 1365 | ||
| 1170 | if (!timings) | 1366 | if (!timings) |
| 1171 | return -EINVAL; | 1367 | return -EINVAL; |
| @@ -1178,12 +1374,20 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd, | |||
| 1178 | __func__, (u32)bt->pixelclock); | 1374 | __func__, (u32)bt->pixelclock); |
| 1179 | return -ERANGE; | 1375 | return -ERANGE; |
| 1180 | } | 1376 | } |
| 1377 | |||
| 1181 | adv7604_fill_optional_dv_timings_fields(sd, timings); | 1378 | adv7604_fill_optional_dv_timings_fields(sd, timings); |
| 1182 | 1379 | ||
| 1183 | state->timings = *timings; | 1380 | state->timings = *timings; |
| 1184 | 1381 | ||
| 1185 | /* freerun */ | 1382 | cp_write(sd, 0x91, bt->interlaced ? 0x50 : 0x10); |
| 1186 | configure_free_run(sd, bt); | 1383 | |
| 1384 | /* Use prim_mode and vid_std when available */ | ||
| 1385 | err = configure_predefined_video_timings(sd, timings); | ||
| 1386 | if (err) { | ||
| 1387 | /* custom settings when the video format | ||
| 1388 | does not have prim_mode/vid_std */ | ||
| 1389 | configure_custom_video_timings(sd, bt); | ||
| 1390 | } | ||
| 1187 | 1391 | ||
| 1188 | set_rgb_quantization_range(sd); | 1392 | set_rgb_quantization_range(sd); |
| 1189 | 1393 | ||
| @@ -1203,24 +1407,25 @@ static int adv7604_g_dv_timings(struct v4l2_subdev *sd, | |||
| 1203 | return 0; | 1407 | return 0; |
| 1204 | } | 1408 | } |
| 1205 | 1409 | ||
| 1206 | static void enable_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) | 1410 | static void enable_input(struct v4l2_subdev *sd) |
| 1207 | { | 1411 | { |
| 1208 | switch (prim_mode) { | 1412 | struct adv7604_state *state = to_state(sd); |
| 1209 | case ADV7604_PRIM_MODE_COMP: | 1413 | |
| 1210 | case ADV7604_PRIM_MODE_RGB: | 1414 | switch (state->mode) { |
| 1415 | case ADV7604_MODE_COMP: | ||
| 1416 | case ADV7604_MODE_GR: | ||
| 1211 | /* enable */ | 1417 | /* enable */ |
| 1212 | io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ | 1418 | io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ |
| 1213 | break; | 1419 | break; |
| 1214 | case ADV7604_PRIM_MODE_HDMI_COMP: | 1420 | case ADV7604_MODE_HDMI: |
| 1215 | case ADV7604_PRIM_MODE_HDMI_GR: | ||
| 1216 | /* enable */ | 1421 | /* enable */ |
| 1217 | hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ | 1422 | hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ |
| 1218 | hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ | 1423 | hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ |
| 1219 | io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ | 1424 | io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ |
| 1220 | break; | 1425 | break; |
| 1221 | default: | 1426 | default: |
| 1222 | v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", | 1427 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
| 1223 | __func__, prim_mode); | 1428 | __func__, state->mode); |
| 1224 | break; | 1429 | break; |
| 1225 | } | 1430 | } |
| 1226 | } | 1431 | } |
| @@ -1233,17 +1438,13 @@ static void disable_input(struct v4l2_subdev *sd) | |||
| 1233 | hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ | 1438 | hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ |
| 1234 | } | 1439 | } |
| 1235 | 1440 | ||
| 1236 | static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) | 1441 | static void select_input(struct v4l2_subdev *sd) |
| 1237 | { | 1442 | { |
| 1238 | switch (prim_mode) { | 1443 | struct adv7604_state *state = to_state(sd); |
| 1239 | case ADV7604_PRIM_MODE_COMP: | ||
| 1240 | case ADV7604_PRIM_MODE_RGB: | ||
| 1241 | /* set mode and select free run resolution */ | ||
| 1242 | io_write(sd, 0x00, 0x07); /* video std */ | ||
| 1243 | io_write(sd, 0x01, 0x02); /* prim mode */ | ||
| 1244 | /* enable embedded syncs for auto graphics mode */ | ||
| 1245 | cp_write_and_or(sd, 0x81, 0xef, 0x10); | ||
| 1246 | 1444 | ||
| 1445 | switch (state->mode) { | ||
| 1446 | case ADV7604_MODE_COMP: | ||
| 1447 | case ADV7604_MODE_GR: | ||
| 1247 | /* reset ADI recommended settings for HDMI: */ | 1448 | /* reset ADI recommended settings for HDMI: */ |
| 1248 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1449 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
| 1249 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ | 1450 | hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ |
| @@ -1271,16 +1472,7 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod | |||
| 1271 | cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ | 1472 | cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ |
| 1272 | break; | 1473 | break; |
| 1273 | 1474 | ||
| 1274 | case ADV7604_PRIM_MODE_HDMI_COMP: | 1475 | case ADV7604_MODE_HDMI: |
| 1275 | case ADV7604_PRIM_MODE_HDMI_GR: | ||
| 1276 | /* set mode and select free run resolution */ | ||
| 1277 | /* video std */ | ||
| 1278 | io_write(sd, 0x00, | ||
| 1279 | (prim_mode == ADV7604_PRIM_MODE_HDMI_GR) ? 0x02 : 0x1e); | ||
| 1280 | io_write(sd, 0x01, prim_mode); /* prim mode */ | ||
| 1281 | /* disable embedded syncs for auto graphics mode */ | ||
| 1282 | cp_write_and_or(sd, 0x81, 0xef, 0x00); | ||
| 1283 | |||
| 1284 | /* set ADI recommended settings for HDMI: */ | 1476 | /* set ADI recommended settings for HDMI: */ |
| 1285 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ | 1477 | /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ |
| 1286 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ | 1478 | hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ |
| @@ -1309,7 +1501,8 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod | |||
| 1309 | 1501 | ||
| 1310 | break; | 1502 | break; |
| 1311 | default: | 1503 | default: |
| 1312 | v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", __func__, prim_mode); | 1504 | v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", |
| 1505 | __func__, state->mode); | ||
| 1313 | break; | 1506 | break; |
| 1314 | } | 1507 | } |
| 1315 | } | 1508 | } |
| @@ -1321,26 +1514,13 @@ static int adv7604_s_routing(struct v4l2_subdev *sd, | |||
| 1321 | 1514 | ||
| 1322 | v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); | 1515 | v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); |
| 1323 | 1516 | ||
| 1324 | switch (input) { | 1517 | state->mode = input; |
| 1325 | case 0: | ||
| 1326 | /* TODO select HDMI_COMP or HDMI_GR */ | ||
| 1327 | state->prim_mode = ADV7604_PRIM_MODE_HDMI_COMP; | ||
| 1328 | break; | ||
| 1329 | case 1: | ||
| 1330 | state->prim_mode = ADV7604_PRIM_MODE_RGB; | ||
| 1331 | break; | ||
| 1332 | case 2: | ||
| 1333 | state->prim_mode = ADV7604_PRIM_MODE_COMP; | ||
| 1334 | break; | ||
| 1335 | default: | ||
| 1336 | return -EINVAL; | ||
| 1337 | } | ||
| 1338 | 1518 | ||
| 1339 | disable_input(sd); | 1519 | disable_input(sd); |
| 1340 | 1520 | ||
| 1341 | select_input(sd, state->prim_mode); | 1521 | select_input(sd); |
| 1342 | 1522 | ||
| 1343 | enable_input(sd, state->prim_mode); | 1523 | enable_input(sd); |
| 1344 | 1524 | ||
| 1345 | return 0; | 1525 | return 0; |
| 1346 | } | 1526 | } |
| @@ -1549,8 +1729,9 @@ static int adv7604_log_status(struct v4l2_subdev *sd) | |||
| 1549 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); | 1729 | v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); |
| 1550 | v4l2_info(sd, "CP free run: %s\n", | 1730 | v4l2_info(sd, "CP free run: %s\n", |
| 1551 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); | 1731 | (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); |
| 1552 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", | 1732 | v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", |
| 1553 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); | 1733 | io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, |
| 1734 | (io_read(sd, 0x01) & 0x70) >> 4); | ||
| 1554 | 1735 | ||
| 1555 | v4l2_info(sd, "-----Video Timings-----\n"); | 1736 | v4l2_info(sd, "-----Video Timings-----\n"); |
| 1556 | if (read_stdi(sd, &stdi)) | 1737 | if (read_stdi(sd, &stdi)) |
| @@ -1712,9 +1893,9 @@ static int adv7604_core_init(struct v4l2_subdev *sd) | |||
| 1712 | cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ | 1893 | cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ |
| 1713 | cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ | 1894 | cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ |
| 1714 | cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - | 1895 | cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - |
| 1715 | ADI recommended setting [REF_01 c. 2.3.3] */ | 1896 | ADI recommended setting [REF_01, c. 2.3.3] */ |
| 1716 | cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - | 1897 | cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - |
| 1717 | ADI recommended setting [REF_01 c. 2.3.3] */ | 1898 | ADI recommended setting [REF_01, c. 2.3.3] */ |
| 1718 | cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution | 1899 | cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution |
| 1719 | for digital formats */ | 1900 | for digital formats */ |
| 1720 | 1901 | ||
| @@ -1724,11 +1905,6 @@ static int adv7604_core_init(struct v4l2_subdev *sd) | |||
| 1724 | afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ | 1905 | afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ |
| 1725 | io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); | 1906 | io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); |
| 1726 | 1907 | ||
| 1727 | state->prim_mode = pdata->prim_mode; | ||
| 1728 | select_input(sd, pdata->prim_mode); | ||
| 1729 | |||
| 1730 | enable_input(sd, pdata->prim_mode); | ||
| 1731 | |||
| 1732 | /* interrupts */ | 1908 | /* interrupts */ |
| 1733 | io_write(sd, 0x40, 0xc2); /* Configure INT1 */ | 1909 | io_write(sd, 0x40, 0xc2); /* Configure INT1 */ |
| 1734 | io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ | 1910 | io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ |
| @@ -1883,6 +2059,7 @@ static int adv7604_probe(struct i2c_client *client, | |||
| 1883 | v4l2_err(sd, "failed to create all i2c clients\n"); | 2059 | v4l2_err(sd, "failed to create all i2c clients\n"); |
| 1884 | goto err_i2c; | 2060 | goto err_i2c; |
| 1885 | } | 2061 | } |
| 2062 | state->restart_stdi_once = true; | ||
| 1886 | 2063 | ||
| 1887 | /* work queues */ | 2064 | /* work queues */ |
| 1888 | state->work_queues = create_singlethread_workqueue(client->name); | 2065 | state->work_queues = create_singlethread_workqueue(client->name); |
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c index 3bfdbf9d9bf1..58d523f2648f 100644 --- a/drivers/media/i2c/as3645a.c +++ b/drivers/media/i2c/as3645a.c | |||
| @@ -713,7 +713,7 @@ static int as3645a_resume(struct device *dev) | |||
| 713 | * The number of LEDs reported in platform data is used to compute default | 713 | * The number of LEDs reported in platform data is used to compute default |
| 714 | * limits. Parameters passed through platform data can override those limits. | 714 | * limits. Parameters passed through platform data can override those limits. |
| 715 | */ | 715 | */ |
| 716 | static int __devinit as3645a_init_controls(struct as3645a *flash) | 716 | static int as3645a_init_controls(struct as3645a *flash) |
| 717 | { | 717 | { |
| 718 | const struct as3645a_platform_data *pdata = flash->pdata; | 718 | const struct as3645a_platform_data *pdata = flash->pdata; |
| 719 | struct v4l2_ctrl *ctrl; | 719 | struct v4l2_ctrl *ctrl; |
| @@ -804,8 +804,8 @@ static int __devinit as3645a_init_controls(struct as3645a *flash) | |||
| 804 | return flash->ctrls.error; | 804 | return flash->ctrls.error; |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | static int __devinit as3645a_probe(struct i2c_client *client, | 807 | static int as3645a_probe(struct i2c_client *client, |
| 808 | const struct i2c_device_id *devid) | 808 | const struct i2c_device_id *devid) |
| 809 | { | 809 | { |
| 810 | struct as3645a *flash; | 810 | struct as3645a *flash; |
| 811 | int ret; | 811 | int ret; |
| @@ -846,7 +846,7 @@ done: | |||
| 846 | return ret; | 846 | return ret; |
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | static int __devexit as3645a_remove(struct i2c_client *client) | 849 | static int as3645a_remove(struct i2c_client *client) |
| 850 | { | 850 | { |
| 851 | struct v4l2_subdev *subdev = i2c_get_clientdata(client); | 851 | struct v4l2_subdev *subdev = i2c_get_clientdata(client); |
| 852 | struct as3645a *flash = to_as3645a(subdev); | 852 | struct as3645a *flash = to_as3645a(subdev); |
| @@ -877,7 +877,7 @@ static struct i2c_driver as3645a_i2c_driver = { | |||
| 877 | .pm = &as3645a_pm_ops, | 877 | .pm = &as3645a_pm_ops, |
| 878 | }, | 878 | }, |
| 879 | .probe = as3645a_probe, | 879 | .probe = as3645a_probe, |
| 880 | .remove = __devexit_p(as3645a_remove), | 880 | .remove = as3645a_remove, |
| 881 | .id_table = as3645a_id_table, | 881 | .id_table = as3645a_id_table, |
| 882 | }; | 882 | }; |
| 883 | 883 | ||
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c b/drivers/media/i2c/cx25840/cx25840-core.c index 2cee69e34184..f4149eb4d7b4 100644 --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c | |||
| @@ -2065,7 +2065,7 @@ static int cx25840_irq_handler(struct v4l2_subdev *sd, u32 status, | |||
| 2065 | #define DIF_BPF_COEFF3435 (0x38c) | 2065 | #define DIF_BPF_COEFF3435 (0x38c) |
| 2066 | #define DIF_BPF_COEFF36 (0x390) | 2066 | #define DIF_BPF_COEFF36 (0x390) |
| 2067 | 2067 | ||
| 2068 | void cx23885_dif_setup(struct i2c_client *client, u32 ifHz) | 2068 | static void cx23885_dif_setup(struct i2c_client *client, u32 ifHz) |
| 2069 | { | 2069 | { |
| 2070 | u64 pll_freq; | 2070 | u64 pll_freq; |
| 2071 | u32 pll_freq_word; | 2071 | u32 pll_freq_word; |
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index 04f192a0398a..08ae067b2b6f 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c | |||
| @@ -284,7 +284,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
| 284 | { | 284 | { |
| 285 | char *ir_codes = NULL; | 285 | char *ir_codes = NULL; |
| 286 | const char *name = NULL; | 286 | const char *name = NULL; |
| 287 | u64 rc_type = RC_TYPE_UNKNOWN; | 287 | u64 rc_type = RC_BIT_UNKNOWN; |
| 288 | struct IR_i2c *ir; | 288 | struct IR_i2c *ir; |
| 289 | struct rc_dev *rc = NULL; | 289 | struct rc_dev *rc = NULL; |
| 290 | struct i2c_adapter *adap = client->adapter; | 290 | struct i2c_adapter *adap = client->adapter; |
| @@ -303,7 +303,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
| 303 | case 0x64: | 303 | case 0x64: |
| 304 | name = "Pixelview"; | 304 | name = "Pixelview"; |
| 305 | ir->get_key = get_key_pixelview; | 305 | ir->get_key = get_key_pixelview; |
| 306 | rc_type = RC_TYPE_OTHER; | 306 | rc_type = RC_BIT_OTHER; |
| 307 | ir_codes = RC_MAP_EMPTY; | 307 | ir_codes = RC_MAP_EMPTY; |
| 308 | break; | 308 | break; |
| 309 | case 0x18: | 309 | case 0x18: |
| @@ -311,31 +311,31 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
| 311 | case 0x1a: | 311 | case 0x1a: |
| 312 | name = "Hauppauge"; | 312 | name = "Hauppauge"; |
| 313 | ir->get_key = get_key_haup; | 313 | ir->get_key = get_key_haup; |
| 314 | rc_type = RC_TYPE_RC5; | 314 | rc_type = RC_BIT_RC5; |
| 315 | ir_codes = RC_MAP_HAUPPAUGE; | 315 | ir_codes = RC_MAP_HAUPPAUGE; |
| 316 | break; | 316 | break; |
| 317 | case 0x30: | 317 | case 0x30: |
| 318 | name = "KNC One"; | 318 | name = "KNC One"; |
| 319 | ir->get_key = get_key_knc1; | 319 | ir->get_key = get_key_knc1; |
| 320 | rc_type = RC_TYPE_OTHER; | 320 | rc_type = RC_BIT_OTHER; |
| 321 | ir_codes = RC_MAP_EMPTY; | 321 | ir_codes = RC_MAP_EMPTY; |
| 322 | break; | 322 | break; |
| 323 | case 0x6b: | 323 | case 0x6b: |
| 324 | name = "FusionHDTV"; | 324 | name = "FusionHDTV"; |
| 325 | ir->get_key = get_key_fusionhdtv; | 325 | ir->get_key = get_key_fusionhdtv; |
| 326 | rc_type = RC_TYPE_RC5; | 326 | rc_type = RC_BIT_RC5; |
| 327 | ir_codes = RC_MAP_FUSIONHDTV_MCE; | 327 | ir_codes = RC_MAP_FUSIONHDTV_MCE; |
| 328 | break; | 328 | break; |
| 329 | case 0x40: | 329 | case 0x40: |
| 330 | name = "AVerMedia Cardbus remote"; | 330 | name = "AVerMedia Cardbus remote"; |
| 331 | ir->get_key = get_key_avermedia_cardbus; | 331 | ir->get_key = get_key_avermedia_cardbus; |
| 332 | rc_type = RC_TYPE_OTHER; | 332 | rc_type = RC_BIT_OTHER; |
| 333 | ir_codes = RC_MAP_AVERMEDIA_CARDBUS; | 333 | ir_codes = RC_MAP_AVERMEDIA_CARDBUS; |
| 334 | break; | 334 | break; |
| 335 | case 0x71: | 335 | case 0x71: |
| 336 | name = "Hauppauge/Zilog Z8"; | 336 | name = "Hauppauge/Zilog Z8"; |
| 337 | ir->get_key = get_key_haup_xvr; | 337 | ir->get_key = get_key_haup_xvr; |
| 338 | rc_type = RC_TYPE_RC5; | 338 | rc_type = RC_BIT_RC5; |
| 339 | ir_codes = RC_MAP_HAUPPAUGE; | 339 | ir_codes = RC_MAP_HAUPPAUGE; |
| 340 | break; | 340 | break; |
| 341 | } | 341 | } |
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c index 8131d651de9e..8a8d42fe2633 100644 --- a/drivers/media/i2c/m5mols/m5mols_core.c +++ b/drivers/media/i2c/m5mols/m5mols_core.c | |||
| @@ -926,8 +926,8 @@ static irqreturn_t m5mols_irq_handler(int irq, void *data) | |||
| 926 | return IRQ_HANDLED; | 926 | return IRQ_HANDLED; |
| 927 | } | 927 | } |
| 928 | 928 | ||
| 929 | static int __devinit m5mols_probe(struct i2c_client *client, | 929 | static int m5mols_probe(struct i2c_client *client, |
| 930 | const struct i2c_device_id *id) | 930 | const struct i2c_device_id *id) |
| 931 | { | 931 | { |
| 932 | const struct m5mols_platform_data *pdata = client->dev.platform_data; | 932 | const struct m5mols_platform_data *pdata = client->dev.platform_data; |
| 933 | struct m5mols_info *info; | 933 | struct m5mols_info *info; |
| @@ -1018,7 +1018,7 @@ out_free: | |||
| 1018 | return ret; | 1018 | return ret; |
| 1019 | } | 1019 | } |
| 1020 | 1020 | ||
| 1021 | static int __devexit m5mols_remove(struct i2c_client *client) | 1021 | static int m5mols_remove(struct i2c_client *client) |
| 1022 | { | 1022 | { |
| 1023 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 1023 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 1024 | struct m5mols_info *info = to_m5mols(sd); | 1024 | struct m5mols_info *info = to_m5mols(sd); |
| @@ -1045,7 +1045,7 @@ static struct i2c_driver m5mols_i2c_driver = { | |||
| 1045 | .name = MODULE_NAME, | 1045 | .name = MODULE_NAME, |
| 1046 | }, | 1046 | }, |
| 1047 | .probe = m5mols_probe, | 1047 | .probe = m5mols_probe, |
| 1048 | .remove = __devexit_p(m5mols_remove), | 1048 | .remove = m5mols_remove, |
| 1049 | .id_table = m5mols_id, | 1049 | .id_table = m5mols_id, |
| 1050 | }; | 1050 | }; |
| 1051 | 1051 | ||
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c index 49c1b3abb425..2750de634270 100644 --- a/drivers/media/i2c/s5k4ecgx.c +++ b/drivers/media/i2c/s5k4ecgx.c | |||
| @@ -343,7 +343,7 @@ static int s5k4ecgx_load_firmware(struct v4l2_subdev *sd) | |||
| 343 | } | 343 | } |
| 344 | regs_num = le32_to_cpu(get_unaligned_le32(fw->data)); | 344 | regs_num = le32_to_cpu(get_unaligned_le32(fw->data)); |
| 345 | 345 | ||
| 346 | v4l2_dbg(3, debug, sd, "FW: %s size %d register sets %d\n", | 346 | v4l2_dbg(3, debug, sd, "FW: %s size %zu register sets %d\n", |
| 347 | S5K4ECGX_FIRMWARE, fw->size, regs_num); | 347 | S5K4ECGX_FIRMWARE, fw->size, regs_num); |
| 348 | 348 | ||
| 349 | regs_num++; /* Add header */ | 349 | regs_num++; /* Add header */ |
diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c index a577614bd84f..d8d5da7c52db 100644 --- a/drivers/media/i2c/smiapp-pll.c +++ b/drivers/media/i2c/smiapp-pll.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
| @@ -58,7 +58,7 @@ static int bounds_check(struct device *dev, uint32_t val, | |||
| 58 | if (val >= min && val <= max) | 58 | if (val >= min && val <= max) |
| 59 | return 0; | 59 | return 0; |
| 60 | 60 | ||
| 61 | dev_warn(dev, "%s out of bounds: %d (%d--%d)\n", str, val, min, max); | 61 | dev_dbg(dev, "%s out of bounds: %d (%d--%d)\n", str, val, min, max); |
| 62 | 62 | ||
| 63 | return -EINVAL; | 63 | return -EINVAL; |
| 64 | } | 64 | } |
| @@ -87,14 +87,14 @@ static void print_pll(struct device *dev, struct smiapp_pll *pll) | |||
| 87 | dev_dbg(dev, "vt_pix_clk_freq_hz \t%d\n", pll->vt_pix_clk_freq_hz); | 87 | dev_dbg(dev, "vt_pix_clk_freq_hz \t%d\n", pll->vt_pix_clk_freq_hz); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | 90 | static int __smiapp_pll_calculate(struct device *dev, |
| 91 | struct smiapp_pll *pll) | 91 | const struct smiapp_pll_limits *limits, |
| 92 | struct smiapp_pll *pll, uint32_t mul, | ||
| 93 | uint32_t div, uint32_t lane_op_clock_ratio) | ||
| 92 | { | 94 | { |
| 93 | uint32_t sys_div; | 95 | uint32_t sys_div; |
| 94 | uint32_t best_pix_div = INT_MAX >> 1; | 96 | uint32_t best_pix_div = INT_MAX >> 1; |
| 95 | uint32_t vt_op_binning_div; | 97 | uint32_t vt_op_binning_div; |
| 96 | uint32_t lane_op_clock_ratio; | ||
| 97 | uint32_t mul, div; | ||
| 98 | uint32_t more_mul_min, more_mul_max; | 98 | uint32_t more_mul_min, more_mul_max; |
| 99 | uint32_t more_mul_factor; | 99 | uint32_t more_mul_factor; |
| 100 | uint32_t min_vt_div, max_vt_div, vt_div; | 100 | uint32_t min_vt_div, max_vt_div, vt_div; |
| @@ -102,54 +102,6 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 102 | unsigned int i; | 102 | unsigned int i; |
| 103 | int rval; | 103 | int rval; |
| 104 | 104 | ||
| 105 | if (pll->flags & SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE) | ||
| 106 | lane_op_clock_ratio = pll->lanes; | ||
| 107 | else | ||
| 108 | lane_op_clock_ratio = 1; | ||
| 109 | dev_dbg(dev, "lane_op_clock_ratio: %d\n", lane_op_clock_ratio); | ||
| 110 | |||
| 111 | dev_dbg(dev, "binning: %dx%d\n", pll->binning_horizontal, | ||
| 112 | pll->binning_vertical); | ||
| 113 | |||
| 114 | /* CSI transfers 2 bits per clock per lane; thus times 2 */ | ||
| 115 | pll->pll_op_clk_freq_hz = pll->link_freq * 2 | ||
| 116 | * (pll->lanes / lane_op_clock_ratio); | ||
| 117 | |||
| 118 | /* Figure out limits for pre-pll divider based on extclk */ | ||
| 119 | dev_dbg(dev, "min / max pre_pll_clk_div: %d / %d\n", | ||
| 120 | limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div); | ||
| 121 | limits->max_pre_pll_clk_div = | ||
| 122 | min_t(uint16_t, limits->max_pre_pll_clk_div, | ||
| 123 | clk_div_even(pll->ext_clk_freq_hz / | ||
| 124 | limits->min_pll_ip_freq_hz)); | ||
| 125 | limits->min_pre_pll_clk_div = | ||
| 126 | max_t(uint16_t, limits->min_pre_pll_clk_div, | ||
| 127 | clk_div_even_up( | ||
| 128 | DIV_ROUND_UP(pll->ext_clk_freq_hz, | ||
| 129 | limits->max_pll_ip_freq_hz))); | ||
| 130 | dev_dbg(dev, "pre-pll check: min / max pre_pll_clk_div: %d / %d\n", | ||
| 131 | limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div); | ||
| 132 | |||
| 133 | i = gcd(pll->pll_op_clk_freq_hz, pll->ext_clk_freq_hz); | ||
| 134 | mul = div_u64(pll->pll_op_clk_freq_hz, i); | ||
| 135 | div = pll->ext_clk_freq_hz / i; | ||
| 136 | dev_dbg(dev, "mul %d / div %d\n", mul, div); | ||
| 137 | |||
| 138 | limits->min_pre_pll_clk_div = | ||
| 139 | max_t(uint16_t, limits->min_pre_pll_clk_div, | ||
| 140 | clk_div_even_up( | ||
| 141 | DIV_ROUND_UP(mul * pll->ext_clk_freq_hz, | ||
| 142 | limits->max_pll_op_freq_hz))); | ||
| 143 | dev_dbg(dev, "pll_op check: min / max pre_pll_clk_div: %d / %d\n", | ||
| 144 | limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div); | ||
| 145 | |||
| 146 | if (limits->min_pre_pll_clk_div > limits->max_pre_pll_clk_div) { | ||
| 147 | dev_err(dev, "unable to compute pre_pll divisor\n"); | ||
| 148 | return -EINVAL; | ||
| 149 | } | ||
| 150 | |||
| 151 | pll->pre_pll_clk_div = limits->min_pre_pll_clk_div; | ||
| 152 | |||
| 153 | /* | 105 | /* |
| 154 | * Get pre_pll_clk_div so that our pll_op_clk_freq_hz won't be | 106 | * Get pre_pll_clk_div so that our pll_op_clk_freq_hz won't be |
| 155 | * too high. | 107 | * too high. |
| @@ -162,7 +114,7 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 162 | more_mul_max); | 114 | more_mul_max); |
| 163 | /* Don't go above max pll op frequency. */ | 115 | /* Don't go above max pll op frequency. */ |
| 164 | more_mul_max = | 116 | more_mul_max = |
| 165 | min_t(int, | 117 | min_t(uint32_t, |
| 166 | more_mul_max, | 118 | more_mul_max, |
| 167 | limits->max_pll_op_freq_hz | 119 | limits->max_pll_op_freq_hz |
| 168 | / (pll->ext_clk_freq_hz / pll->pre_pll_clk_div * mul)); | 120 | / (pll->ext_clk_freq_hz / pll->pre_pll_clk_div * mul)); |
| @@ -170,7 +122,7 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 170 | more_mul_max); | 122 | more_mul_max); |
| 171 | /* Don't go above the division capability of op sys clock divider. */ | 123 | /* Don't go above the division capability of op sys clock divider. */ |
| 172 | more_mul_max = min(more_mul_max, | 124 | more_mul_max = min(more_mul_max, |
| 173 | limits->max_op_sys_clk_div * pll->pre_pll_clk_div | 125 | limits->op.max_sys_clk_div * pll->pre_pll_clk_div |
| 174 | / div); | 126 | / div); |
| 175 | dev_dbg(dev, "more_mul_max: max_op_sys_clk_div check: %d\n", | 127 | dev_dbg(dev, "more_mul_max: max_op_sys_clk_div check: %d\n", |
| 176 | more_mul_max); | 128 | more_mul_max); |
| @@ -193,14 +145,14 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 193 | more_mul_min); | 145 | more_mul_min); |
| 194 | 146 | ||
| 195 | if (more_mul_min > more_mul_max) { | 147 | if (more_mul_min > more_mul_max) { |
| 196 | dev_warn(dev, | 148 | dev_dbg(dev, |
| 197 | "unable to compute more_mul_min and more_mul_max"); | 149 | "unable to compute more_mul_min and more_mul_max\n"); |
| 198 | return -EINVAL; | 150 | return -EINVAL; |
| 199 | } | 151 | } |
| 200 | 152 | ||
| 201 | more_mul_factor = lcm(div, pll->pre_pll_clk_div) / div; | 153 | more_mul_factor = lcm(div, pll->pre_pll_clk_div) / div; |
| 202 | dev_dbg(dev, "more_mul_factor: %d\n", more_mul_factor); | 154 | dev_dbg(dev, "more_mul_factor: %d\n", more_mul_factor); |
| 203 | more_mul_factor = lcm(more_mul_factor, limits->min_op_sys_clk_div); | 155 | more_mul_factor = lcm(more_mul_factor, limits->op.min_sys_clk_div); |
| 204 | dev_dbg(dev, "more_mul_factor: min_op_sys_clk_div: %d\n", | 156 | dev_dbg(dev, "more_mul_factor: min_op_sys_clk_div: %d\n", |
| 205 | more_mul_factor); | 157 | more_mul_factor); |
| 206 | i = roundup(more_mul_min, more_mul_factor); | 158 | i = roundup(more_mul_min, more_mul_factor); |
| @@ -209,7 +161,7 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 209 | 161 | ||
| 210 | dev_dbg(dev, "final more_mul: %d\n", i); | 162 | dev_dbg(dev, "final more_mul: %d\n", i); |
| 211 | if (i > more_mul_max) { | 163 | if (i > more_mul_max) { |
| 212 | dev_warn(dev, "final more_mul is bad, max %d", more_mul_max); | 164 | dev_dbg(dev, "final more_mul is bad, max %d\n", more_mul_max); |
| 213 | return -EINVAL; | 165 | return -EINVAL; |
| 214 | } | 166 | } |
| 215 | 167 | ||
| @@ -268,19 +220,19 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 268 | dev_dbg(dev, "min_vt_div: %d\n", min_vt_div); | 220 | dev_dbg(dev, "min_vt_div: %d\n", min_vt_div); |
| 269 | min_vt_div = max(min_vt_div, | 221 | min_vt_div = max(min_vt_div, |
| 270 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, | 222 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, |
| 271 | limits->max_vt_pix_clk_freq_hz)); | 223 | limits->vt.max_pix_clk_freq_hz)); |
| 272 | dev_dbg(dev, "min_vt_div: max_vt_pix_clk_freq_hz: %d\n", | 224 | dev_dbg(dev, "min_vt_div: max_vt_pix_clk_freq_hz: %d\n", |
| 273 | min_vt_div); | 225 | min_vt_div); |
| 274 | min_vt_div = max_t(uint32_t, min_vt_div, | 226 | min_vt_div = max_t(uint32_t, min_vt_div, |
| 275 | limits->min_vt_pix_clk_div | 227 | limits->vt.min_pix_clk_div |
| 276 | * limits->min_vt_sys_clk_div); | 228 | * limits->vt.min_sys_clk_div); |
| 277 | dev_dbg(dev, "min_vt_div: min_vt_clk_div: %d\n", min_vt_div); | 229 | dev_dbg(dev, "min_vt_div: min_vt_clk_div: %d\n", min_vt_div); |
| 278 | 230 | ||
| 279 | max_vt_div = limits->max_vt_sys_clk_div * limits->max_vt_pix_clk_div; | 231 | max_vt_div = limits->vt.max_sys_clk_div * limits->vt.max_pix_clk_div; |
| 280 | dev_dbg(dev, "max_vt_div: %d\n", max_vt_div); | 232 | dev_dbg(dev, "max_vt_div: %d\n", max_vt_div); |
| 281 | max_vt_div = min(max_vt_div, | 233 | max_vt_div = min(max_vt_div, |
| 282 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, | 234 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, |
| 283 | limits->min_vt_pix_clk_freq_hz)); | 235 | limits->vt.min_pix_clk_freq_hz)); |
| 284 | dev_dbg(dev, "max_vt_div: min_vt_pix_clk_freq_hz: %d\n", | 236 | dev_dbg(dev, "max_vt_div: min_vt_pix_clk_freq_hz: %d\n", |
| 285 | max_vt_div); | 237 | max_vt_div); |
| 286 | 238 | ||
| @@ -288,28 +240,28 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 288 | * Find limitsits for sys_clk_div. Not all values are possible | 240 | * Find limitsits for sys_clk_div. Not all values are possible |
| 289 | * with all values of pix_clk_div. | 241 | * with all values of pix_clk_div. |
| 290 | */ | 242 | */ |
| 291 | min_sys_div = limits->min_vt_sys_clk_div; | 243 | min_sys_div = limits->vt.min_sys_clk_div; |
| 292 | dev_dbg(dev, "min_sys_div: %d\n", min_sys_div); | 244 | dev_dbg(dev, "min_sys_div: %d\n", min_sys_div); |
| 293 | min_sys_div = max(min_sys_div, | 245 | min_sys_div = max(min_sys_div, |
| 294 | DIV_ROUND_UP(min_vt_div, | 246 | DIV_ROUND_UP(min_vt_div, |
| 295 | limits->max_vt_pix_clk_div)); | 247 | limits->vt.max_pix_clk_div)); |
| 296 | dev_dbg(dev, "min_sys_div: max_vt_pix_clk_div: %d\n", min_sys_div); | 248 | dev_dbg(dev, "min_sys_div: max_vt_pix_clk_div: %d\n", min_sys_div); |
| 297 | min_sys_div = max(min_sys_div, | 249 | min_sys_div = max(min_sys_div, |
| 298 | pll->pll_op_clk_freq_hz | 250 | pll->pll_op_clk_freq_hz |
| 299 | / limits->max_vt_sys_clk_freq_hz); | 251 | / limits->vt.max_sys_clk_freq_hz); |
| 300 | dev_dbg(dev, "min_sys_div: max_pll_op_clk_freq_hz: %d\n", min_sys_div); | 252 | dev_dbg(dev, "min_sys_div: max_pll_op_clk_freq_hz: %d\n", min_sys_div); |
| 301 | min_sys_div = clk_div_even_up(min_sys_div); | 253 | min_sys_div = clk_div_even_up(min_sys_div); |
| 302 | dev_dbg(dev, "min_sys_div: one or even: %d\n", min_sys_div); | 254 | dev_dbg(dev, "min_sys_div: one or even: %d\n", min_sys_div); |
| 303 | 255 | ||
| 304 | max_sys_div = limits->max_vt_sys_clk_div; | 256 | max_sys_div = limits->vt.max_sys_clk_div; |
| 305 | dev_dbg(dev, "max_sys_div: %d\n", max_sys_div); | 257 | dev_dbg(dev, "max_sys_div: %d\n", max_sys_div); |
| 306 | max_sys_div = min(max_sys_div, | 258 | max_sys_div = min(max_sys_div, |
| 307 | DIV_ROUND_UP(max_vt_div, | 259 | DIV_ROUND_UP(max_vt_div, |
| 308 | limits->min_vt_pix_clk_div)); | 260 | limits->vt.min_pix_clk_div)); |
| 309 | dev_dbg(dev, "max_sys_div: min_vt_pix_clk_div: %d\n", max_sys_div); | 261 | dev_dbg(dev, "max_sys_div: min_vt_pix_clk_div: %d\n", max_sys_div); |
| 310 | max_sys_div = min(max_sys_div, | 262 | max_sys_div = min(max_sys_div, |
| 311 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, | 263 | DIV_ROUND_UP(pll->pll_op_clk_freq_hz, |
| 312 | limits->min_vt_pix_clk_freq_hz)); | 264 | limits->vt.min_pix_clk_freq_hz)); |
| 313 | dev_dbg(dev, "max_sys_div: min_vt_pix_clk_freq_hz: %d\n", max_sys_div); | 265 | dev_dbg(dev, "max_sys_div: min_vt_pix_clk_freq_hz: %d\n", max_sys_div); |
| 314 | 266 | ||
| 315 | /* | 267 | /* |
| @@ -322,15 +274,15 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 322 | for (sys_div = min_sys_div; | 274 | for (sys_div = min_sys_div; |
| 323 | sys_div <= max_sys_div; | 275 | sys_div <= max_sys_div; |
| 324 | sys_div += 2 - (sys_div & 1)) { | 276 | sys_div += 2 - (sys_div & 1)) { |
| 325 | int pix_div = DIV_ROUND_UP(vt_div, sys_div); | 277 | uint16_t pix_div = DIV_ROUND_UP(vt_div, sys_div); |
| 326 | 278 | ||
| 327 | if (pix_div < limits->min_vt_pix_clk_div | 279 | if (pix_div < limits->vt.min_pix_clk_div |
| 328 | || pix_div > limits->max_vt_pix_clk_div) { | 280 | || pix_div > limits->vt.max_pix_clk_div) { |
| 329 | dev_dbg(dev, | 281 | dev_dbg(dev, |
| 330 | "pix_div %d too small or too big (%d--%d)\n", | 282 | "pix_div %d too small or too big (%d--%d)\n", |
| 331 | pix_div, | 283 | pix_div, |
| 332 | limits->min_vt_pix_clk_div, | 284 | limits->vt.min_pix_clk_div, |
| 333 | limits->max_vt_pix_clk_div); | 285 | limits->vt.max_pix_clk_div); |
| 334 | continue; | 286 | continue; |
| 335 | } | 287 | } |
| 336 | 288 | ||
| @@ -354,16 +306,10 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 354 | pll->pixel_rate_csi = | 306 | pll->pixel_rate_csi = |
| 355 | pll->op_pix_clk_freq_hz * lane_op_clock_ratio; | 307 | pll->op_pix_clk_freq_hz * lane_op_clock_ratio; |
| 356 | 308 | ||
| 357 | print_pll(dev, pll); | 309 | rval = bounds_check(dev, pll->pll_ip_clk_freq_hz, |
| 358 | 310 | limits->min_pll_ip_freq_hz, | |
| 359 | rval = bounds_check(dev, pll->pre_pll_clk_div, | 311 | limits->max_pll_ip_freq_hz, |
| 360 | limits->min_pre_pll_clk_div, | 312 | "pll_ip_clk_freq_hz"); |
| 361 | limits->max_pre_pll_clk_div, "pre_pll_clk_div"); | ||
| 362 | if (!rval) | ||
| 363 | rval = bounds_check( | ||
| 364 | dev, pll->pll_ip_clk_freq_hz, | ||
| 365 | limits->min_pll_ip_freq_hz, limits->max_pll_ip_freq_hz, | ||
| 366 | "pll_ip_clk_freq_hz"); | ||
| 367 | if (!rval) | 313 | if (!rval) |
| 368 | rval = bounds_check( | 314 | rval = bounds_check( |
| 369 | dev, pll->pll_multiplier, | 315 | dev, pll->pll_multiplier, |
| @@ -377,42 +323,121 @@ int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | |||
| 377 | if (!rval) | 323 | if (!rval) |
| 378 | rval = bounds_check( | 324 | rval = bounds_check( |
| 379 | dev, pll->op_sys_clk_div, | 325 | dev, pll->op_sys_clk_div, |
| 380 | limits->min_op_sys_clk_div, limits->max_op_sys_clk_div, | 326 | limits->op.min_sys_clk_div, limits->op.max_sys_clk_div, |
| 381 | "op_sys_clk_div"); | 327 | "op_sys_clk_div"); |
| 382 | if (!rval) | 328 | if (!rval) |
| 383 | rval = bounds_check( | 329 | rval = bounds_check( |
| 384 | dev, pll->op_pix_clk_div, | 330 | dev, pll->op_pix_clk_div, |
| 385 | limits->min_op_pix_clk_div, limits->max_op_pix_clk_div, | 331 | limits->op.min_pix_clk_div, limits->op.max_pix_clk_div, |
| 386 | "op_pix_clk_div"); | 332 | "op_pix_clk_div"); |
| 387 | if (!rval) | 333 | if (!rval) |
| 388 | rval = bounds_check( | 334 | rval = bounds_check( |
| 389 | dev, pll->op_sys_clk_freq_hz, | 335 | dev, pll->op_sys_clk_freq_hz, |
| 390 | limits->min_op_sys_clk_freq_hz, | 336 | limits->op.min_sys_clk_freq_hz, |
| 391 | limits->max_op_sys_clk_freq_hz, | 337 | limits->op.max_sys_clk_freq_hz, |
| 392 | "op_sys_clk_freq_hz"); | 338 | "op_sys_clk_freq_hz"); |
| 393 | if (!rval) | 339 | if (!rval) |
| 394 | rval = bounds_check( | 340 | rval = bounds_check( |
| 395 | dev, pll->op_pix_clk_freq_hz, | 341 | dev, pll->op_pix_clk_freq_hz, |
| 396 | limits->min_op_pix_clk_freq_hz, | 342 | limits->op.min_pix_clk_freq_hz, |
| 397 | limits->max_op_pix_clk_freq_hz, | 343 | limits->op.max_pix_clk_freq_hz, |
| 398 | "op_pix_clk_freq_hz"); | 344 | "op_pix_clk_freq_hz"); |
| 399 | if (!rval) | 345 | if (!rval) |
| 400 | rval = bounds_check( | 346 | rval = bounds_check( |
| 401 | dev, pll->vt_sys_clk_freq_hz, | 347 | dev, pll->vt_sys_clk_freq_hz, |
| 402 | limits->min_vt_sys_clk_freq_hz, | 348 | limits->vt.min_sys_clk_freq_hz, |
| 403 | limits->max_vt_sys_clk_freq_hz, | 349 | limits->vt.max_sys_clk_freq_hz, |
| 404 | "vt_sys_clk_freq_hz"); | 350 | "vt_sys_clk_freq_hz"); |
| 405 | if (!rval) | 351 | if (!rval) |
| 406 | rval = bounds_check( | 352 | rval = bounds_check( |
| 407 | dev, pll->vt_pix_clk_freq_hz, | 353 | dev, pll->vt_pix_clk_freq_hz, |
| 408 | limits->min_vt_pix_clk_freq_hz, | 354 | limits->vt.min_pix_clk_freq_hz, |
| 409 | limits->max_vt_pix_clk_freq_hz, | 355 | limits->vt.max_pix_clk_freq_hz, |
| 410 | "vt_pix_clk_freq_hz"); | 356 | "vt_pix_clk_freq_hz"); |
| 411 | 357 | ||
| 412 | return rval; | 358 | return rval; |
| 413 | } | 359 | } |
| 360 | |||
| 361 | int smiapp_pll_calculate(struct device *dev, | ||
| 362 | const struct smiapp_pll_limits *limits, | ||
| 363 | struct smiapp_pll *pll) | ||
| 364 | { | ||
| 365 | uint16_t min_pre_pll_clk_div; | ||
| 366 | uint16_t max_pre_pll_clk_div; | ||
| 367 | uint32_t lane_op_clock_ratio; | ||
| 368 | uint32_t mul, div; | ||
| 369 | unsigned int i; | ||
| 370 | int rval = -EINVAL; | ||
| 371 | |||
| 372 | if (pll->flags & SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE) | ||
| 373 | lane_op_clock_ratio = pll->csi2.lanes; | ||
| 374 | else | ||
| 375 | lane_op_clock_ratio = 1; | ||
| 376 | dev_dbg(dev, "lane_op_clock_ratio: %d\n", lane_op_clock_ratio); | ||
| 377 | |||
| 378 | dev_dbg(dev, "binning: %dx%d\n", pll->binning_horizontal, | ||
| 379 | pll->binning_vertical); | ||
| 380 | |||
| 381 | switch (pll->bus_type) { | ||
| 382 | case SMIAPP_PLL_BUS_TYPE_CSI2: | ||
| 383 | /* CSI transfers 2 bits per clock per lane; thus times 2 */ | ||
| 384 | pll->pll_op_clk_freq_hz = pll->link_freq * 2 | ||
| 385 | * (pll->csi2.lanes / lane_op_clock_ratio); | ||
| 386 | break; | ||
| 387 | case SMIAPP_PLL_BUS_TYPE_PARALLEL: | ||
| 388 | pll->pll_op_clk_freq_hz = pll->link_freq * pll->bits_per_pixel | ||
| 389 | / DIV_ROUND_UP(pll->bits_per_pixel, | ||
| 390 | pll->parallel.bus_width); | ||
| 391 | break; | ||
| 392 | default: | ||
| 393 | return -EINVAL; | ||
| 394 | } | ||
| 395 | |||
| 396 | /* Figure out limits for pre-pll divider based on extclk */ | ||
| 397 | dev_dbg(dev, "min / max pre_pll_clk_div: %d / %d\n", | ||
| 398 | limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div); | ||
| 399 | max_pre_pll_clk_div = | ||
| 400 | min_t(uint16_t, limits->max_pre_pll_clk_div, | ||
| 401 | clk_div_even(pll->ext_clk_freq_hz / | ||
| 402 | limits->min_pll_ip_freq_hz)); | ||
| 403 | min_pre_pll_clk_div = | ||
| 404 | max_t(uint16_t, limits->min_pre_pll_clk_div, | ||
| 405 | clk_div_even_up( | ||
| 406 | DIV_ROUND_UP(pll->ext_clk_freq_hz, | ||
| 407 | limits->max_pll_ip_freq_hz))); | ||
| 408 | dev_dbg(dev, "pre-pll check: min / max pre_pll_clk_div: %d / %d\n", | ||
| 409 | min_pre_pll_clk_div, max_pre_pll_clk_div); | ||
| 410 | |||
| 411 | i = gcd(pll->pll_op_clk_freq_hz, pll->ext_clk_freq_hz); | ||
| 412 | mul = div_u64(pll->pll_op_clk_freq_hz, i); | ||
| 413 | div = pll->ext_clk_freq_hz / i; | ||
| 414 | dev_dbg(dev, "mul %d / div %d\n", mul, div); | ||
| 415 | |||
| 416 | min_pre_pll_clk_div = | ||
| 417 | max_t(uint16_t, min_pre_pll_clk_div, | ||
| 418 | clk_div_even_up( | ||
| 419 | DIV_ROUND_UP(mul * pll->ext_clk_freq_hz, | ||
| 420 | limits->max_pll_op_freq_hz))); | ||
| 421 | dev_dbg(dev, "pll_op check: min / max pre_pll_clk_div: %d / %d\n", | ||
| 422 | min_pre_pll_clk_div, max_pre_pll_clk_div); | ||
| 423 | |||
| 424 | for (pll->pre_pll_clk_div = min_pre_pll_clk_div; | ||
| 425 | pll->pre_pll_clk_div <= max_pre_pll_clk_div; | ||
| 426 | pll->pre_pll_clk_div += 2 - (pll->pre_pll_clk_div & 1)) { | ||
| 427 | rval = __smiapp_pll_calculate(dev, limits, pll, mul, div, | ||
| 428 | lane_op_clock_ratio); | ||
| 429 | if (rval) | ||
| 430 | continue; | ||
| 431 | |||
| 432 | print_pll(dev, pll); | ||
| 433 | return 0; | ||
| 434 | } | ||
| 435 | |||
| 436 | dev_info(dev, "unable to compute pre_pll divisor\n"); | ||
| 437 | return rval; | ||
| 438 | } | ||
| 414 | EXPORT_SYMBOL_GPL(smiapp_pll_calculate); | 439 | EXPORT_SYMBOL_GPL(smiapp_pll_calculate); |
| 415 | 440 | ||
| 416 | MODULE_AUTHOR("Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>"); | 441 | MODULE_AUTHOR("Sakari Ailus <sakari.ailus@iki.fi>"); |
| 417 | MODULE_DESCRIPTION("Generic SMIA/SMIA++ PLL calculator"); | 442 | MODULE_DESCRIPTION("Generic SMIA/SMIA++ PLL calculator"); |
| 418 | MODULE_LICENSE("GPL"); | 443 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/i2c/smiapp-pll.h b/drivers/media/i2c/smiapp-pll.h index cb2d2db5d02d..a4a649834a18 100644 --- a/drivers/media/i2c/smiapp-pll.h +++ b/drivers/media/i2c/smiapp-pll.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2012 Nokia Corporation | 6 | * Copyright (C) 2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
| @@ -27,16 +27,34 @@ | |||
| 27 | 27 | ||
| 28 | #include <linux/device.h> | 28 | #include <linux/device.h> |
| 29 | 29 | ||
| 30 | /* CSI-2 or CCP-2 */ | ||
| 31 | #define SMIAPP_PLL_BUS_TYPE_CSI2 0x00 | ||
| 32 | #define SMIAPP_PLL_BUS_TYPE_PARALLEL 0x01 | ||
| 33 | |||
| 34 | /* op pix clock is for all lanes in total normally */ | ||
| 35 | #define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0) | ||
| 36 | #define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1) | ||
| 37 | |||
| 30 | struct smiapp_pll { | 38 | struct smiapp_pll { |
| 31 | uint8_t lanes; | 39 | /* input values */ |
| 40 | uint8_t bus_type; | ||
| 41 | union { | ||
| 42 | struct { | ||
| 43 | uint8_t lanes; | ||
| 44 | } csi2; | ||
| 45 | struct { | ||
| 46 | uint8_t bus_width; | ||
| 47 | } parallel; | ||
| 48 | }; | ||
| 49 | uint8_t flags; | ||
| 32 | uint8_t binning_horizontal; | 50 | uint8_t binning_horizontal; |
| 33 | uint8_t binning_vertical; | 51 | uint8_t binning_vertical; |
| 34 | uint8_t scale_m; | 52 | uint8_t scale_m; |
| 35 | uint8_t scale_n; | 53 | uint8_t scale_n; |
| 36 | uint8_t bits_per_pixel; | 54 | uint8_t bits_per_pixel; |
| 37 | uint16_t flags; | ||
| 38 | uint32_t link_freq; | 55 | uint32_t link_freq; |
| 39 | 56 | ||
| 57 | /* output values */ | ||
| 40 | uint16_t pre_pll_clk_div; | 58 | uint16_t pre_pll_clk_div; |
| 41 | uint16_t pll_multiplier; | 59 | uint16_t pll_multiplier; |
| 42 | uint16_t op_sys_clk_div; | 60 | uint16_t op_sys_clk_div; |
| @@ -55,6 +73,17 @@ struct smiapp_pll { | |||
| 55 | uint32_t pixel_rate_csi; | 73 | uint32_t pixel_rate_csi; |
| 56 | }; | 74 | }; |
| 57 | 75 | ||
| 76 | struct smiapp_pll_branch_limits { | ||
| 77 | uint16_t min_sys_clk_div; | ||
| 78 | uint16_t max_sys_clk_div; | ||
| 79 | uint32_t min_sys_clk_freq_hz; | ||
| 80 | uint32_t max_sys_clk_freq_hz; | ||
| 81 | uint16_t min_pix_clk_div; | ||
| 82 | uint16_t max_pix_clk_div; | ||
| 83 | uint32_t min_pix_clk_freq_hz; | ||
| 84 | uint32_t max_pix_clk_freq_hz; | ||
| 85 | }; | ||
| 86 | |||
| 58 | struct smiapp_pll_limits { | 87 | struct smiapp_pll_limits { |
| 59 | /* Strict PLL limits */ | 88 | /* Strict PLL limits */ |
| 60 | uint32_t min_ext_clk_freq_hz; | 89 | uint32_t min_ext_clk_freq_hz; |
| @@ -68,36 +97,18 @@ struct smiapp_pll_limits { | |||
| 68 | uint32_t min_pll_op_freq_hz; | 97 | uint32_t min_pll_op_freq_hz; |
| 69 | uint32_t max_pll_op_freq_hz; | 98 | uint32_t max_pll_op_freq_hz; |
| 70 | 99 | ||
| 71 | uint16_t min_vt_sys_clk_div; | 100 | struct smiapp_pll_branch_limits vt; |
| 72 | uint16_t max_vt_sys_clk_div; | 101 | struct smiapp_pll_branch_limits op; |
| 73 | uint32_t min_vt_sys_clk_freq_hz; | ||
| 74 | uint32_t max_vt_sys_clk_freq_hz; | ||
| 75 | uint16_t min_vt_pix_clk_div; | ||
| 76 | uint16_t max_vt_pix_clk_div; | ||
| 77 | uint32_t min_vt_pix_clk_freq_hz; | ||
| 78 | uint32_t max_vt_pix_clk_freq_hz; | ||
| 79 | |||
| 80 | uint16_t min_op_sys_clk_div; | ||
| 81 | uint16_t max_op_sys_clk_div; | ||
| 82 | uint32_t min_op_sys_clk_freq_hz; | ||
| 83 | uint32_t max_op_sys_clk_freq_hz; | ||
| 84 | uint16_t min_op_pix_clk_div; | ||
| 85 | uint16_t max_op_pix_clk_div; | ||
| 86 | uint32_t min_op_pix_clk_freq_hz; | ||
| 87 | uint32_t max_op_pix_clk_freq_hz; | ||
| 88 | 102 | ||
| 89 | /* Other relevant limits */ | 103 | /* Other relevant limits */ |
| 90 | uint32_t min_line_length_pck_bin; | 104 | uint32_t min_line_length_pck_bin; |
| 91 | uint32_t min_line_length_pck; | 105 | uint32_t min_line_length_pck; |
| 92 | }; | 106 | }; |
| 93 | 107 | ||
| 94 | /* op pix clock is for all lanes in total normally */ | ||
| 95 | #define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0) | ||
| 96 | #define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1) | ||
| 97 | |||
| 98 | struct device; | 108 | struct device; |
| 99 | 109 | ||
| 100 | int smiapp_pll_calculate(struct device *dev, struct smiapp_pll_limits *limits, | 110 | int smiapp_pll_calculate(struct device *dev, |
| 111 | const struct smiapp_pll_limits *limits, | ||
| 101 | struct smiapp_pll *pll); | 112 | struct smiapp_pll *pll); |
| 102 | 113 | ||
| 103 | #endif /* SMIAPP_PLL_H */ | 114 | #endif /* SMIAPP_PLL_H */ |
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index e08e588ad24b..83c7ed7ffcc2 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2010--2012 Nokia Corporation | 6 | * Copyright (C) 2010--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * Based on smiapp driver by Vimarsh Zutshi | 9 | * Based on smiapp driver by Vimarsh Zutshi |
| 10 | * Based on jt8ev1.c by Vimarsh Zutshi | 10 | * Based on jt8ev1.c by Vimarsh Zutshi |
| @@ -252,23 +252,23 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor) | |||
| 252 | .min_pll_op_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_PLL_OP_FREQ_HZ], | 252 | .min_pll_op_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_PLL_OP_FREQ_HZ], |
| 253 | .max_pll_op_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_PLL_OP_FREQ_HZ], | 253 | .max_pll_op_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_PLL_OP_FREQ_HZ], |
| 254 | 254 | ||
| 255 | .min_op_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_OP_SYS_CLK_DIV], | 255 | .op.min_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_OP_SYS_CLK_DIV], |
| 256 | .max_op_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_OP_SYS_CLK_DIV], | 256 | .op.max_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_OP_SYS_CLK_DIV], |
| 257 | .min_op_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_OP_PIX_CLK_DIV], | 257 | .op.min_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_OP_PIX_CLK_DIV], |
| 258 | .max_op_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_OP_PIX_CLK_DIV], | 258 | .op.max_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_OP_PIX_CLK_DIV], |
| 259 | .min_op_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_OP_SYS_CLK_FREQ_HZ], | 259 | .op.min_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_OP_SYS_CLK_FREQ_HZ], |
| 260 | .max_op_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_OP_SYS_CLK_FREQ_HZ], | 260 | .op.max_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_OP_SYS_CLK_FREQ_HZ], |
| 261 | .min_op_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_OP_PIX_CLK_FREQ_HZ], | 261 | .op.min_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_OP_PIX_CLK_FREQ_HZ], |
| 262 | .max_op_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_OP_PIX_CLK_FREQ_HZ], | 262 | .op.max_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_OP_PIX_CLK_FREQ_HZ], |
| 263 | 263 | ||
| 264 | .min_vt_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_VT_SYS_CLK_DIV], | 264 | .vt.min_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_VT_SYS_CLK_DIV], |
| 265 | .max_vt_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_VT_SYS_CLK_DIV], | 265 | .vt.max_sys_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_VT_SYS_CLK_DIV], |
| 266 | .min_vt_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_VT_PIX_CLK_DIV], | 266 | .vt.min_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MIN_VT_PIX_CLK_DIV], |
| 267 | .max_vt_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_VT_PIX_CLK_DIV], | 267 | .vt.max_pix_clk_div = sensor->limits[SMIAPP_LIMIT_MAX_VT_PIX_CLK_DIV], |
| 268 | .min_vt_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_VT_SYS_CLK_FREQ_HZ], | 268 | .vt.min_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_VT_SYS_CLK_FREQ_HZ], |
| 269 | .max_vt_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_VT_SYS_CLK_FREQ_HZ], | 269 | .vt.max_sys_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_VT_SYS_CLK_FREQ_HZ], |
| 270 | .min_vt_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_VT_PIX_CLK_FREQ_HZ], | 270 | .vt.min_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MIN_VT_PIX_CLK_FREQ_HZ], |
| 271 | .max_vt_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_VT_PIX_CLK_FREQ_HZ], | 271 | .vt.max_pix_clk_freq_hz = sensor->limits[SMIAPP_LIMIT_MAX_VT_PIX_CLK_FREQ_HZ], |
| 272 | 272 | ||
| 273 | .min_line_length_pck_bin = sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN], | 273 | .min_line_length_pck_bin = sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN], |
| 274 | .min_line_length_pck = sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK], | 274 | .min_line_length_pck = sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK], |
| @@ -276,11 +276,6 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor) | |||
| 276 | struct smiapp_pll *pll = &sensor->pll; | 276 | struct smiapp_pll *pll = &sensor->pll; |
| 277 | int rval; | 277 | int rval; |
| 278 | 278 | ||
| 279 | memset(&sensor->pll, 0, sizeof(sensor->pll)); | ||
| 280 | |||
| 281 | pll->lanes = sensor->platform_data->lanes; | ||
| 282 | pll->ext_clk_freq_hz = sensor->platform_data->ext_clk; | ||
| 283 | |||
| 284 | if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) { | 279 | if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) { |
| 285 | /* | 280 | /* |
| 286 | * Fill in operational clock divisors limits from the | 281 | * Fill in operational clock divisors limits from the |
| @@ -288,28 +283,14 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor) | |||
| 288 | * requirements regarding them are essentially the | 283 | * requirements regarding them are essentially the |
| 289 | * same as on VT ones. | 284 | * same as on VT ones. |
| 290 | */ | 285 | */ |
| 291 | lim.min_op_sys_clk_div = lim.min_vt_sys_clk_div; | 286 | lim.op = lim.vt; |
| 292 | lim.max_op_sys_clk_div = lim.max_vt_sys_clk_div; | ||
| 293 | lim.min_op_pix_clk_div = lim.min_vt_pix_clk_div; | ||
| 294 | lim.max_op_pix_clk_div = lim.max_vt_pix_clk_div; | ||
| 295 | lim.min_op_sys_clk_freq_hz = lim.min_vt_sys_clk_freq_hz; | ||
| 296 | lim.max_op_sys_clk_freq_hz = lim.max_vt_sys_clk_freq_hz; | ||
| 297 | lim.min_op_pix_clk_freq_hz = lim.min_vt_pix_clk_freq_hz; | ||
| 298 | lim.max_op_pix_clk_freq_hz = lim.max_vt_pix_clk_freq_hz; | ||
| 299 | /* Profile 0 sensors have no separate OP clock branch. */ | ||
| 300 | pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS; | ||
| 301 | } | 287 | } |
| 302 | 288 | ||
| 303 | if (smiapp_needs_quirk(sensor, | ||
| 304 | SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE)) | ||
| 305 | pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE; | ||
| 306 | |||
| 307 | pll->binning_horizontal = sensor->binning_horizontal; | 289 | pll->binning_horizontal = sensor->binning_horizontal; |
| 308 | pll->binning_vertical = sensor->binning_vertical; | 290 | pll->binning_vertical = sensor->binning_vertical; |
| 309 | pll->link_freq = | 291 | pll->link_freq = |
| 310 | sensor->link_freq->qmenu_int[sensor->link_freq->val]; | 292 | sensor->link_freq->qmenu_int[sensor->link_freq->val]; |
| 311 | pll->scale_m = sensor->scale_m; | 293 | pll->scale_m = sensor->scale_m; |
| 312 | pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]; | ||
| 313 | pll->bits_per_pixel = sensor->csi_format->compressed; | 294 | pll->bits_per_pixel = sensor->csi_format->compressed; |
| 314 | 295 | ||
| 315 | rval = smiapp_pll_calculate(&client->dev, &lim, pll); | 296 | rval = smiapp_pll_calculate(&client->dev, &lim, pll); |
| @@ -1010,7 +991,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) | |||
| 1010 | * do not change, or if you do at least know what you're | 991 | * do not change, or if you do at least know what you're |
| 1011 | * doing. :-) | 992 | * doing. :-) |
| 1012 | * | 993 | * |
| 1013 | * Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 2010-10-25 | 994 | * Sakari Ailus <sakari.ailus@iki.fi> 2010-10-25 |
| 1014 | * | 995 | * |
| 1015 | * flash_strobe_length [us] / 10^6 = (tFlash_strobe_width_ctrl | 996 | * flash_strobe_length [us] / 10^6 = (tFlash_strobe_width_ctrl |
| 1016 | * / EXTCLK freq [Hz]) * flash_strobe_adjustment | 997 | * / EXTCLK freq [Hz]) * flash_strobe_adjustment |
| @@ -2369,6 +2350,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
| 2369 | { | 2350 | { |
| 2370 | struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); | 2351 | struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); |
| 2371 | struct i2c_client *client = v4l2_get_subdevdata(subdev); | 2352 | struct i2c_client *client = v4l2_get_subdevdata(subdev); |
| 2353 | struct smiapp_pll *pll = &sensor->pll; | ||
| 2372 | struct smiapp_subdev *last = NULL; | 2354 | struct smiapp_subdev *last = NULL; |
| 2373 | u32 tmp; | 2355 | u32 tmp; |
| 2374 | unsigned int i; | 2356 | unsigned int i; |
| @@ -2635,6 +2617,18 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
| 2635 | if (rval < 0) | 2617 | if (rval < 0) |
| 2636 | goto out_nvm_release; | 2618 | goto out_nvm_release; |
| 2637 | 2619 | ||
| 2620 | /* prepare PLL configuration input values */ | ||
| 2621 | pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2; | ||
| 2622 | pll->csi2.lanes = sensor->platform_data->lanes; | ||
| 2623 | pll->ext_clk_freq_hz = sensor->platform_data->ext_clk; | ||
| 2624 | /* Profile 0 sensors have no separate OP clock branch. */ | ||
| 2625 | if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) | ||
| 2626 | pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS; | ||
| 2627 | if (smiapp_needs_quirk(sensor, | ||
| 2628 | SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE)) | ||
| 2629 | pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE; | ||
| 2630 | pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]; | ||
| 2631 | |||
| 2638 | rval = smiapp_update_mode(sensor); | 2632 | rval = smiapp_update_mode(sensor); |
| 2639 | if (rval) { | 2633 | if (rval) { |
| 2640 | dev_err(&client->dev, "update mode failed\n"); | 2634 | dev_err(&client->dev, "update mode failed\n"); |
| @@ -2893,6 +2887,6 @@ static struct i2c_driver smiapp_i2c_driver = { | |||
| 2893 | 2887 | ||
| 2894 | module_i2c_driver(smiapp_i2c_driver); | 2888 | module_i2c_driver(smiapp_i2c_driver); |
| 2895 | 2889 | ||
| 2896 | MODULE_AUTHOR("Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>"); | 2890 | MODULE_AUTHOR("Sakari Ailus <sakari.ailus@iki.fi>"); |
| 2897 | MODULE_DESCRIPTION("Generic SMIA/SMIA++ camera module driver"); | 2891 | MODULE_DESCRIPTION("Generic SMIA/SMIA++ camera module driver"); |
| 2898 | MODULE_LICENSE("GPL"); | 2892 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/i2c/smiapp/smiapp-limits.c b/drivers/media/i2c/smiapp/smiapp-limits.c index fb2f81ad8c3b..847cb235e198 100644 --- a/drivers/media/i2c/smiapp/smiapp-limits.c +++ b/drivers/media/i2c/smiapp/smiapp-limits.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-limits.h b/drivers/media/i2c/smiapp/smiapp-limits.h index 9ae765e23ea5..343e9c3827fc 100644 --- a/drivers/media/i2c/smiapp/smiapp-limits.h +++ b/drivers/media/i2c/smiapp/smiapp-limits.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.c b/drivers/media/i2c/smiapp/smiapp-quirk.c index 725cf62836c6..bb8c506e0e3d 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.c +++ b/drivers/media/i2c/smiapp/smiapp-quirk.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h index 86fd3e8bfb0f..504a6d80ced5 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.h +++ b/drivers/media/i2c/smiapp/smiapp-quirk.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-reg-defs.h b/drivers/media/i2c/smiapp/smiapp-reg-defs.h index defa7c5adebf..3aa0ca948d87 100644 --- a/drivers/media/i2c/smiapp/smiapp-reg-defs.h +++ b/drivers/media/i2c/smiapp/smiapp-reg-defs.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-reg.h b/drivers/media/i2c/smiapp/smiapp-reg.h index 54568ca2fe6d..b0dcbb8fa5e2 100644 --- a/drivers/media/i2c/smiapp/smiapp-reg.h +++ b/drivers/media/i2c/smiapp/smiapp-reg.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c b/drivers/media/i2c/smiapp/smiapp-regs.c index 70e0d8db0130..4fac32cfcb3f 100644 --- a/drivers/media/i2c/smiapp/smiapp-regs.c +++ b/drivers/media/i2c/smiapp/smiapp-regs.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp-regs.h b/drivers/media/i2c/smiapp/smiapp-regs.h index 7f9013b47971..eefc6c84d5fe 100644 --- a/drivers/media/i2c/smiapp/smiapp-regs.h +++ b/drivers/media/i2c/smiapp/smiapp-regs.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011--2012 Nokia Corporation | 6 | * Copyright (C) 2011--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h index 4182a695ab53..7cc5aae662fd 100644 --- a/drivers/media/i2c/smiapp/smiapp.h +++ b/drivers/media/i2c/smiapp/smiapp.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Generic driver for SMIA/SMIA++ compliant camera modules | 4 | * Generic driver for SMIA/SMIA++ compliant camera modules |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2010--2012 Nokia Corporation | 6 | * Copyright (C) 2010--2012 Nokia Corporation |
| 7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 7 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index 13057b966ee9..d40a8858be01 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/log2.h> | 15 | #include <linux/log2.h> |
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | 17 | ||
| 18 | #include <media/mt9v022.h> | ||
| 18 | #include <media/soc_camera.h> | 19 | #include <media/soc_camera.h> |
| 19 | #include <media/soc_mediabus.h> | 20 | #include <media/soc_mediabus.h> |
| 20 | #include <media/v4l2-subdev.h> | 21 | #include <media/v4l2-subdev.h> |
| @@ -50,6 +51,7 @@ MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\""); | |||
| 50 | #define MT9V022_PIXEL_OPERATION_MODE 0x0f | 51 | #define MT9V022_PIXEL_OPERATION_MODE 0x0f |
| 51 | #define MT9V022_LED_OUT_CONTROL 0x1b | 52 | #define MT9V022_LED_OUT_CONTROL 0x1b |
| 52 | #define MT9V022_ADC_MODE_CONTROL 0x1c | 53 | #define MT9V022_ADC_MODE_CONTROL 0x1c |
| 54 | #define MT9V022_REG32 0x20 | ||
| 53 | #define MT9V022_ANALOG_GAIN 0x35 | 55 | #define MT9V022_ANALOG_GAIN 0x35 |
| 54 | #define MT9V022_BLACK_LEVEL_CALIB_CTRL 0x47 | 56 | #define MT9V022_BLACK_LEVEL_CALIB_CTRL 0x47 |
| 55 | #define MT9V022_PIXCLK_FV_LV 0x74 | 57 | #define MT9V022_PIXCLK_FV_LV 0x74 |
| @@ -71,7 +73,15 @@ MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\""); | |||
| 71 | #define MT9V022_COLUMN_SKIP 1 | 73 | #define MT9V022_COLUMN_SKIP 1 |
| 72 | #define MT9V022_ROW_SKIP 4 | 74 | #define MT9V022_ROW_SKIP 4 |
| 73 | 75 | ||
| 74 | #define is_mt9v024(id) (id == 0x1324) | 76 | #define MT9V022_HORIZONTAL_BLANKING_MIN 43 |
| 77 | #define MT9V022_HORIZONTAL_BLANKING_MAX 1023 | ||
| 78 | #define MT9V022_HORIZONTAL_BLANKING_DEF 94 | ||
| 79 | #define MT9V022_VERTICAL_BLANKING_MIN 2 | ||
| 80 | #define MT9V022_VERTICAL_BLANKING_MAX 3000 | ||
| 81 | #define MT9V022_VERTICAL_BLANKING_DEF 45 | ||
| 82 | |||
| 83 | #define is_mt9v022_rev3(id) (id == 0x1313) | ||
| 84 | #define is_mt9v024(id) (id == 0x1324) | ||
| 75 | 85 | ||
| 76 | /* MT9V022 has only one fixed colorspace per pixelcode */ | 86 | /* MT9V022 has only one fixed colorspace per pixelcode */ |
| 77 | struct mt9v022_datafmt { | 87 | struct mt9v022_datafmt { |
| @@ -136,6 +146,8 @@ struct mt9v022 { | |||
| 136 | struct v4l2_ctrl *autogain; | 146 | struct v4l2_ctrl *autogain; |
| 137 | struct v4l2_ctrl *gain; | 147 | struct v4l2_ctrl *gain; |
| 138 | }; | 148 | }; |
| 149 | struct v4l2_ctrl *hblank; | ||
| 150 | struct v4l2_ctrl *vblank; | ||
| 139 | struct v4l2_rect rect; /* Sensor window */ | 151 | struct v4l2_rect rect; /* Sensor window */ |
| 140 | const struct mt9v022_datafmt *fmt; | 152 | const struct mt9v022_datafmt *fmt; |
| 141 | const struct mt9v022_datafmt *fmts; | 153 | const struct mt9v022_datafmt *fmts; |
| @@ -143,6 +155,7 @@ struct mt9v022 { | |||
| 143 | int num_fmts; | 155 | int num_fmts; |
| 144 | int model; /* V4L2_IDENT_MT9V022* codes from v4l2-chip-ident.h */ | 156 | int model; /* V4L2_IDENT_MT9V022* codes from v4l2-chip-ident.h */ |
| 145 | u16 chip_control; | 157 | u16 chip_control; |
| 158 | u16 chip_version; | ||
| 146 | unsigned short y_skip_top; /* Lines to skip at the top */ | 159 | unsigned short y_skip_top; /* Lines to skip at the top */ |
| 147 | }; | 160 | }; |
| 148 | 161 | ||
| @@ -225,12 +238,32 @@ static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable) | |||
| 225 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 238 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 226 | struct mt9v022 *mt9v022 = to_mt9v022(client); | 239 | struct mt9v022 *mt9v022 = to_mt9v022(client); |
| 227 | 240 | ||
| 228 | if (enable) | 241 | if (enable) { |
| 229 | /* Switch to master "normal" mode */ | 242 | /* Switch to master "normal" mode */ |
| 230 | mt9v022->chip_control &= ~0x10; | 243 | mt9v022->chip_control &= ~0x10; |
| 231 | else | 244 | if (is_mt9v022_rev3(mt9v022->chip_version) || |
| 245 | is_mt9v024(mt9v022->chip_version)) { | ||
| 246 | /* | ||
| 247 | * Unset snapshot mode specific settings: clear bit 9 | ||
| 248 | * and bit 2 in reg. 0x20 when in normal mode. | ||
| 249 | */ | ||
| 250 | if (reg_clear(client, MT9V022_REG32, 0x204)) | ||
| 251 | return -EIO; | ||
| 252 | } | ||
| 253 | } else { | ||
| 232 | /* Switch to snapshot mode */ | 254 | /* Switch to snapshot mode */ |
| 233 | mt9v022->chip_control |= 0x10; | 255 | mt9v022->chip_control |= 0x10; |
| 256 | if (is_mt9v022_rev3(mt9v022->chip_version) || | ||
| 257 | is_mt9v024(mt9v022->chip_version)) { | ||
| 258 | /* | ||
| 259 | * Required settings for snapshot mode: set bit 9 | ||
| 260 | * (RST enable) and bit 2 (CR enable) in reg. 0x20 | ||
| 261 | * See TechNote TN0960 or TN-09-225. | ||
| 262 | */ | ||
| 263 | if (reg_set(client, MT9V022_REG32, 0x204)) | ||
| 264 | return -EIO; | ||
| 265 | } | ||
| 266 | } | ||
| 234 | 267 | ||
| 235 | if (reg_write(client, MT9V022_CHIP_CONTROL, mt9v022->chip_control) < 0) | 268 | if (reg_write(client, MT9V022_CHIP_CONTROL, mt9v022->chip_control) < 0) |
| 236 | return -EIO; | 269 | return -EIO; |
| @@ -263,9 +296,14 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) | |||
| 263 | if (ret & 1) /* Autoexposure */ | 296 | if (ret & 1) /* Autoexposure */ |
| 264 | ret = reg_write(client, mt9v022->reg->max_total_shutter_width, | 297 | ret = reg_write(client, mt9v022->reg->max_total_shutter_width, |
| 265 | rect.height + mt9v022->y_skip_top + 43); | 298 | rect.height + mt9v022->y_skip_top + 43); |
| 266 | else | 299 | /* |
| 267 | ret = reg_write(client, MT9V022_TOTAL_SHUTTER_WIDTH, | 300 | * If autoexposure is off, there is no need to set |
| 268 | rect.height + mt9v022->y_skip_top + 43); | 301 | * MT9V022_TOTAL_SHUTTER_WIDTH here. Autoexposure can be off |
| 302 | * only if the user has set exposure manually, using the | ||
| 303 | * V4L2_CID_EXPOSURE_AUTO with the value V4L2_EXPOSURE_MANUAL. | ||
| 304 | * In this case the register MT9V022_TOTAL_SHUTTER_WIDTH | ||
| 305 | * already contains the correct value. | ||
| 306 | */ | ||
| 269 | } | 307 | } |
| 270 | /* Setup frame format: defaults apart from width and height */ | 308 | /* Setup frame format: defaults apart from width and height */ |
| 271 | if (!ret) | 309 | if (!ret) |
| @@ -277,11 +315,10 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) | |||
| 277 | * Default 94, Phytec driver says: | 315 | * Default 94, Phytec driver says: |
| 278 | * "width + horizontal blank >= 660" | 316 | * "width + horizontal blank >= 660" |
| 279 | */ | 317 | */ |
| 280 | ret = reg_write(client, MT9V022_HORIZONTAL_BLANKING, | 318 | ret = v4l2_ctrl_s_ctrl(mt9v022->hblank, |
| 281 | rect.width > 660 - 43 ? 43 : | 319 | rect.width > 660 - 43 ? 43 : 660 - rect.width); |
| 282 | 660 - rect.width); | ||
| 283 | if (!ret) | 320 | if (!ret) |
| 284 | ret = reg_write(client, MT9V022_VERTICAL_BLANKING, 45); | 321 | ret = v4l2_ctrl_s_ctrl(mt9v022->vblank, 45); |
| 285 | if (!ret) | 322 | if (!ret) |
| 286 | ret = reg_write(client, MT9V022_WINDOW_WIDTH, rect.width); | 323 | ret = reg_write(client, MT9V022_WINDOW_WIDTH, rect.width); |
| 287 | if (!ret) | 324 | if (!ret) |
| @@ -504,6 +541,18 @@ static int mt9v022_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
| 504 | range = exp->maximum - exp->minimum; | 541 | range = exp->maximum - exp->minimum; |
| 505 | exp->val = ((data - 1) * range + 239) / 479 + exp->minimum; | 542 | exp->val = ((data - 1) * range + 239) / 479 + exp->minimum; |
| 506 | return 0; | 543 | return 0; |
| 544 | case V4L2_CID_HBLANK: | ||
| 545 | data = reg_read(client, MT9V022_HORIZONTAL_BLANKING); | ||
| 546 | if (data < 0) | ||
| 547 | return -EIO; | ||
| 548 | ctrl->val = data; | ||
| 549 | return 0; | ||
| 550 | case V4L2_CID_VBLANK: | ||
| 551 | data = reg_read(client, MT9V022_VERTICAL_BLANKING); | ||
| 552 | if (data < 0) | ||
| 553 | return -EIO; | ||
| 554 | ctrl->val = data; | ||
| 555 | return 0; | ||
| 507 | } | 556 | } |
| 508 | return -EINVAL; | 557 | return -EINVAL; |
| 509 | } | 558 | } |
| @@ -585,6 +634,16 @@ static int mt9v022_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 585 | return -EIO; | 634 | return -EIO; |
| 586 | } | 635 | } |
| 587 | return 0; | 636 | return 0; |
| 637 | case V4L2_CID_HBLANK: | ||
| 638 | if (reg_write(client, MT9V022_HORIZONTAL_BLANKING, | ||
| 639 | ctrl->val) < 0) | ||
| 640 | return -EIO; | ||
| 641 | return 0; | ||
| 642 | case V4L2_CID_VBLANK: | ||
| 643 | if (reg_write(client, MT9V022_VERTICAL_BLANKING, | ||
| 644 | ctrl->val) < 0) | ||
| 645 | return -EIO; | ||
| 646 | return 0; | ||
| 588 | } | 647 | } |
| 589 | return -EINVAL; | 648 | return -EINVAL; |
| 590 | } | 649 | } |
| @@ -616,6 +675,8 @@ static int mt9v022_video_probe(struct i2c_client *client) | |||
| 616 | goto ei2c; | 675 | goto ei2c; |
| 617 | } | 676 | } |
| 618 | 677 | ||
| 678 | mt9v022->chip_version = data; | ||
| 679 | |||
| 619 | mt9v022->reg = is_mt9v024(data) ? &mt9v024_register : | 680 | mt9v022->reg = is_mt9v024(data) ? &mt9v024_register : |
| 620 | &mt9v022_register; | 681 | &mt9v022_register; |
| 621 | 682 | ||
| @@ -814,6 +875,7 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 814 | struct mt9v022 *mt9v022; | 875 | struct mt9v022 *mt9v022; |
| 815 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); | 876 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 816 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 877 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 878 | struct mt9v022_platform_data *pdata = icl->priv; | ||
| 817 | int ret; | 879 | int ret; |
| 818 | 880 | ||
| 819 | if (!icl) { | 881 | if (!icl) { |
| @@ -852,10 +914,21 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 852 | mt9v022->exposure = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, | 914 | mt9v022->exposure = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, |
| 853 | V4L2_CID_EXPOSURE, 1, 255, 1, 255); | 915 | V4L2_CID_EXPOSURE, 1, 255, 1, 255); |
| 854 | 916 | ||
| 917 | mt9v022->hblank = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, | ||
| 918 | V4L2_CID_HBLANK, MT9V022_HORIZONTAL_BLANKING_MIN, | ||
| 919 | MT9V022_HORIZONTAL_BLANKING_MAX, 1, | ||
| 920 | MT9V022_HORIZONTAL_BLANKING_DEF); | ||
| 921 | |||
| 922 | mt9v022->vblank = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, | ||
| 923 | V4L2_CID_VBLANK, MT9V022_VERTICAL_BLANKING_MIN, | ||
| 924 | MT9V022_VERTICAL_BLANKING_MAX, 1, | ||
| 925 | MT9V022_VERTICAL_BLANKING_DEF); | ||
| 926 | |||
| 855 | mt9v022->subdev.ctrl_handler = &mt9v022->hdl; | 927 | mt9v022->subdev.ctrl_handler = &mt9v022->hdl; |
| 856 | if (mt9v022->hdl.error) { | 928 | if (mt9v022->hdl.error) { |
| 857 | int err = mt9v022->hdl.error; | 929 | int err = mt9v022->hdl.error; |
| 858 | 930 | ||
| 931 | dev_err(&client->dev, "control initialisation err %d\n", err); | ||
| 859 | kfree(mt9v022); | 932 | kfree(mt9v022); |
| 860 | return err; | 933 | return err; |
| 861 | } | 934 | } |
| @@ -866,10 +939,10 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 866 | mt9v022->chip_control = MT9V022_CHIP_CONTROL_DEFAULT; | 939 | mt9v022->chip_control = MT9V022_CHIP_CONTROL_DEFAULT; |
| 867 | 940 | ||
| 868 | /* | 941 | /* |
| 869 | * MT9V022 _really_ corrupts the first read out line. | 942 | * On some platforms the first read out line is corrupted. |
| 870 | * TODO: verify on i.MX31 | 943 | * Workaround it by skipping if indicated by platform data. |
| 871 | */ | 944 | */ |
| 872 | mt9v022->y_skip_top = 1; | 945 | mt9v022->y_skip_top = pdata ? pdata->y_skip_top : 0; |
| 873 | mt9v022->rect.left = MT9V022_COLUMN_SKIP; | 946 | mt9v022->rect.left = MT9V022_COLUMN_SKIP; |
| 874 | mt9v022->rect.top = MT9V022_ROW_SKIP; | 947 | mt9v022->rect.top = MT9V022_ROW_SKIP; |
| 875 | mt9v022->rect.width = MT9V022_MAX_WIDTH; | 948 | mt9v022->rect.width = MT9V022_MAX_WIDTH; |
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index d2d298b6354e..66698a83bda2 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c | |||
| @@ -586,9 +586,20 @@ static const struct regval_list ov2640_format_change_preamble_regs[] = { | |||
| 586 | ENDMARKER, | 586 | ENDMARKER, |
| 587 | }; | 587 | }; |
| 588 | 588 | ||
| 589 | static const struct regval_list ov2640_yuv422_regs[] = { | 589 | static const struct regval_list ov2640_yuyv_regs[] = { |
| 590 | { IMAGE_MODE, IMAGE_MODE_YUV422 }, | ||
| 591 | { 0xd7, 0x03 }, | ||
| 592 | { 0x33, 0xa0 }, | ||
| 593 | { 0xe5, 0x1f }, | ||
| 594 | { 0xe1, 0x67 }, | ||
| 595 | { RESET, 0x00 }, | ||
| 596 | { R_BYPASS, R_BYPASS_USE_DSP }, | ||
| 597 | ENDMARKER, | ||
| 598 | }; | ||
| 599 | |||
| 600 | static const struct regval_list ov2640_uyvy_regs[] = { | ||
| 590 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_YUV422 }, | 601 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_YUV422 }, |
| 591 | { 0xD7, 0x01 }, | 602 | { 0xd7, 0x01 }, |
| 592 | { 0x33, 0xa0 }, | 603 | { 0x33, 0xa0 }, |
| 593 | { 0xe1, 0x67 }, | 604 | { 0xe1, 0x67 }, |
| 594 | { RESET, 0x00 }, | 605 | { RESET, 0x00 }, |
| @@ -596,7 +607,15 @@ static const struct regval_list ov2640_yuv422_regs[] = { | |||
| 596 | ENDMARKER, | 607 | ENDMARKER, |
| 597 | }; | 608 | }; |
| 598 | 609 | ||
| 599 | static const struct regval_list ov2640_rgb565_regs[] = { | 610 | static const struct regval_list ov2640_rgb565_be_regs[] = { |
| 611 | { IMAGE_MODE, IMAGE_MODE_RGB565 }, | ||
| 612 | { 0xd7, 0x03 }, | ||
| 613 | { RESET, 0x00 }, | ||
| 614 | { R_BYPASS, R_BYPASS_USE_DSP }, | ||
| 615 | ENDMARKER, | ||
| 616 | }; | ||
| 617 | |||
| 618 | static const struct regval_list ov2640_rgb565_le_regs[] = { | ||
| 600 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_RGB565 }, | 619 | { IMAGE_MODE, IMAGE_MODE_LBYTE_FIRST | IMAGE_MODE_RGB565 }, |
| 601 | { 0xd7, 0x03 }, | 620 | { 0xd7, 0x03 }, |
| 602 | { RESET, 0x00 }, | 621 | { RESET, 0x00 }, |
| @@ -605,7 +624,9 @@ static const struct regval_list ov2640_rgb565_regs[] = { | |||
| 605 | }; | 624 | }; |
| 606 | 625 | ||
| 607 | static enum v4l2_mbus_pixelcode ov2640_codes[] = { | 626 | static enum v4l2_mbus_pixelcode ov2640_codes[] = { |
| 627 | V4L2_MBUS_FMT_YUYV8_2X8, | ||
| 608 | V4L2_MBUS_FMT_UYVY8_2X8, | 628 | V4L2_MBUS_FMT_UYVY8_2X8, |
| 629 | V4L2_MBUS_FMT_RGB565_2X8_BE, | ||
| 609 | V4L2_MBUS_FMT_RGB565_2X8_LE, | 630 | V4L2_MBUS_FMT_RGB565_2X8_LE, |
| 610 | }; | 631 | }; |
| 611 | 632 | ||
| @@ -787,14 +808,22 @@ static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 *height, | |||
| 787 | /* select format */ | 808 | /* select format */ |
| 788 | priv->cfmt_code = 0; | 809 | priv->cfmt_code = 0; |
| 789 | switch (code) { | 810 | switch (code) { |
| 811 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
| 812 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__); | ||
| 813 | selected_cfmt_regs = ov2640_rgb565_be_regs; | ||
| 814 | break; | ||
| 790 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 815 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
| 791 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565", __func__); | 816 | dev_dbg(&client->dev, "%s: Selected cfmt RGB565 LE", __func__); |
| 792 | selected_cfmt_regs = ov2640_rgb565_regs; | 817 | selected_cfmt_regs = ov2640_rgb565_le_regs; |
| 818 | break; | ||
| 819 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
| 820 | dev_dbg(&client->dev, "%s: Selected cfmt YUYV (YUV422)", __func__); | ||
| 821 | selected_cfmt_regs = ov2640_yuyv_regs; | ||
| 793 | break; | 822 | break; |
| 794 | default: | 823 | default: |
| 795 | case V4L2_MBUS_FMT_UYVY8_2X8: | 824 | case V4L2_MBUS_FMT_UYVY8_2X8: |
| 796 | dev_dbg(&client->dev, "%s: Selected cfmt YUV422", __func__); | 825 | dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__); |
| 797 | selected_cfmt_regs = ov2640_yuv422_regs; | 826 | selected_cfmt_regs = ov2640_uyvy_regs; |
| 798 | } | 827 | } |
| 799 | 828 | ||
| 800 | /* reset hardware */ | 829 | /* reset hardware */ |
| @@ -859,10 +888,12 @@ static int ov2640_g_fmt(struct v4l2_subdev *sd, | |||
| 859 | mf->code = priv->cfmt_code; | 888 | mf->code = priv->cfmt_code; |
| 860 | 889 | ||
| 861 | switch (mf->code) { | 890 | switch (mf->code) { |
| 891 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
| 862 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 892 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
| 863 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 893 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
| 864 | break; | 894 | break; |
| 865 | default: | 895 | default: |
| 896 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
| 866 | case V4L2_MBUS_FMT_UYVY8_2X8: | 897 | case V4L2_MBUS_FMT_UYVY8_2X8: |
| 867 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 898 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
| 868 | } | 899 | } |
| @@ -879,11 +910,13 @@ static int ov2640_s_fmt(struct v4l2_subdev *sd, | |||
| 879 | 910 | ||
| 880 | 911 | ||
| 881 | switch (mf->code) { | 912 | switch (mf->code) { |
| 913 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
| 882 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 914 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
| 883 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 915 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
| 884 | break; | 916 | break; |
| 885 | default: | 917 | default: |
| 886 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; | 918 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; |
| 919 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
| 887 | case V4L2_MBUS_FMT_UYVY8_2X8: | 920 | case V4L2_MBUS_FMT_UYVY8_2X8: |
| 888 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 921 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
| 889 | } | 922 | } |
| @@ -896,21 +929,21 @@ static int ov2640_s_fmt(struct v4l2_subdev *sd, | |||
| 896 | static int ov2640_try_fmt(struct v4l2_subdev *sd, | 929 | static int ov2640_try_fmt(struct v4l2_subdev *sd, |
| 897 | struct v4l2_mbus_framefmt *mf) | 930 | struct v4l2_mbus_framefmt *mf) |
| 898 | { | 931 | { |
| 899 | const struct ov2640_win_size *win; | ||
| 900 | |||
| 901 | /* | 932 | /* |
| 902 | * select suitable win | 933 | * select suitable win, but don't store it |
| 903 | */ | 934 | */ |
| 904 | win = ov2640_select_win(&mf->width, &mf->height); | 935 | ov2640_select_win(&mf->width, &mf->height); |
| 905 | 936 | ||
| 906 | mf->field = V4L2_FIELD_NONE; | 937 | mf->field = V4L2_FIELD_NONE; |
| 907 | 938 | ||
| 908 | switch (mf->code) { | 939 | switch (mf->code) { |
| 940 | case V4L2_MBUS_FMT_RGB565_2X8_BE: | ||
| 909 | case V4L2_MBUS_FMT_RGB565_2X8_LE: | 941 | case V4L2_MBUS_FMT_RGB565_2X8_LE: |
| 910 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 942 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
| 911 | break; | 943 | break; |
| 912 | default: | 944 | default: |
| 913 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; | 945 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; |
| 946 | case V4L2_MBUS_FMT_YUYV8_2X8: | ||
| 914 | case V4L2_MBUS_FMT_UYVY8_2X8: | 947 | case V4L2_MBUS_FMT_UYVY8_2X8: |
| 915 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 948 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
| 916 | } | 949 | } |
diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c index 42ae9dc9c574..9ac1b8c3a837 100644 --- a/drivers/media/i2c/vs6624.c +++ b/drivers/media/i2c/vs6624.c | |||
| @@ -788,7 +788,7 @@ static const struct v4l2_subdev_ops vs6624_ops = { | |||
| 788 | .video = &vs6624_video_ops, | 788 | .video = &vs6624_video_ops, |
| 789 | }; | 789 | }; |
| 790 | 790 | ||
| 791 | static int __devinit vs6624_probe(struct i2c_client *client, | 791 | static int vs6624_probe(struct i2c_client *client, |
| 792 | const struct i2c_device_id *id) | 792 | const struct i2c_device_id *id) |
| 793 | { | 793 | { |
| 794 | struct vs6624 *sensor; | 794 | struct vs6624 *sensor; |
| @@ -881,7 +881,7 @@ static int __devinit vs6624_probe(struct i2c_client *client, | |||
| 881 | return ret; | 881 | return ret; |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | static int __devexit vs6624_remove(struct i2c_client *client) | 884 | static int vs6624_remove(struct i2c_client *client) |
| 885 | { | 885 | { |
| 886 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 886 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 887 | struct vs6624 *sensor = to_vs6624(sd); | 887 | struct vs6624 *sensor = to_vs6624(sd); |
| @@ -906,22 +906,11 @@ static struct i2c_driver vs6624_driver = { | |||
| 906 | .name = "vs6624", | 906 | .name = "vs6624", |
| 907 | }, | 907 | }, |
| 908 | .probe = vs6624_probe, | 908 | .probe = vs6624_probe, |
| 909 | .remove = __devexit_p(vs6624_remove), | 909 | .remove = vs6624_remove, |
| 910 | .id_table = vs6624_id, | 910 | .id_table = vs6624_id, |
| 911 | }; | 911 | }; |
| 912 | 912 | ||
| 913 | static __init int vs6624_init(void) | 913 | module_i2c_driver(vs6624_driver); |
| 914 | { | ||
| 915 | return i2c_add_driver(&vs6624_driver); | ||
| 916 | } | ||
| 917 | |||
| 918 | static __exit void vs6624_exit(void) | ||
| 919 | { | ||
| 920 | i2c_del_driver(&vs6624_driver); | ||
| 921 | } | ||
| 922 | |||
| 923 | module_init(vs6624_init); | ||
| 924 | module_exit(vs6624_exit); | ||
| 925 | 914 | ||
| 926 | MODULE_DESCRIPTION("VS6624 sensor driver"); | 915 | MODULE_DESCRIPTION("VS6624 sensor driver"); |
| 927 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); | 916 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); |
diff --git a/drivers/media/mmc/siano/Kconfig b/drivers/media/mmc/siano/Kconfig index fa62475be3bf..aa05ad3c1ccb 100644 --- a/drivers/media/mmc/siano/Kconfig +++ b/drivers/media/mmc/siano/Kconfig | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | config SMS_SDIO_DRV | 5 | config SMS_SDIO_DRV |
| 6 | tristate "Siano SMS1xxx based MDTV via SDIO interface" | 6 | tristate "Siano SMS1xxx based MDTV via SDIO interface" |
| 7 | depends on DVB_CORE && RC_CORE && HAS_DMA | 7 | depends on DVB_CORE && HAS_DMA |
| 8 | depends on MMC | 8 | depends on MMC |
| 9 | select MEDIA_COMMON_OPTIONS | ||
| 9 | ---help--- | 10 | ---help--- |
| 10 | Choose if you would like to have Siano's support for SDIO interface | 11 | Choose if you would like to have Siano's support for SDIO interface |
diff --git a/drivers/media/mmc/siano/smssdio.c b/drivers/media/mmc/siano/smssdio.c index d6f3f100699a..15d34935e00b 100644 --- a/drivers/media/mmc/siano/smssdio.c +++ b/drivers/media/mmc/siano/smssdio.c | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | #define SMSSDIO_INT 0x04 | 50 | #define SMSSDIO_INT 0x04 |
| 51 | #define SMSSDIO_BLOCK_SIZE 128 | 51 | #define SMSSDIO_BLOCK_SIZE 128 |
| 52 | 52 | ||
| 53 | static const struct sdio_device_id smssdio_ids[] __devinitconst = { | 53 | static const struct sdio_device_id smssdio_ids[] = { |
| 54 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR), | 54 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR), |
| 55 | .driver_data = SMS1XXX_BOARD_SIANO_STELLAR}, | 55 | .driver_data = SMS1XXX_BOARD_SIANO_STELLAR}, |
| 56 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_NOVA_A0), | 56 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_NOVA_A0), |
| @@ -224,7 +224,7 @@ static void smssdio_interrupt(struct sdio_func *func) | |||
| 224 | smscore_onresponse(smsdev->coredev, cb); | 224 | smscore_onresponse(smsdev->coredev, cb); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static int __devinit smssdio_probe(struct sdio_func *func, | 227 | static int smssdio_probe(struct sdio_func *func, |
| 228 | const struct sdio_device_id *id) | 228 | const struct sdio_device_id *id) |
| 229 | { | 229 | { |
| 230 | int ret; | 230 | int ret; |
diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c index b34fa95185e4..66eb0baab0e9 100644 --- a/drivers/media/pci/bt8xx/bt878.c +++ b/drivers/media/pci/bt8xx/bt878.c | |||
| @@ -391,7 +391,7 @@ EXPORT_SYMBOL(bt878_device_control); | |||
| 391 | .driver_data = (unsigned long) name \ | 391 | .driver_data = (unsigned long) name \ |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | static struct pci_device_id bt878_pci_tbl[] __devinitdata = { | 394 | static struct pci_device_id bt878_pci_tbl[] = { |
| 395 | BROOKTREE_878_DEVICE(0x0071, 0x0101, "Nebula Electronics DigiTV"), | 395 | BROOKTREE_878_DEVICE(0x0071, 0x0101, "Nebula Electronics DigiTV"), |
| 396 | BROOKTREE_878_DEVICE(0x1461, 0x0761, "AverMedia AverTV DVB-T 761"), | 396 | BROOKTREE_878_DEVICE(0x1461, 0x0761, "AverMedia AverTV DVB-T 761"), |
| 397 | BROOKTREE_878_DEVICE(0x11bd, 0x001c, "Pinnacle PCTV Sat"), | 397 | BROOKTREE_878_DEVICE(0x11bd, 0x001c, "Pinnacle PCTV Sat"), |
| @@ -410,7 +410,7 @@ static struct pci_device_id bt878_pci_tbl[] __devinitdata = { | |||
| 410 | 410 | ||
| 411 | MODULE_DEVICE_TABLE(pci, bt878_pci_tbl); | 411 | MODULE_DEVICE_TABLE(pci, bt878_pci_tbl); |
| 412 | 412 | ||
| 413 | static const char * __devinit card_name(const struct pci_device_id *id) | 413 | static const char * card_name(const struct pci_device_id *id) |
| 414 | { | 414 | { |
| 415 | return id->driver_data ? (const char *)id->driver_data : "Unknown"; | 415 | return id->driver_data ? (const char *)id->driver_data : "Unknown"; |
| 416 | } | 416 | } |
| @@ -419,8 +419,7 @@ static const char * __devinit card_name(const struct pci_device_id *id) | |||
| 419 | /* PCI device handling */ | 419 | /* PCI device handling */ |
| 420 | /***********************/ | 420 | /***********************/ |
| 421 | 421 | ||
| 422 | static int __devinit bt878_probe(struct pci_dev *dev, | 422 | static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
| 423 | const struct pci_device_id *pci_id) | ||
| 424 | { | 423 | { |
| 425 | int result = 0; | 424 | int result = 0; |
| 426 | unsigned char lat; | 425 | unsigned char lat; |
| @@ -529,7 +528,7 @@ static int __devinit bt878_probe(struct pci_dev *dev, | |||
| 529 | return result; | 528 | return result; |
| 530 | } | 529 | } |
| 531 | 530 | ||
| 532 | static void __devexit bt878_remove(struct pci_dev *pci_dev) | 531 | static void bt878_remove(struct pci_dev *pci_dev) |
| 533 | { | 532 | { |
| 534 | u8 command; | 533 | u8 command; |
| 535 | struct bt878 *bt = pci_get_drvdata(pci_dev); | 534 | struct bt878 *bt = pci_get_drvdata(pci_dev); |
| @@ -573,7 +572,7 @@ static struct pci_driver bt878_pci_driver = { | |||
| 573 | .name = "bt878", | 572 | .name = "bt878", |
| 574 | .id_table = bt878_pci_tbl, | 573 | .id_table = bt878_pci_tbl, |
| 575 | .probe = bt878_probe, | 574 | .probe = bt878_probe, |
| 576 | .remove = __devexit_p(bt878_remove), | 575 | .remove = bt878_remove, |
| 577 | }; | 576 | }; |
| 578 | 577 | ||
| 579 | /*******************************/ | 578 | /*******************************/ |
diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c index 38952faaffda..c4c59175e52c 100644 --- a/drivers/media/pci/bt8xx/bttv-cards.c +++ b/drivers/media/pci/bt8xx/bttv-cards.c | |||
| @@ -87,7 +87,7 @@ static int tea5757_read(struct bttv *btv); | |||
| 87 | static int tea5757_write(struct bttv *btv, int value); | 87 | static int tea5757_write(struct bttv *btv, int value); |
| 88 | static void identify_by_eeprom(struct bttv *btv, | 88 | static void identify_by_eeprom(struct bttv *btv, |
| 89 | unsigned char eeprom_data[256]); | 89 | unsigned char eeprom_data[256]); |
| 90 | static int __devinit pvr_boot(struct bttv *btv); | 90 | static int pvr_boot(struct bttv *btv); |
| 91 | 91 | ||
| 92 | /* config variables */ | 92 | /* config variables */ |
| 93 | static unsigned int triton1; | 93 | static unsigned int triton1; |
| @@ -151,7 +151,7 @@ static struct CARD { | |||
| 151 | unsigned id; | 151 | unsigned id; |
| 152 | int cardnr; | 152 | int cardnr; |
| 153 | char *name; | 153 | char *name; |
| 154 | } cards[] __devinitdata = { | 154 | } cards[] = { |
| 155 | { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" }, | 155 | { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" }, |
| 156 | { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" }, | 156 | { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" }, |
| 157 | { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" }, | 157 | { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" }, |
| @@ -2837,7 +2837,7 @@ static unsigned char eeprom_data[256]; | |||
| 2837 | /* | 2837 | /* |
| 2838 | * identify card | 2838 | * identify card |
| 2839 | */ | 2839 | */ |
| 2840 | void __devinit bttv_idcard(struct bttv *btv) | 2840 | void bttv_idcard(struct bttv *btv) |
| 2841 | { | 2841 | { |
| 2842 | unsigned int gpiobits; | 2842 | unsigned int gpiobits; |
| 2843 | int i,type; | 2843 | int i,type; |
| @@ -3235,7 +3235,7 @@ static void bttv_reset_audio(struct bttv *btv) | |||
| 3235 | } | 3235 | } |
| 3236 | 3236 | ||
| 3237 | /* initialization part one -- before registering i2c bus */ | 3237 | /* initialization part one -- before registering i2c bus */ |
| 3238 | void __devinit bttv_init_card1(struct bttv *btv) | 3238 | void bttv_init_card1(struct bttv *btv) |
| 3239 | { | 3239 | { |
| 3240 | switch (btv->c.type) { | 3240 | switch (btv->c.type) { |
| 3241 | case BTTV_BOARD_HAUPPAUGE: | 3241 | case BTTV_BOARD_HAUPPAUGE: |
| @@ -3267,7 +3267,7 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
| 3267 | } | 3267 | } |
| 3268 | 3268 | ||
| 3269 | /* initialization part two -- after registering i2c bus */ | 3269 | /* initialization part two -- after registering i2c bus */ |
| 3270 | void __devinit bttv_init_card2(struct bttv *btv) | 3270 | void bttv_init_card2(struct bttv *btv) |
| 3271 | { | 3271 | { |
| 3272 | btv->tuner_type = UNSET; | 3272 | btv->tuner_type = UNSET; |
| 3273 | 3273 | ||
| @@ -3571,7 +3571,7 @@ no_audio: | |||
| 3571 | 3571 | ||
| 3572 | 3572 | ||
| 3573 | /* initialize the tuner */ | 3573 | /* initialize the tuner */ |
| 3574 | void __devinit bttv_init_tuner(struct bttv *btv) | 3574 | void bttv_init_tuner(struct bttv *btv) |
| 3575 | { | 3575 | { |
| 3576 | int addr = ADDR_UNSET; | 3576 | int addr = ADDR_UNSET; |
| 3577 | 3577 | ||
| @@ -3635,7 +3635,7 @@ static void modtec_eeprom(struct bttv *btv) | |||
| 3635 | } | 3635 | } |
| 3636 | } | 3636 | } |
| 3637 | 3637 | ||
| 3638 | static void __devinit hauppauge_eeprom(struct bttv *btv) | 3638 | static void hauppauge_eeprom(struct bttv *btv) |
| 3639 | { | 3639 | { |
| 3640 | struct tveeprom tv; | 3640 | struct tveeprom tv; |
| 3641 | 3641 | ||
| @@ -3709,8 +3709,7 @@ static int terratec_active_radio_upgrade(struct bttv *btv) | |||
| 3709 | #define BTTV_ALT_DCLK 0x100000 | 3709 | #define BTTV_ALT_DCLK 0x100000 |
| 3710 | #define BTTV_ALT_NCONFIG 0x800000 | 3710 | #define BTTV_ALT_NCONFIG 0x800000 |
| 3711 | 3711 | ||
| 3712 | static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro, | 3712 | static int pvr_altera_load(struct bttv *btv, const u8 *micro, u32 microlen) |
| 3713 | u32 microlen) | ||
| 3714 | { | 3713 | { |
| 3715 | u32 n; | 3714 | u32 n; |
| 3716 | u8 bits; | 3715 | u8 bits; |
| @@ -3747,7 +3746,7 @@ static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro, | |||
| 3747 | return 0; | 3746 | return 0; |
| 3748 | } | 3747 | } |
| 3749 | 3748 | ||
| 3750 | static int __devinit pvr_boot(struct bttv *btv) | 3749 | static int pvr_boot(struct bttv *btv) |
| 3751 | { | 3750 | { |
| 3752 | const struct firmware *fw_entry; | 3751 | const struct firmware *fw_entry; |
| 3753 | int rc; | 3752 | int rc; |
| @@ -3767,7 +3766,7 @@ static int __devinit pvr_boot(struct bttv *btv) | |||
| 3767 | /* ----------------------------------------------------------------------- */ | 3766 | /* ----------------------------------------------------------------------- */ |
| 3768 | /* some osprey specific stuff */ | 3767 | /* some osprey specific stuff */ |
| 3769 | 3768 | ||
| 3770 | static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256]) | 3769 | static void osprey_eeprom(struct bttv *btv, const u8 ee[256]) |
| 3771 | { | 3770 | { |
| 3772 | int i; | 3771 | int i; |
| 3773 | u32 serial = 0; | 3772 | u32 serial = 0; |
| @@ -3898,7 +3897,7 @@ static int tuner_1_table[] = { | |||
| 3898 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ | 3897 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ |
| 3899 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; | 3898 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; |
| 3900 | 3899 | ||
| 3901 | static void __devinit avermedia_eeprom(struct bttv *btv) | 3900 | static void avermedia_eeprom(struct bttv *btv) |
| 3902 | { | 3901 | { |
| 3903 | int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0; | 3902 | int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0; |
| 3904 | 3903 | ||
| @@ -3960,7 +3959,7 @@ u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits) | |||
| 3960 | * Hauppauge: pin 5 | 3959 | * Hauppauge: pin 5 |
| 3961 | * Voodoo: pin 20 | 3960 | * Voodoo: pin 20 |
| 3962 | */ | 3961 | */ |
| 3963 | static void __devinit boot_msp34xx(struct bttv *btv, int pin) | 3962 | static void boot_msp34xx(struct bttv *btv, int pin) |
| 3964 | { | 3963 | { |
| 3965 | int mask = (1 << pin); | 3964 | int mask = (1 << pin); |
| 3966 | 3965 | ||
| @@ -3983,11 +3982,10 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) | |||
| 3983 | * used by Alessandro Rubini in his pxc200 | 3982 | * used by Alessandro Rubini in his pxc200 |
| 3984 | * driver, but using BTTV functions */ | 3983 | * driver, but using BTTV functions */ |
| 3985 | 3984 | ||
| 3986 | static void __devinit init_PXC200(struct bttv *btv) | 3985 | static void init_PXC200(struct bttv *btv) |
| 3987 | { | 3986 | { |
| 3988 | static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d, | 3987 | static int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d, 0x01, 0x02, |
| 3989 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, | 3988 | 0x03, 0x04, 0x05, 0x06, 0x00 }; |
| 3990 | 0x00 }; | ||
| 3991 | unsigned int i; | 3989 | unsigned int i; |
| 3992 | int tmp; | 3990 | int tmp; |
| 3993 | u32 val; | 3991 | u32 val; |
| @@ -4851,7 +4849,7 @@ void __init bttv_check_chipset(void) | |||
| 4851 | } | 4849 | } |
| 4852 | } | 4850 | } |
| 4853 | 4851 | ||
| 4854 | int __devinit bttv_handle_chipset(struct bttv *btv) | 4852 | int bttv_handle_chipset(struct bttv *btv) |
| 4855 | { | 4853 | { |
| 4856 | unsigned char command; | 4854 | unsigned char command; |
| 4857 | 4855 | ||
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 56c6c77793d7..45e5d0661b60 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c | |||
| @@ -200,7 +200,7 @@ static void flush_request_modules(struct bttv *dev) | |||
| 200 | } | 200 | } |
| 201 | #else | 201 | #else |
| 202 | #define request_modules(dev) | 202 | #define request_modules(dev) |
| 203 | #define flush_request_modules(dev) | 203 | #define flush_request_modules(dev) do {} while(0) |
| 204 | #endif /* CONFIG_MODULES */ | 204 | #endif /* CONFIG_MODULES */ |
| 205 | 205 | ||
| 206 | 206 | ||
| @@ -301,11 +301,10 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
| 301 | /* totalwidth */ 1135, | 301 | /* totalwidth */ 1135, |
| 302 | /* sqwidth */ 944, | 302 | /* sqwidth */ 944, |
| 303 | /* vdelay */ 0x20, | 303 | /* vdelay */ 0x20, |
| 304 | /* sheight */ 576, | ||
| 305 | /* videostart0 */ 23) | ||
| 306 | /* bt878 (and bt848?) can capture another | 304 | /* bt878 (and bt848?) can capture another |
| 307 | line below active video. */ | 305 | line below active video. */ |
| 308 | .cropcap.bounds.height = (576 + 2) + 0x20 - 2, | 306 | /* sheight */ (576 + 2) + 0x20 - 2, |
| 307 | /* videostart0 */ 23) | ||
| 309 | },{ | 308 | },{ |
| 310 | .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, | 309 | .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, |
| 311 | .name = "NTSC", | 310 | .name = "NTSC", |
| @@ -4200,7 +4199,7 @@ static void bttv_unregister_video(struct bttv *btv) | |||
| 4200 | } | 4199 | } |
| 4201 | 4200 | ||
| 4202 | /* register video4linux devices */ | 4201 | /* register video4linux devices */ |
| 4203 | static int __devinit bttv_register_video(struct bttv *btv) | 4202 | static int bttv_register_video(struct bttv *btv) |
| 4204 | { | 4203 | { |
| 4205 | if (no_overlay > 0) | 4204 | if (no_overlay > 0) |
| 4206 | pr_notice("Overlay support disabled\n"); | 4205 | pr_notice("Overlay support disabled\n"); |
| @@ -4266,8 +4265,7 @@ static void pci_set_command(struct pci_dev *dev) | |||
| 4266 | #endif | 4265 | #endif |
| 4267 | } | 4266 | } |
| 4268 | 4267 | ||
| 4269 | static int __devinit bttv_probe(struct pci_dev *dev, | 4268 | static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) |
| 4270 | const struct pci_device_id *pci_id) | ||
| 4271 | { | 4269 | { |
| 4272 | int result; | 4270 | int result; |
| 4273 | unsigned char lat; | 4271 | unsigned char lat; |
| @@ -4455,7 +4453,7 @@ fail0: | |||
| 4455 | return result; | 4453 | return result; |
| 4456 | } | 4454 | } |
| 4457 | 4455 | ||
| 4458 | static void __devexit bttv_remove(struct pci_dev *pci_dev) | 4456 | static void bttv_remove(struct pci_dev *pci_dev) |
| 4459 | { | 4457 | { |
| 4460 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); | 4458 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 4461 | struct bttv *btv = to_bttv(v4l2_dev); | 4459 | struct bttv *btv = to_bttv(v4l2_dev); |
| @@ -4599,7 +4597,7 @@ static struct pci_driver bttv_pci_driver = { | |||
| 4599 | .name = "bttv", | 4597 | .name = "bttv", |
| 4600 | .id_table = bttv_pci_tbl, | 4598 | .id_table = bttv_pci_tbl, |
| 4601 | .probe = bttv_probe, | 4599 | .probe = bttv_probe, |
| 4602 | .remove = __devexit_p(bttv_remove), | 4600 | .remove = bttv_remove, |
| 4603 | #ifdef CONFIG_PM | 4601 | #ifdef CONFIG_PM |
| 4604 | .suspend = bttv_suspend, | 4602 | .suspend = bttv_suspend, |
| 4605 | .resume = bttv_resume, | 4603 | .resume = bttv_resume, |
diff --git a/drivers/media/pci/bt8xx/bttv-i2c.c b/drivers/media/pci/bt8xx/bttv-i2c.c index 580c8e682392..5039b8826e0a 100644 --- a/drivers/media/pci/bt8xx/bttv-i2c.c +++ b/drivers/media/pci/bt8xx/bttv-i2c.c | |||
| @@ -99,7 +99,7 @@ static int bttv_bit_getsda(void *data) | |||
| 99 | return state; | 99 | return state; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static struct i2c_algo_bit_data __devinitdata bttv_i2c_algo_bit_template = { | 102 | static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = { |
| 103 | .setsda = bttv_bit_setsda, | 103 | .setsda = bttv_bit_setsda, |
| 104 | .setscl = bttv_bit_setscl, | 104 | .setscl = bttv_bit_setscl, |
| 105 | .getsda = bttv_bit_getsda, | 105 | .getsda = bttv_bit_getsda, |
| @@ -312,7 +312,7 @@ int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, | |||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | /* read EEPROM content */ | 314 | /* read EEPROM content */ |
| 315 | void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) | 315 | void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) |
| 316 | { | 316 | { |
| 317 | memset(eedata, 0, 256); | 317 | memset(eedata, 0, 256); |
| 318 | if (0 != btv->i2c_rc) | 318 | if (0 != btv->i2c_rc) |
| @@ -347,7 +347,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c) | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | /* init + register i2c adapter */ | 349 | /* init + register i2c adapter */ |
| 350 | int __devinit init_bttv_i2c(struct bttv *btv) | 350 | int init_bttv_i2c(struct bttv *btv) |
| 351 | { | 351 | { |
| 352 | strlcpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE); | 352 | strlcpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE); |
| 353 | 353 | ||
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index ef4c7cd41982..04207a799055 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c | |||
| @@ -368,7 +368,7 @@ static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | /* Instantiate the I2C IR receiver device, if present */ | 370 | /* Instantiate the I2C IR receiver device, if present */ |
| 371 | void __devinit init_bttv_i2c_ir(struct bttv *btv) | 371 | void init_bttv_i2c_ir(struct bttv *btv) |
| 372 | { | 372 | { |
| 373 | const unsigned short addr_list[] = { | 373 | const unsigned short addr_list[] = { |
| 374 | 0x1a, 0x18, 0x64, 0x30, 0x71, | 374 | 0x1a, 0x18, 0x64, 0x30, 0x71, |
| @@ -411,7 +411,7 @@ void __devinit init_bttv_i2c_ir(struct bttv *btv) | |||
| 411 | return; | 411 | return; |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | int __devexit fini_bttv_i2c(struct bttv *btv) | 414 | int fini_bttv_i2c(struct bttv *btv) |
| 415 | { | 415 | { |
| 416 | if (0 != btv->i2c_rc) | 416 | if (0 != btv->i2c_rc) |
| 417 | return 0; | 417 | return 0; |
diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c b/drivers/media/pci/bt8xx/dvb-bt8xx.c index 81fab9adc1ca..d407244fd1bc 100644 --- a/drivers/media/pci/bt8xx/dvb-bt8xx.c +++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c | |||
| @@ -118,7 +118,8 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev) | |||
| 118 | return 0; | 118 | return 0; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) | 121 | static struct bt878 *dvb_bt8xx_878_match(unsigned int bttv_nr, |
| 122 | struct pci_dev* bttv_pci_dev) | ||
| 122 | { | 123 | { |
| 123 | unsigned int card_nr; | 124 | unsigned int card_nr; |
| 124 | 125 | ||
| @@ -720,7 +721,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
| 720 | } | 721 | } |
| 721 | } | 722 | } |
| 722 | 723 | ||
| 723 | static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | 724 | static int dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) |
| 724 | { | 725 | { |
| 725 | int result; | 726 | int result; |
| 726 | 727 | ||
| @@ -811,7 +812,7 @@ err_unregister_adaptor: | |||
| 811 | return result; | 812 | return result; |
| 812 | } | 813 | } |
| 813 | 814 | ||
| 814 | static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) | 815 | static int dvb_bt8xx_probe(struct bttv_sub_device *sub) |
| 815 | { | 816 | { |
| 816 | struct dvb_bt8xx_card *card; | 817 | struct dvb_bt8xx_card *card; |
| 817 | struct pci_dev* bttv_pci_dev; | 818 | struct pci_dev* bttv_pci_dev; |
diff --git a/drivers/media/pci/cx18/cx18-alsa-main.c b/drivers/media/pci/cx18/cx18-alsa-main.c index 6d2a98246b6d..8e971ff60588 100644 --- a/drivers/media/pci/cx18/cx18-alsa-main.c +++ b/drivers/media/pci/cx18/cx18-alsa-main.c | |||
| @@ -197,7 +197,7 @@ err_exit: | |||
| 197 | return ret; | 197 | return ret; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | int cx18_alsa_load(struct cx18 *cx) | 200 | static int __init cx18_alsa_load(struct cx18 *cx) |
| 201 | { | 201 | { |
| 202 | struct v4l2_device *v4l2_dev = &cx->v4l2_dev; | 202 | struct v4l2_device *v4l2_dev = &cx->v4l2_dev; |
| 203 | struct cx18_stream *s; | 203 | struct cx18_stream *s; |
diff --git a/drivers/media/pci/cx18/cx18-alsa-pcm.c b/drivers/media/pci/cx18/cx18-alsa-pcm.c index 7a5b84a86bb3..180077c49123 100644 --- a/drivers/media/pci/cx18/cx18-alsa-pcm.c +++ b/drivers/media/pci/cx18/cx18-alsa-pcm.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include "cx18-streams.h" | 37 | #include "cx18-streams.h" |
| 38 | #include "cx18-fileops.h" | 38 | #include "cx18-fileops.h" |
| 39 | #include "cx18-alsa.h" | 39 | #include "cx18-alsa.h" |
| 40 | #include "cx18-alsa-pcm.h" | ||
| 40 | 41 | ||
| 41 | static unsigned int pcm_debug; | 42 | static unsigned int pcm_debug; |
| 42 | module_param(pcm_debug, int, 0644); | 43 | module_param(pcm_debug, int, 0644); |
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 039133d692e3..613e5ae7d5ca 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
| @@ -53,7 +53,7 @@ int (*cx18_ext_init)(struct cx18 *); | |||
| 53 | EXPORT_SYMBOL(cx18_ext_init); | 53 | EXPORT_SYMBOL(cx18_ext_init); |
| 54 | 54 | ||
| 55 | /* add your revision and whatnot here */ | 55 | /* add your revision and whatnot here */ |
| 56 | static struct pci_device_id cx18_pci_tbl[] __devinitdata = { | 56 | static struct pci_device_id cx18_pci_tbl[] = { |
| 57 | {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418, | 57 | {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418, |
| 58 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 58 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 59 | {0,} | 59 | {0,} |
| @@ -691,7 +691,7 @@ done: | |||
| 691 | cx->card_i2c = cx->card->i2c; | 691 | cx->card_i2c = cx->card->i2c; |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | static int __devinit cx18_create_in_workq(struct cx18 *cx) | 694 | static int cx18_create_in_workq(struct cx18 *cx) |
| 695 | { | 695 | { |
| 696 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", | 696 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", |
| 697 | cx->v4l2_dev.name); | 697 | cx->v4l2_dev.name); |
| @@ -703,7 +703,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx) | |||
| 703 | return 0; | 703 | return 0; |
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | static void __devinit cx18_init_in_work_orders(struct cx18 *cx) | 706 | static void cx18_init_in_work_orders(struct cx18 *cx) |
| 707 | { | 707 | { |
| 708 | int i; | 708 | int i; |
| 709 | for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) { | 709 | for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) { |
| @@ -718,7 +718,7 @@ static void __devinit cx18_init_in_work_orders(struct cx18 *cx) | |||
| 718 | No assumptions on the card type may be made here (see cx18_init_struct2 | 718 | No assumptions on the card type may be made here (see cx18_init_struct2 |
| 719 | for that). | 719 | for that). |
| 720 | */ | 720 | */ |
| 721 | static int __devinit cx18_init_struct1(struct cx18 *cx) | 721 | static int cx18_init_struct1(struct cx18 *cx) |
| 722 | { | 722 | { |
| 723 | int ret; | 723 | int ret; |
| 724 | 724 | ||
| @@ -775,7 +775,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
| 775 | 775 | ||
| 776 | /* Second initialization part. Here the card type has been | 776 | /* Second initialization part. Here the card type has been |
| 777 | autodetected. */ | 777 | autodetected. */ |
| 778 | static void __devinit cx18_init_struct2(struct cx18 *cx) | 778 | static void cx18_init_struct2(struct cx18 *cx) |
| 779 | { | 779 | { |
| 780 | int i; | 780 | int i; |
| 781 | 781 | ||
| @@ -892,8 +892,8 @@ static void cx18_init_subdevs(struct cx18 *cx) | |||
| 892 | cx->sd_extmux = cx18_find_hw(cx, cx->card->hw_muxer); | 892 | cx->sd_extmux = cx18_find_hw(cx, cx->card->hw_muxer); |
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | static int __devinit cx18_probe(struct pci_dev *pci_dev, | 895 | static int cx18_probe(struct pci_dev *pci_dev, |
| 896 | const struct pci_device_id *pci_id) | 896 | const struct pci_device_id *pci_id) |
| 897 | { | 897 | { |
| 898 | int retval = 0; | 898 | int retval = 0; |
| 899 | int i; | 899 | int i; |
diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c index 51609d5c88ce..4908eb7bcf6c 100644 --- a/drivers/media/pci/cx18/cx18-i2c.c +++ b/drivers/media/pci/cx18/cx18-i2c.c | |||
| @@ -98,7 +98,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, | |||
| 98 | case CX18_HW_Z8F0811_IR_RX_HAUP: | 98 | case CX18_HW_Z8F0811_IR_RX_HAUP: |
| 99 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 99 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 100 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 100 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
| 101 | init_data->type = RC_TYPE_RC5; | 101 | init_data->type = RC_BIT_RC5; |
| 102 | init_data->name = cx->card_name; | 102 | init_data->name = cx->card_name; |
| 103 | info.platform_data = init_data; | 103 | info.platform_data = init_data; |
| 104 | break; | 104 | break; |
diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 72af9b5c2d7d..843c62b2f482 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c | |||
| @@ -97,7 +97,7 @@ static struct { | |||
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | 99 | ||
| 100 | void cx18_dma_free(struct videobuf_queue *q, | 100 | static void cx18_dma_free(struct videobuf_queue *q, |
| 101 | struct cx18_stream *s, struct cx18_videobuf_buffer *buf) | 101 | struct cx18_stream *s, struct cx18_videobuf_buffer *buf) |
| 102 | { | 102 | { |
| 103 | videobuf_waiton(q, &buf->vb, 0, 0); | 103 | videobuf_waiton(q, &buf->vb, 0, 0); |
diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c index 495781ee4711..2926f7fadccd 100644 --- a/drivers/media/pci/cx23885/altera-ci.c +++ b/drivers/media/pci/cx23885/altera-ci.c | |||
| @@ -263,7 +263,7 @@ static int netup_fpga_op_rw(struct fpga_internal *inter, int addr, | |||
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | /* flag - mem/io, read - read/write */ | 265 | /* flag - mem/io, read - read/write */ |
| 266 | int altera_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, | 266 | static int altera_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, |
| 267 | u8 flag, u8 read, int addr, u8 val) | 267 | u8 flag, u8 read, int addr, u8 val) |
| 268 | { | 268 | { |
| 269 | 269 | ||
| @@ -298,31 +298,32 @@ int altera_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, | |||
| 298 | return mem; | 298 | return mem; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | int altera_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221, | 301 | static int altera_ci_read_attribute_mem(struct dvb_ca_en50221 *en50221, |
| 302 | int slot, int addr) | 302 | int slot, int addr) |
| 303 | { | 303 | { |
| 304 | return altera_ci_op_cam(en50221, slot, 0, NETUP_CI_FLG_RD, addr, 0); | 304 | return altera_ci_op_cam(en50221, slot, 0, NETUP_CI_FLG_RD, addr, 0); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | int altera_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221, | 307 | static int altera_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221, |
| 308 | int slot, int addr, u8 data) | 308 | int slot, int addr, u8 data) |
| 309 | { | 309 | { |
| 310 | return altera_ci_op_cam(en50221, slot, 0, 0, addr, data); | 310 | return altera_ci_op_cam(en50221, slot, 0, 0, addr, data); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | int altera_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr) | 313 | static int altera_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221, |
| 314 | int slot, u8 addr) | ||
| 314 | { | 315 | { |
| 315 | return altera_ci_op_cam(en50221, slot, NETUP_CI_FLG_CTL, | 316 | return altera_ci_op_cam(en50221, slot, NETUP_CI_FLG_CTL, |
| 316 | NETUP_CI_FLG_RD, addr, 0); | 317 | NETUP_CI_FLG_RD, addr, 0); |
| 317 | } | 318 | } |
| 318 | 319 | ||
| 319 | int altera_ci_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, | 320 | static int altera_ci_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, |
| 320 | u8 addr, u8 data) | 321 | u8 addr, u8 data) |
| 321 | { | 322 | { |
| 322 | return altera_ci_op_cam(en50221, slot, NETUP_CI_FLG_CTL, 0, addr, data); | 323 | return altera_ci_op_cam(en50221, slot, NETUP_CI_FLG_CTL, 0, addr, data); |
| 323 | } | 324 | } |
| 324 | 325 | ||
| 325 | int altera_ci_slot_reset(struct dvb_ca_en50221 *en50221, int slot) | 326 | static int altera_ci_slot_reset(struct dvb_ca_en50221 *en50221, int slot) |
| 326 | { | 327 | { |
| 327 | struct altera_ci_state *state = en50221->data; | 328 | struct altera_ci_state *state = en50221->data; |
| 328 | struct fpga_internal *inter = state->internal; | 329 | struct fpga_internal *inter = state->internal; |
| @@ -365,13 +366,13 @@ int altera_ci_slot_reset(struct dvb_ca_en50221 *en50221, int slot) | |||
| 365 | return 0; | 366 | return 0; |
| 366 | } | 367 | } |
| 367 | 368 | ||
| 368 | int altera_ci_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot) | 369 | static int altera_ci_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot) |
| 369 | { | 370 | { |
| 370 | /* not implemented */ | 371 | /* not implemented */ |
| 371 | return 0; | 372 | return 0; |
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | int altera_ci_slot_ts_ctl(struct dvb_ca_en50221 *en50221, int slot) | 375 | static int altera_ci_slot_ts_ctl(struct dvb_ca_en50221 *en50221, int slot) |
| 375 | { | 376 | { |
| 376 | struct altera_ci_state *state = en50221->data; | 377 | struct altera_ci_state *state = en50221->data; |
| 377 | struct fpga_internal *inter = state->internal; | 378 | struct fpga_internal *inter = state->internal; |
| @@ -448,8 +449,8 @@ int altera_ci_irq(void *dev) | |||
| 448 | } | 449 | } |
| 449 | EXPORT_SYMBOL(altera_ci_irq); | 450 | EXPORT_SYMBOL(altera_ci_irq); |
| 450 | 451 | ||
| 451 | int altera_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, int slot, | 452 | static int altera_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, |
| 452 | int open) | 453 | int slot, int open) |
| 453 | { | 454 | { |
| 454 | struct altera_ci_state *state = en50221->data; | 455 | struct altera_ci_state *state = en50221->data; |
| 455 | 456 | ||
| @@ -459,7 +460,7 @@ int altera_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, int slot, | |||
| 459 | return state->status; | 460 | return state->status; |
| 460 | } | 461 | } |
| 461 | 462 | ||
| 462 | void altera_hw_filt_release(void *main_dev, int filt_nr) | 463 | static void altera_hw_filt_release(void *main_dev, int filt_nr) |
| 463 | { | 464 | { |
| 464 | struct fpga_inode *temp_int = find_inode(main_dev); | 465 | struct fpga_inode *temp_int = find_inode(main_dev); |
| 465 | struct netup_hw_pid_filter *pid_filt = NULL; | 466 | struct netup_hw_pid_filter *pid_filt = NULL; |
| @@ -581,7 +582,7 @@ static void altera_toggle_fullts_streaming(struct netup_hw_pid_filter *pid_filt, | |||
| 581 | mutex_unlock(&inter->fpga_mutex); | 582 | mutex_unlock(&inter->fpga_mutex); |
| 582 | } | 583 | } |
| 583 | 584 | ||
| 584 | int altera_pid_feed_control(void *demux_dev, int filt_nr, | 585 | static int altera_pid_feed_control(void *demux_dev, int filt_nr, |
| 585 | struct dvb_demux_feed *feed, int onoff) | 586 | struct dvb_demux_feed *feed, int onoff) |
| 586 | { | 587 | { |
| 587 | struct fpga_inode *temp_int = find_dinode(demux_dev); | 588 | struct fpga_inode *temp_int = find_dinode(demux_dev); |
| @@ -603,41 +604,41 @@ int altera_pid_feed_control(void *demux_dev, int filt_nr, | |||
| 603 | } | 604 | } |
| 604 | EXPORT_SYMBOL(altera_pid_feed_control); | 605 | EXPORT_SYMBOL(altera_pid_feed_control); |
| 605 | 606 | ||
| 606 | int altera_ci_start_feed(struct dvb_demux_feed *feed, int num) | 607 | static int altera_ci_start_feed(struct dvb_demux_feed *feed, int num) |
| 607 | { | 608 | { |
| 608 | altera_pid_feed_control(feed->demux, num, feed, 1); | 609 | altera_pid_feed_control(feed->demux, num, feed, 1); |
| 609 | 610 | ||
| 610 | return 0; | 611 | return 0; |
| 611 | } | 612 | } |
| 612 | 613 | ||
| 613 | int altera_ci_stop_feed(struct dvb_demux_feed *feed, int num) | 614 | static int altera_ci_stop_feed(struct dvb_demux_feed *feed, int num) |
| 614 | { | 615 | { |
| 615 | altera_pid_feed_control(feed->demux, num, feed, 0); | 616 | altera_pid_feed_control(feed->demux, num, feed, 0); |
| 616 | 617 | ||
| 617 | return 0; | 618 | return 0; |
| 618 | } | 619 | } |
| 619 | 620 | ||
| 620 | int altera_ci_start_feed_1(struct dvb_demux_feed *feed) | 621 | static int altera_ci_start_feed_1(struct dvb_demux_feed *feed) |
| 621 | { | 622 | { |
| 622 | return altera_ci_start_feed(feed, 1); | 623 | return altera_ci_start_feed(feed, 1); |
| 623 | } | 624 | } |
| 624 | 625 | ||
| 625 | int altera_ci_stop_feed_1(struct dvb_demux_feed *feed) | 626 | static int altera_ci_stop_feed_1(struct dvb_demux_feed *feed) |
| 626 | { | 627 | { |
| 627 | return altera_ci_stop_feed(feed, 1); | 628 | return altera_ci_stop_feed(feed, 1); |
| 628 | } | 629 | } |
| 629 | 630 | ||
| 630 | int altera_ci_start_feed_2(struct dvb_demux_feed *feed) | 631 | static int altera_ci_start_feed_2(struct dvb_demux_feed *feed) |
| 631 | { | 632 | { |
| 632 | return altera_ci_start_feed(feed, 2); | 633 | return altera_ci_start_feed(feed, 2); |
| 633 | } | 634 | } |
| 634 | 635 | ||
| 635 | int altera_ci_stop_feed_2(struct dvb_demux_feed *feed) | 636 | static int altera_ci_stop_feed_2(struct dvb_demux_feed *feed) |
| 636 | { | 637 | { |
| 637 | return altera_ci_stop_feed(feed, 2); | 638 | return altera_ci_stop_feed(feed, 2); |
| 638 | } | 639 | } |
| 639 | 640 | ||
| 640 | int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) | 641 | static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) |
| 641 | { | 642 | { |
| 642 | struct netup_hw_pid_filter *pid_filt = NULL; | 643 | struct netup_hw_pid_filter *pid_filt = NULL; |
| 643 | struct fpga_inode *temp_int = find_inode(config->dev); | 644 | struct fpga_inode *temp_int = find_inode(config->dev); |
diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c index 6617774a326a..7344849183a7 100644 --- a/drivers/media/pci/cx23885/cimax2.c +++ b/drivers/media/pci/cx23885/cimax2.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include "cx23885.h" | 26 | #include "cx23885.h" |
| 27 | #include "cimax2.h" | ||
| 27 | #include "dvb_ca_en50221.h" | 28 | #include "dvb_ca_en50221.h" |
| 28 | /**** Bit definitions for MC417_RWD and MC417_OEN registers *** | 29 | /**** Bit definitions for MC417_RWD and MC417_OEN registers *** |
| 29 | bits 31-16 | 30 | bits 31-16 |
| @@ -87,7 +88,7 @@ struct netup_ci_state { | |||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | 90 | ||
| 90 | int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | 91 | static int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, |
| 91 | u8 *buf, int len) | 92 | u8 *buf, int len) |
| 92 | { | 93 | { |
| 93 | int ret; | 94 | int ret; |
| @@ -120,7 +121,7 @@ int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | |||
| 120 | return 0; | 121 | return 0; |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | 124 | static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, |
| 124 | u8 *buf, int len) | 125 | u8 *buf, int len) |
| 125 | { | 126 | { |
| 126 | int ret; | 127 | int ret; |
| @@ -147,7 +148,7 @@ int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, | |||
| 147 | return 0; | 148 | return 0; |
| 148 | } | 149 | } |
| 149 | 150 | ||
| 150 | int netup_ci_get_mem(struct cx23885_dev *dev) | 151 | static int netup_ci_get_mem(struct cx23885_dev *dev) |
| 151 | { | 152 | { |
| 152 | int mem; | 153 | int mem; |
| 153 | unsigned long timeout = jiffies + msecs_to_jiffies(1); | 154 | unsigned long timeout = jiffies + msecs_to_jiffies(1); |
| @@ -166,7 +167,7 @@ int netup_ci_get_mem(struct cx23885_dev *dev) | |||
| 166 | return mem & 0xff; | 167 | return mem & 0xff; |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, | 170 | static int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, |
| 170 | u8 flag, u8 read, int addr, u8 data) | 171 | u8 flag, u8 read, int addr, u8 data) |
| 171 | { | 172 | { |
| 172 | struct netup_ci_state *state = en50221->data; | 173 | struct netup_ci_state *state = en50221->data; |
| @@ -248,7 +249,8 @@ int netup_ci_write_attribute_mem(struct dvb_ca_en50221 *en50221, | |||
| 248 | return netup_ci_op_cam(en50221, slot, 0, 0, addr, data); | 249 | return netup_ci_op_cam(en50221, slot, 0, 0, addr, data); |
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | int netup_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr) | 252 | int netup_ci_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, |
| 253 | u8 addr) | ||
| 252 | { | 254 | { |
| 253 | return netup_ci_op_cam(en50221, slot, NETUP_CI_CTL, | 255 | return netup_ci_op_cam(en50221, slot, NETUP_CI_CTL, |
| 254 | NETUP_CI_RD, addr, 0); | 256 | NETUP_CI_RD, addr, 0); |
| @@ -295,7 +297,7 @@ int netup_ci_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot) | |||
| 295 | return 0; | 297 | return 0; |
| 296 | } | 298 | } |
| 297 | 299 | ||
| 298 | int netup_ci_set_irq(struct dvb_ca_en50221 *en50221, u8 irq_mode) | 300 | static int netup_ci_set_irq(struct dvb_ca_en50221 *en50221, u8 irq_mode) |
| 299 | { | 301 | { |
| 300 | struct netup_ci_state *state = en50221->data; | 302 | struct netup_ci_state *state = en50221->data; |
| 301 | int ret; | 303 | int ret; |
| @@ -399,7 +401,8 @@ int netup_ci_slot_status(struct cx23885_dev *dev, u32 pci_status) | |||
| 399 | return 1; | 401 | return 1; |
| 400 | } | 402 | } |
| 401 | 403 | ||
| 402 | int netup_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open) | 404 | int netup_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, |
| 405 | int slot, int open) | ||
| 403 | { | 406 | { |
| 404 | struct netup_ci_state *state = en50221->data; | 407 | struct netup_ci_state *state = en50221->data; |
| 405 | 408 | ||
diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index 795169237e70..c6c9bd58f8be 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c | |||
| @@ -45,8 +45,10 @@ | |||
| 45 | 45 | ||
| 46 | #define AUDIO_SRAM_CHANNEL SRAM_CH07 | 46 | #define AUDIO_SRAM_CHANNEL SRAM_CH07 |
| 47 | 47 | ||
| 48 | #define dprintk(level, fmt, arg...) if (audio_debug >= level) \ | 48 | #define dprintk(level, fmt, arg...) do { \ |
| 49 | printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg) | 49 | if (audio_debug + 1 > level) \ |
| 50 | printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg); \ | ||
| 51 | } while(0) | ||
| 50 | 52 | ||
| 51 | #define dprintk_core(level, fmt, arg...) if (audio_debug >= level) \ | 53 | #define dprintk_core(level, fmt, arg...) if (audio_debug >= level) \ |
| 52 | printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg) | 54 | printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg) |
diff --git a/drivers/media/pci/cx23885/cx23885-av.c b/drivers/media/pci/cx23885/cx23885-av.c index 134ebddd860f..e958a01fd554 100644 --- a/drivers/media/pci/cx23885/cx23885-av.c +++ b/drivers/media/pci/cx23885/cx23885-av.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include "cx23885.h" | 24 | #include "cx23885.h" |
| 25 | #include "cx23885-av.h" | ||
| 25 | 26 | ||
| 26 | void cx23885_av_work_handler(struct work_struct *work) | 27 | void cx23885_av_work_handler(struct work_struct *work) |
| 27 | { | 28 | { |
diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 5acdf954ff6b..6277e145f0b8 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c | |||
| @@ -1427,7 +1427,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev) | |||
| 1427 | } | 1427 | } |
| 1428 | } | 1428 | } |
| 1429 | 1429 | ||
| 1430 | int netup_jtag_io(void *device, int tms, int tdi, int read_tdo) | 1430 | static int netup_jtag_io(void *device, int tms, int tdi, int read_tdo) |
| 1431 | { | 1431 | { |
| 1432 | int data; | 1432 | int data; |
| 1433 | int tdo = 0; | 1433 | int tdo = 0; |
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 697728f09430..f0416a668b4c 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c | |||
| @@ -303,7 +303,7 @@ static struct sram_channel cx23887_sram_channels[] = { | |||
| 303 | }, | 303 | }, |
| 304 | }; | 304 | }; |
| 305 | 305 | ||
| 306 | void cx23885_irq_add(struct cx23885_dev *dev, u32 mask) | 306 | static void cx23885_irq_add(struct cx23885_dev *dev, u32 mask) |
| 307 | { | 307 | { |
| 308 | unsigned long flags; | 308 | unsigned long flags; |
| 309 | spin_lock_irqsave(&dev->pci_irqmask_lock, flags); | 309 | spin_lock_irqsave(&dev->pci_irqmask_lock, flags); |
| @@ -1516,8 +1516,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, | |||
| 1516 | buf = list_entry(q->queued.next, struct cx23885_buffer, | 1516 | buf = list_entry(q->queued.next, struct cx23885_buffer, |
| 1517 | vb.queue); | 1517 | vb.queue); |
| 1518 | if (NULL == prev) { | 1518 | if (NULL == prev) { |
| 1519 | list_del(&buf->vb.queue); | 1519 | list_move_tail(&buf->vb.queue, &q->active); |
| 1520 | list_add_tail(&buf->vb.queue, &q->active); | ||
| 1521 | cx23885_start_dma(port, q, buf); | 1520 | cx23885_start_dma(port, q, buf); |
| 1522 | buf->vb.state = VIDEOBUF_ACTIVE; | 1521 | buf->vb.state = VIDEOBUF_ACTIVE; |
| 1523 | buf->count = q->count++; | 1522 | buf->count = q->count++; |
| @@ -1528,8 +1527,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, | |||
| 1528 | } else if (prev->vb.width == buf->vb.width && | 1527 | } else if (prev->vb.width == buf->vb.width && |
| 1529 | prev->vb.height == buf->vb.height && | 1528 | prev->vb.height == buf->vb.height && |
| 1530 | prev->fmt == buf->fmt) { | 1529 | prev->fmt == buf->fmt) { |
| 1531 | list_del(&buf->vb.queue); | 1530 | list_move_tail(&buf->vb.queue, &q->active); |
| 1532 | list_add_tail(&buf->vb.queue, &q->active); | ||
| 1533 | buf->vb.state = VIDEOBUF_ACTIVE; | 1531 | buf->vb.state = VIDEOBUF_ACTIVE; |
| 1534 | buf->count = q->count++; | 1532 | buf->count = q->count++; |
| 1535 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 1533 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
| @@ -2088,8 +2086,8 @@ void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput) | |||
| 2088 | /* TODO: 23-19 */ | 2086 | /* TODO: 23-19 */ |
| 2089 | } | 2087 | } |
| 2090 | 2088 | ||
| 2091 | static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | 2089 | static int cx23885_initdev(struct pci_dev *pci_dev, |
| 2092 | const struct pci_device_id *pci_id) | 2090 | const struct pci_device_id *pci_id) |
| 2093 | { | 2091 | { |
| 2094 | struct cx23885_dev *dev; | 2092 | struct cx23885_dev *dev; |
| 2095 | int err; | 2093 | int err; |
| @@ -2169,7 +2167,7 @@ fail_free: | |||
| 2169 | return err; | 2167 | return err; |
| 2170 | } | 2168 | } |
| 2171 | 2169 | ||
| 2172 | static void __devexit cx23885_finidev(struct pci_dev *pci_dev) | 2170 | static void cx23885_finidev(struct pci_dev *pci_dev) |
| 2173 | { | 2171 | { |
| 2174 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); | 2172 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 2175 | struct cx23885_dev *dev = to_cx23885(v4l2_dev); | 2173 | struct cx23885_dev *dev = to_cx23885(v4l2_dev); |
| @@ -2212,7 +2210,7 @@ static struct pci_driver cx23885_pci_driver = { | |||
| 2212 | .name = "cx23885", | 2210 | .name = "cx23885", |
| 2213 | .id_table = cx23885_pci_tbl, | 2211 | .id_table = cx23885_pci_tbl, |
| 2214 | .probe = cx23885_initdev, | 2212 | .probe = cx23885_initdev, |
| 2215 | .remove = __devexit_p(cx23885_finidev), | 2213 | .remove = cx23885_finidev, |
| 2216 | /* TODO */ | 2214 | /* TODO */ |
| 2217 | .suspend = NULL, | 2215 | .suspend = NULL, |
| 2218 | .resume = NULL, | 2216 | .resume = NULL, |
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 4379d8a6dad5..2f5b902e63ae 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | |||
| @@ -659,7 +659,7 @@ static struct mt2063_config terratec_mt2063_config[] = { | |||
| 659 | }, | 659 | }, |
| 660 | }; | 660 | }; |
| 661 | 661 | ||
| 662 | int netup_altera_fpga_rw(void *device, int flag, int data, int read) | 662 | static int netup_altera_fpga_rw(void *device, int flag, int data, int read) |
| 663 | { | 663 | { |
| 664 | struct cx23885_dev *dev = (struct cx23885_dev *)device; | 664 | struct cx23885_dev *dev = (struct cx23885_dev *)device; |
| 665 | unsigned long timeout = jiffies + msecs_to_jiffies(1); | 665 | unsigned long timeout = jiffies + msecs_to_jiffies(1); |
diff --git a/drivers/media/pci/cx23885/cx23885-f300.c b/drivers/media/pci/cx23885/cx23885-f300.c index 93998f220986..5444cc526008 100644 --- a/drivers/media/pci/cx23885/cx23885-f300.c +++ b/drivers/media/pci/cx23885/cx23885-f300.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #include "cx23885.h" | 31 | #include "cx23885.h" |
| 32 | #include "cx23885-f300.h" | ||
| 32 | 33 | ||
| 33 | #define F300_DATA GPIO_0 | 34 | #define F300_DATA GPIO_0 |
| 34 | #define F300_RESET GPIO_1 | 35 | #define F300_RESET GPIO_1 |
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index 2c925f77cf2a..4f1055a194b5 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <media/v4l2-subdev.h> | 40 | #include <media/v4l2-subdev.h> |
| 41 | 41 | ||
| 42 | #include "cx23885.h" | 42 | #include "cx23885.h" |
| 43 | #include "cx23885-input.h" | ||
| 43 | 44 | ||
| 44 | #define MODULE_NAME "cx23885" | 45 | #define MODULE_NAME "cx23885" |
| 45 | 46 | ||
| @@ -270,21 +271,21 @@ int cx23885_input_init(struct cx23885_dev *dev) | |||
| 270 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | 271 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
| 271 | /* Integrated CX2388[58] IR controller */ | 272 | /* Integrated CX2388[58] IR controller */ |
| 272 | driver_type = RC_DRIVER_IR_RAW; | 273 | driver_type = RC_DRIVER_IR_RAW; |
| 273 | allowed_protos = RC_TYPE_ALL; | 274 | allowed_protos = RC_BIT_ALL; |
| 274 | /* The grey Hauppauge RC-5 remote */ | 275 | /* The grey Hauppauge RC-5 remote */ |
| 275 | rc_map = RC_MAP_HAUPPAUGE; | 276 | rc_map = RC_MAP_HAUPPAUGE; |
| 276 | break; | 277 | break; |
| 277 | case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: | 278 | case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: |
| 278 | /* Integrated CX23885 IR controller */ | 279 | /* Integrated CX23885 IR controller */ |
| 279 | driver_type = RC_DRIVER_IR_RAW; | 280 | driver_type = RC_DRIVER_IR_RAW; |
| 280 | allowed_protos = RC_TYPE_NEC; | 281 | allowed_protos = RC_BIT_NEC; |
| 281 | /* The grey Terratec remote with orange buttons */ | 282 | /* The grey Terratec remote with orange buttons */ |
| 282 | rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; | 283 | rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; |
| 283 | break; | 284 | break; |
| 284 | case CX23885_BOARD_TEVII_S470: | 285 | case CX23885_BOARD_TEVII_S470: |
| 285 | /* Integrated CX23885 IR controller */ | 286 | /* Integrated CX23885 IR controller */ |
| 286 | driver_type = RC_DRIVER_IR_RAW; | 287 | driver_type = RC_DRIVER_IR_RAW; |
| 287 | allowed_protos = RC_TYPE_ALL; | 288 | allowed_protos = RC_BIT_ALL; |
| 288 | /* A guess at the remote */ | 289 | /* A guess at the remote */ |
| 289 | rc_map = RC_MAP_TEVII_NEC; | 290 | rc_map = RC_MAP_TEVII_NEC; |
| 290 | break; | 291 | break; |
diff --git a/drivers/media/pci/cx23885/cx23885-input.h b/drivers/media/pci/cx23885/cx23885-input.h index 75ef15d3f523..87dc44e69977 100644 --- a/drivers/media/pci/cx23885/cx23885-input.h +++ b/drivers/media/pci/cx23885/cx23885-input.h | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #ifndef _CX23885_INPUT_H_ | 24 | #ifndef _CX23885_INPUT_H_ |
| 25 | #define _CX23885_INPUT_H_ | 25 | #define _CX23885_INPUT_H_ |
| 26 | int cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events); | 26 | void cx23885_input_rx_work_handler(struct cx23885_dev *dev, u32 events); |
| 27 | 27 | ||
| 28 | int cx23885_input_init(struct cx23885_dev *dev); | 28 | int cx23885_input_init(struct cx23885_dev *dev); |
| 29 | void cx23885_input_fini(struct cx23885_dev *dev); | 29 | void cx23885_input_fini(struct cx23885_dev *dev); |
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.c b/drivers/media/pci/cx23885/cx23885-ioctl.c index 44812ca78899..ea9a614f3bbf 100644 --- a/drivers/media/pci/cx23885/cx23885-ioctl.c +++ b/drivers/media/pci/cx23885/cx23885-ioctl.c | |||
| @@ -22,6 +22,8 @@ | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include "cx23885.h" | 24 | #include "cx23885.h" |
| 25 | #include "cx23885-ioctl.h" | ||
| 26 | |||
| 25 | #include <media/v4l2-chip-ident.h> | 27 | #include <media/v4l2-chip-ident.h> |
| 26 | 28 | ||
| 27 | int cx23885_g_chip_ident(struct file *file, void *fh, | 29 | int cx23885_g_chip_ident(struct file *file, void *fh, |
diff --git a/drivers/media/pci/cx23885/cx23885-ir.c b/drivers/media/pci/cx23885/cx23885-ir.c index 7125247dd255..bfef19359291 100644 --- a/drivers/media/pci/cx23885/cx23885-ir.c +++ b/drivers/media/pci/cx23885/cx23885-ir.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <media/v4l2-device.h> | 24 | #include <media/v4l2-device.h> |
| 25 | 25 | ||
| 26 | #include "cx23885.h" | 26 | #include "cx23885.h" |
| 27 | #include "cx23885-ir.h" | ||
| 27 | #include "cx23885-input.h" | 28 | #include "cx23885-input.h" |
| 28 | 29 | ||
| 29 | #define CX23885_IR_RX_FIFO_SERVICE_REQ 0 | 30 | #define CX23885_IR_RX_FIFO_SERVICE_REQ 0 |
diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c index c2bc39c58f82..c4bd1e95d33f 100644 --- a/drivers/media/pci/cx23885/cx23888-ir.c +++ b/drivers/media/pci/cx23885/cx23888-ir.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <media/rc-core.h> | 29 | #include <media/rc-core.h> |
| 30 | 30 | ||
| 31 | #include "cx23885.h" | 31 | #include "cx23885.h" |
| 32 | #include "cx23888-ir.h" | ||
| 32 | 33 | ||
| 33 | static unsigned int ir_888_debug; | 34 | static unsigned int ir_888_debug; |
| 34 | module_param(ir_888_debug, int, 0644); | 35 | module_param(ir_888_debug, int, 0644); |
diff --git a/drivers/media/pci/cx23885/netup-init.c b/drivers/media/pci/cx23885/netup-init.c index f4893e69cd89..0044fef7ca24 100644 --- a/drivers/media/pci/cx23885/netup-init.c +++ b/drivers/media/pci/cx23885/netup-init.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include "cx23885.h" | 26 | #include "cx23885.h" |
| 27 | #include "netup-init.h" | ||
| 27 | 28 | ||
| 28 | static void i2c_av_write(struct i2c_adapter *i2c, u16 reg, u8 val) | 29 | static void i2c_av_write(struct i2c_adapter *i2c, u16 reg, u8 val) |
| 29 | { | 30 | { |
diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index 8b2a99975c23..87491ca05ee5 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c | |||
| @@ -44,7 +44,7 @@ MODULE_LICENSE("GPL"); | |||
| 44 | static int _intr_msk = FLD_AUD_SRC_RISCI1 | FLD_AUD_SRC_OF | | 44 | static int _intr_msk = FLD_AUD_SRC_RISCI1 | FLD_AUD_SRC_OF | |
| 45 | FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR; | 45 | FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR; |
| 46 | 46 | ||
| 47 | int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, | 47 | static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, |
| 48 | struct sram_channel *ch, | 48 | struct sram_channel *ch, |
| 49 | unsigned int bpl, u32 risc) | 49 | unsigned int bpl, u32 risc) |
| 50 | { | 50 | { |
| @@ -133,7 +133,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, | |||
| 133 | return rp; | 133 | return rp; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev, | 136 | static int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev, |
| 137 | struct pci_dev *pci, | 137 | struct pci_dev *pci, |
| 138 | unsigned int bpl, unsigned int lines) | 138 | unsigned int bpl, unsigned int lines) |
| 139 | { | 139 | { |
| @@ -197,7 +197,7 @@ int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev, | |||
| 197 | return 0; | 197 | return 0; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | void cx25821_free_memory_audio(struct cx25821_dev *dev) | 200 | static void cx25821_free_memory_audio(struct cx25821_dev *dev) |
| 201 | { | 201 | { |
| 202 | if (dev->_risc_virt_addr) { | 202 | if (dev->_risc_virt_addr) { |
| 203 | pci_free_consistent(dev->pci, dev->_audiorisc_size, | 203 | pci_free_consistent(dev->pci, dev->_audiorisc_size, |
| @@ -256,7 +256,7 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev) | |||
| 256 | cx25821_free_memory_audio(dev); | 256 | cx25821_free_memory_audio(dev); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | int cx25821_get_audio_data(struct cx25821_dev *dev, | 259 | static int cx25821_get_audio_data(struct cx25821_dev *dev, |
| 260 | struct sram_channel *sram_ch) | 260 | struct sram_channel *sram_ch) |
| 261 | { | 261 | { |
| 262 | struct file *myfile; | 262 | struct file *myfile; |
| @@ -351,7 +351,7 @@ static void cx25821_audioups_handler(struct work_struct *work) | |||
| 351 | sram_channels); | 351 | sram_channels); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | int cx25821_openfile_audio(struct cx25821_dev *dev, | 354 | static int cx25821_openfile_audio(struct cx25821_dev *dev, |
| 355 | struct sram_channel *sram_ch) | 355 | struct sram_channel *sram_ch) |
| 356 | { | 356 | { |
| 357 | struct file *myfile; | 357 | struct file *myfile; |
| @@ -490,7 +490,7 @@ error: | |||
| 490 | return ret; | 490 | return ret; |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, | 493 | static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, |
| 494 | u32 status) | 494 | u32 status) |
| 495 | { | 495 | { |
| 496 | int i = 0; | 496 | int i = 0; |
| @@ -634,8 +634,8 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev, | |||
| 634 | 634 | ||
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, | 637 | static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, |
| 638 | struct sram_channel *sram_ch) | 638 | struct sram_channel *sram_ch) |
| 639 | { | 639 | { |
| 640 | u32 tmp = 0; | 640 | u32 tmp = 0; |
| 641 | int err = 0; | 641 | int err = 0; |
| @@ -700,9 +700,7 @@ fail_irq: | |||
| 700 | int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) | 700 | int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) |
| 701 | { | 701 | { |
| 702 | struct sram_channel *sram_ch; | 702 | struct sram_channel *sram_ch; |
| 703 | int retval = 0; | ||
| 704 | int err = 0; | 703 | int err = 0; |
| 705 | int str_length = 0; | ||
| 706 | 704 | ||
| 707 | if (dev->_audio_is_running) { | 705 | if (dev->_audio_is_running) { |
| 708 | pr_warn("Audio Channel is still running so return!\n"); | 706 | pr_warn("Audio Channel is still running so return!\n"); |
| @@ -731,27 +729,29 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) | |||
| 731 | _line_size = AUDIO_LINE_SIZE; | 729 | _line_size = AUDIO_LINE_SIZE; |
| 732 | 730 | ||
| 733 | if (dev->input_audiofilename) { | 731 | if (dev->input_audiofilename) { |
| 734 | str_length = strlen(dev->input_audiofilename); | 732 | dev->_audiofilename = kstrdup(dev->input_audiofilename, |
| 735 | dev->_audiofilename = kmemdup(dev->input_audiofilename, | 733 | GFP_KERNEL); |
| 736 | str_length + 1, GFP_KERNEL); | ||
| 737 | 734 | ||
| 738 | if (!dev->_audiofilename) | 735 | if (!dev->_audiofilename) { |
| 736 | err = -ENOMEM; | ||
| 739 | goto error; | 737 | goto error; |
| 738 | } | ||
| 740 | 739 | ||
| 741 | /* Default if filename is empty string */ | 740 | /* Default if filename is empty string */ |
| 742 | if (strcmp(dev->input_audiofilename, "") == 0) | 741 | if (strcmp(dev->input_audiofilename, "") == 0) |
| 743 | dev->_audiofilename = "/root/audioGOOD.wav"; | 742 | dev->_audiofilename = "/root/audioGOOD.wav"; |
| 744 | } else { | 743 | } else { |
| 745 | str_length = strlen(_defaultAudioName); | 744 | dev->_audiofilename = kstrdup(_defaultAudioName, |
| 746 | dev->_audiofilename = kmemdup(_defaultAudioName, | 745 | GFP_KERNEL); |
| 747 | str_length + 1, GFP_KERNEL); | ||
| 748 | 746 | ||
| 749 | if (!dev->_audiofilename) | 747 | if (!dev->_audiofilename) { |
| 748 | err = -ENOMEM; | ||
| 750 | goto error; | 749 | goto error; |
| 750 | } | ||
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | retval = cx25821_sram_channel_setup_upstream_audio(dev, sram_ch, | 753 | cx25821_sram_channel_setup_upstream_audio(dev, sram_ch, |
| 754 | _line_size, 0); | 754 | _line_size, 0); |
| 755 | 755 | ||
| 756 | dev->audio_upstream_riscbuf_size = | 756 | dev->audio_upstream_riscbuf_size = |
| 757 | AUDIO_RISC_DMA_BUF_SIZE * NUM_AUDIO_PROGS + | 757 | AUDIO_RISC_DMA_BUF_SIZE * NUM_AUDIO_PROGS + |
| @@ -759,9 +759,9 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) | |||
| 759 | dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS; | 759 | dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS; |
| 760 | 760 | ||
| 761 | /* Allocating buffers and prepare RISC program */ | 761 | /* Allocating buffers and prepare RISC program */ |
| 762 | retval = cx25821_audio_upstream_buffer_prepare(dev, sram_ch, | 762 | err = cx25821_audio_upstream_buffer_prepare(dev, sram_ch, |
| 763 | _line_size); | 763 | _line_size); |
| 764 | if (retval < 0) { | 764 | if (err < 0) { |
| 765 | pr_err("%s: Failed to set up Audio upstream buffers!\n", | 765 | pr_err("%s: Failed to set up Audio upstream buffers!\n", |
| 766 | dev->name); | 766 | dev->name); |
| 767 | goto error; | 767 | goto error; |
diff --git a/drivers/media/pci/cx25821/cx25821-biffuncs.h b/drivers/media/pci/cx25821/cx25821-biffuncs.h index 9326a7c729ec..937f5a70fb7a 100644 --- a/drivers/media/pci/cx25821/cx25821-biffuncs.h +++ b/drivers/media/pci/cx25821/cx25821-biffuncs.h | |||
| @@ -25,17 +25,17 @@ | |||
| 25 | 25 | ||
| 26 | #define SetBit(Bit) (1 << Bit) | 26 | #define SetBit(Bit) (1 << Bit) |
| 27 | 27 | ||
| 28 | inline u8 getBit(u32 sample, u8 index) | 28 | static inline u8 getBit(u32 sample, u8 index) |
| 29 | { | 29 | { |
| 30 | return (u8) ((sample >> index) & 1); | 30 | return (u8) ((sample >> index) & 1); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | inline u32 clearBitAtPos(u32 value, u8 bit) | 33 | static inline u32 clearBitAtPos(u32 value, u8 bit) |
| 34 | { | 34 | { |
| 35 | return value & ~(1 << bit); | 35 | return value & ~(1 << bit); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | inline u32 setBitAtPos(u32 sample, u8 bit) | 38 | static inline u32 setBitAtPos(u32 sample, u8 bit) |
| 39 | { | 39 | { |
| 40 | sample |= (1 << bit); | 40 | sample |= (1 << bit); |
| 41 | return sample; | 41 | return sample; |
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c index f11f6f07e915..1884e2cc35e9 100644 --- a/drivers/media/pci/cx25821/cx25821-core.c +++ b/drivers/media/pci/cx25821/cx25821-core.c | |||
| @@ -1361,8 +1361,8 @@ struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci) | |||
| 1361 | } | 1361 | } |
| 1362 | EXPORT_SYMBOL(cx25821_dev_get); | 1362 | EXPORT_SYMBOL(cx25821_dev_get); |
| 1363 | 1363 | ||
| 1364 | static int __devinit cx25821_initdev(struct pci_dev *pci_dev, | 1364 | static int cx25821_initdev(struct pci_dev *pci_dev, |
| 1365 | const struct pci_device_id *pci_id) | 1365 | const struct pci_device_id *pci_id) |
| 1366 | { | 1366 | { |
| 1367 | struct cx25821_dev *dev; | 1367 | struct cx25821_dev *dev; |
| 1368 | int err = 0; | 1368 | int err = 0; |
| @@ -1433,7 +1433,7 @@ fail_free: | |||
| 1433 | return err; | 1433 | return err; |
| 1434 | } | 1434 | } |
| 1435 | 1435 | ||
| 1436 | static void __devexit cx25821_finidev(struct pci_dev *pci_dev) | 1436 | static void cx25821_finidev(struct pci_dev *pci_dev) |
| 1437 | { | 1437 | { |
| 1438 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); | 1438 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 1439 | struct cx25821_dev *dev = get_cx25821(v4l2_dev); | 1439 | struct cx25821_dev *dev = get_cx25821(v4l2_dev); |
| @@ -1478,7 +1478,7 @@ static struct pci_driver cx25821_pci_driver = { | |||
| 1478 | .name = "cx25821", | 1478 | .name = "cx25821", |
| 1479 | .id_table = cx25821_pci_tbl, | 1479 | .id_table = cx25821_pci_tbl, |
| 1480 | .probe = cx25821_initdev, | 1480 | .probe = cx25821_initdev, |
| 1481 | .remove = __devexit_p(cx25821_finidev), | 1481 | .remove = cx25821_finidev, |
| 1482 | /* TODO */ | 1482 | /* TODO */ |
| 1483 | .suspend = NULL, | 1483 | .suspend = NULL, |
| 1484 | .resume = NULL, | 1484 | .resume = NULL, |
diff --git a/drivers/media/pci/cx25821/cx25821-i2c.c b/drivers/media/pci/cx25821/cx25821-i2c.c index 9844549764c9..a8dc945bbe17 100644 --- a/drivers/media/pci/cx25821/cx25821-i2c.c +++ b/drivers/media/pci/cx25821/cx25821-i2c.c | |||
| @@ -329,7 +329,8 @@ int cx25821_i2c_unregister(struct cx25821_i2c *bus) | |||
| 329 | return 0; | 329 | return 0; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | void cx25821_av_clk(struct cx25821_dev *dev, int enable) | 332 | #if 0 /* Currently unused */ |
| 333 | static void cx25821_av_clk(struct cx25821_dev *dev, int enable) | ||
| 333 | { | 334 | { |
| 334 | /* write 0 to bus 2 addr 0x144 via i2x_xfer() */ | 335 | /* write 0 to bus 2 addr 0x144 via i2x_xfer() */ |
| 335 | char buffer[3]; | 336 | char buffer[3]; |
| @@ -351,6 +352,7 @@ void cx25821_av_clk(struct cx25821_dev *dev, int enable) | |||
| 351 | 352 | ||
| 352 | i2c_xfer(&dev->i2c_bus[0].i2c_adap, &msg, 1); | 353 | i2c_xfer(&dev->i2c_bus[0].i2c_adap, &msg, 1); |
| 353 | } | 354 | } |
| 355 | #endif | ||
| 354 | 356 | ||
| 355 | int cx25821_i2c_read(struct cx25821_i2c *bus, u16 reg_addr, int *value) | 357 | int cx25821_i2c_read(struct cx25821_i2c *bus, u16 reg_addr, int *value) |
| 356 | { | 358 | { |
diff --git a/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c index d33fc1a23030..cf2723c7197f 100644 --- a/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c +++ b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c | |||
| @@ -123,10 +123,11 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev, | |||
| 123 | return rp; | 123 | return rp; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, | 126 | static int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, |
| 127 | struct pci_dev *pci, | 127 | struct pci_dev *pci, |
| 128 | unsigned int top_offset, unsigned int bpl, | 128 | unsigned int top_offset, |
| 129 | unsigned int lines) | 129 | unsigned int bpl, |
| 130 | unsigned int lines) | ||
| 130 | { | 131 | { |
| 131 | __le32 *rp; | 132 | __le32 *rp; |
| 132 | int fifo_enable = 0; | 133 | int fifo_enable = 0; |
| @@ -255,7 +256,8 @@ void cx25821_free_mem_upstream_ch2(struct cx25821_dev *dev) | |||
| 255 | } | 256 | } |
| 256 | } | 257 | } |
| 257 | 258 | ||
| 258 | int cx25821_get_frame_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) | 259 | static int cx25821_get_frame_ch2(struct cx25821_dev *dev, |
| 260 | struct sram_channel *sram_ch) | ||
| 259 | { | 261 | { |
| 260 | struct file *myfile; | 262 | struct file *myfile; |
| 261 | int frame_index_temp = dev->_frame_index_ch2; | 263 | int frame_index_temp = dev->_frame_index_ch2; |
| @@ -360,7 +362,8 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work) | |||
| 360 | _channel2_upstream_select].sram_channels); | 362 | _channel2_upstream_select].sram_channels); |
| 361 | } | 363 | } |
| 362 | 364 | ||
| 363 | int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) | 365 | static int cx25821_openfile_ch2(struct cx25821_dev *dev, |
| 366 | struct sram_channel *sram_ch) | ||
| 364 | { | 367 | { |
| 365 | struct file *myfile; | 368 | struct file *myfile; |
| 366 | int i = 0, j = 0; | 369 | int i = 0, j = 0; |
| @@ -507,8 +510,9 @@ error: | |||
| 507 | return ret; | 510 | return ret; |
| 508 | } | 511 | } |
| 509 | 512 | ||
| 510 | int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num, | 513 | static int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, |
| 511 | u32 status) | 514 | int chan_num, |
| 515 | u32 status) | ||
| 512 | { | 516 | { |
| 513 | u32 int_msk_tmp; | 517 | u32 int_msk_tmp; |
| 514 | struct sram_channel *channel = dev->channels[chan_num].sram_channels; | 518 | struct sram_channel *channel = dev->channels[chan_num].sram_channels; |
| @@ -647,8 +651,8 @@ static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev, | |||
| 647 | cx_write(ch->vid_cdt_size, VID_CDT_SIZE >> 3); | 651 | cx_write(ch->vid_cdt_size, VID_CDT_SIZE >> 3); |
| 648 | } | 652 | } |
| 649 | 653 | ||
| 650 | int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, | 654 | static int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, |
| 651 | struct sram_channel *sram_ch) | 655 | struct sram_channel *sram_ch) |
| 652 | { | 656 | { |
| 653 | u32 tmp = 0; | 657 | u32 tmp = 0; |
| 654 | int err = 0; | 658 | int err = 0; |
| @@ -704,11 +708,9 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, | |||
| 704 | { | 708 | { |
| 705 | struct sram_channel *sram_ch; | 709 | struct sram_channel *sram_ch; |
| 706 | u32 tmp; | 710 | u32 tmp; |
| 707 | int retval = 0; | ||
| 708 | int err = 0; | 711 | int err = 0; |
| 709 | int data_frame_size = 0; | 712 | int data_frame_size = 0; |
| 710 | int risc_buffer_size = 0; | 713 | int risc_buffer_size = 0; |
| 711 | int str_length = 0; | ||
| 712 | 714 | ||
| 713 | if (dev->_is_running_ch2) { | 715 | if (dev->_is_running_ch2) { |
| 714 | pr_info("Video Channel is still running so return!\n"); | 716 | pr_info("Video Channel is still running so return!\n"); |
| @@ -744,20 +746,16 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, | |||
| 744 | risc_buffer_size = dev->_isNTSC_ch2 ? | 746 | risc_buffer_size = dev->_isNTSC_ch2 ? |
| 745 | NTSC_RISC_BUF_SIZE : PAL_RISC_BUF_SIZE; | 747 | NTSC_RISC_BUF_SIZE : PAL_RISC_BUF_SIZE; |
| 746 | 748 | ||
| 747 | if (dev->input_filename_ch2) { | 749 | if (dev->input_filename_ch2) |
| 748 | str_length = strlen(dev->input_filename_ch2); | 750 | dev->_filename_ch2 = kstrdup(dev->input_filename_ch2, |
| 749 | dev->_filename_ch2 = kmemdup(dev->input_filename_ch2, | 751 | GFP_KERNEL); |
| 750 | str_length + 1, GFP_KERNEL); | 752 | else |
| 751 | 753 | dev->_filename_ch2 = kstrdup(dev->_defaultname_ch2, | |
| 752 | if (!dev->_filename_ch2) | 754 | GFP_KERNEL); |
| 753 | goto error; | ||
| 754 | } else { | ||
| 755 | str_length = strlen(dev->_defaultname_ch2); | ||
| 756 | dev->_filename_ch2 = kmemdup(dev->_defaultname_ch2, | ||
| 757 | str_length + 1, GFP_KERNEL); | ||
| 758 | 755 | ||
| 759 | if (!dev->_filename_ch2) | 756 | if (!dev->_filename_ch2) { |
| 760 | goto error; | 757 | err = -ENOENT; |
| 758 | goto error; | ||
| 761 | } | 759 | } |
| 762 | 760 | ||
| 763 | /* Default if filename is empty string */ | 761 | /* Default if filename is empty string */ |
| @@ -773,7 +771,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, | |||
| 773 | } | 771 | } |
| 774 | } | 772 | } |
| 775 | 773 | ||
| 776 | retval = cx25821_sram_channel_setup_upstream(dev, sram_ch, | 774 | err = cx25821_sram_channel_setup_upstream(dev, sram_ch, |
| 777 | dev->_line_size_ch2, 0); | 775 | dev->_line_size_ch2, 0); |
| 778 | 776 | ||
| 779 | /* setup fifo + format */ | 777 | /* setup fifo + format */ |
| @@ -783,9 +781,9 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, | |||
| 783 | dev->upstream_databuf_size_ch2 = data_frame_size * 2; | 781 | dev->upstream_databuf_size_ch2 = data_frame_size * 2; |
| 784 | 782 | ||
| 785 | /* Allocating buffers and prepare RISC program */ | 783 | /* Allocating buffers and prepare RISC program */ |
| 786 | retval = cx25821_upstream_buffer_prepare_ch2(dev, sram_ch, | 784 | err = cx25821_upstream_buffer_prepare_ch2(dev, sram_ch, |
| 787 | dev->_line_size_ch2); | 785 | dev->_line_size_ch2); |
| 788 | if (retval < 0) { | 786 | if (err < 0) { |
| 789 | pr_err("%s: Failed to set up Video upstream buffers!\n", | 787 | pr_err("%s: Failed to set up Video upstream buffers!\n", |
| 790 | dev->name); | 788 | dev->name); |
| 791 | goto error; | 789 | goto error; |
diff --git a/drivers/media/pci/cx25821/cx25821-video-upstream.c b/drivers/media/pci/cx25821/cx25821-video-upstream.c index 6759fff8eb64..7fc97110d973 100644 --- a/drivers/media/pci/cx25821/cx25821-video-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-video-upstream.c | |||
| @@ -173,10 +173,10 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, | |||
| 173 | return rp; | 173 | return rp; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, | 176 | static int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, |
| 177 | struct pci_dev *pci, | 177 | struct pci_dev *pci, |
| 178 | unsigned int top_offset, | 178 | unsigned int top_offset, |
| 179 | unsigned int bpl, unsigned int lines) | 179 | unsigned int bpl, unsigned int lines) |
| 180 | { | 180 | { |
| 181 | __le32 *rp; | 181 | __le32 *rp; |
| 182 | int fifo_enable = 0; | 182 | int fifo_enable = 0; |
| @@ -300,7 +300,8 @@ void cx25821_free_mem_upstream_ch1(struct cx25821_dev *dev) | |||
| 300 | } | 300 | } |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) | 303 | static int cx25821_get_frame(struct cx25821_dev *dev, |
| 304 | struct sram_channel *sram_ch) | ||
| 304 | { | 305 | { |
| 305 | struct file *myfile; | 306 | struct file *myfile; |
| 306 | int frame_index_temp = dev->_frame_index; | 307 | int frame_index_temp = dev->_frame_index; |
| @@ -405,7 +406,8 @@ static void cx25821_vidups_handler(struct work_struct *work) | |||
| 405 | sram_channels); | 406 | sram_channels); |
| 406 | } | 407 | } |
| 407 | 408 | ||
| 408 | int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) | 409 | static int cx25821_openfile(struct cx25821_dev *dev, |
| 410 | struct sram_channel *sram_ch) | ||
| 409 | { | 411 | { |
| 410 | struct file *myfile; | 412 | struct file *myfile; |
| 411 | int i = 0, j = 0; | 413 | int i = 0, j = 0; |
| @@ -486,8 +488,9 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) | |||
| 486 | return 0; | 488 | return 0; |
| 487 | } | 489 | } |
| 488 | 490 | ||
| 489 | int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, | 491 | static int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, |
| 490 | struct sram_channel *sram_ch, int bpl) | 492 | struct sram_channel *sram_ch, |
| 493 | int bpl) | ||
| 491 | { | 494 | { |
| 492 | int ret = 0; | 495 | int ret = 0; |
| 493 | dma_addr_t dma_addr; | 496 | dma_addr_t dma_addr; |
| @@ -548,8 +551,8 @@ error: | |||
| 548 | return ret; | 551 | return ret; |
| 549 | } | 552 | } |
| 550 | 553 | ||
| 551 | int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, | 554 | static int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, |
| 552 | u32 status) | 555 | u32 status) |
| 553 | { | 556 | { |
| 554 | u32 int_msk_tmp; | 557 | u32 int_msk_tmp; |
| 555 | struct sram_channel *channel = dev->channels[chan_num].sram_channels; | 558 | struct sram_channel *channel = dev->channels[chan_num].sram_channels; |
| @@ -664,8 +667,9 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id) | |||
| 664 | return IRQ_RETVAL(handled); | 667 | return IRQ_RETVAL(handled); |
| 665 | } | 668 | } |
| 666 | 669 | ||
| 667 | void cx25821_set_pixelengine(struct cx25821_dev *dev, struct sram_channel *ch, | 670 | static void cx25821_set_pixelengine(struct cx25821_dev *dev, |
| 668 | int pix_format) | 671 | struct sram_channel *ch, |
| 672 | int pix_format) | ||
| 669 | { | 673 | { |
| 670 | int width = WIDTH_D1; | 674 | int width = WIDTH_D1; |
| 671 | int height = dev->_lines_count; | 675 | int height = dev->_lines_count; |
| @@ -696,8 +700,8 @@ void cx25821_set_pixelengine(struct cx25821_dev *dev, struct sram_channel *ch, | |||
| 696 | cx_write(ch->vid_cdt_size, VID_CDT_SIZE >> 3); | 700 | cx_write(ch->vid_cdt_size, VID_CDT_SIZE >> 3); |
| 697 | } | 701 | } |
| 698 | 702 | ||
| 699 | int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, | 703 | static int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, |
| 700 | struct sram_channel *sram_ch) | 704 | struct sram_channel *sram_ch) |
| 701 | { | 705 | { |
| 702 | u32 tmp = 0; | 706 | u32 tmp = 0; |
| 703 | int err = 0; | 707 | int err = 0; |
| @@ -753,7 +757,6 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, | |||
| 753 | { | 757 | { |
| 754 | struct sram_channel *sram_ch; | 758 | struct sram_channel *sram_ch; |
| 755 | u32 tmp; | 759 | u32 tmp; |
| 756 | int retval = 0; | ||
| 757 | int err = 0; | 760 | int err = 0; |
| 758 | int data_frame_size = 0; | 761 | int data_frame_size = 0; |
| 759 | int risc_buffer_size = 0; | 762 | int risc_buffer_size = 0; |
| @@ -796,15 +799,19 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, | |||
| 796 | dev->_filename = kmemdup(dev->input_filename, str_length + 1, | 799 | dev->_filename = kmemdup(dev->input_filename, str_length + 1, |
| 797 | GFP_KERNEL); | 800 | GFP_KERNEL); |
| 798 | 801 | ||
| 799 | if (!dev->_filename) | 802 | if (!dev->_filename) { |
| 803 | err = -ENOENT; | ||
| 800 | goto error; | 804 | goto error; |
| 805 | } | ||
| 801 | } else { | 806 | } else { |
| 802 | str_length = strlen(dev->_defaultname); | 807 | str_length = strlen(dev->_defaultname); |
| 803 | dev->_filename = kmemdup(dev->_defaultname, str_length + 1, | 808 | dev->_filename = kmemdup(dev->_defaultname, str_length + 1, |
| 804 | GFP_KERNEL); | 809 | GFP_KERNEL); |
| 805 | 810 | ||
| 806 | if (!dev->_filename) | 811 | if (!dev->_filename) { |
| 812 | err = -ENOENT; | ||
| 807 | goto error; | 813 | goto error; |
| 814 | } | ||
| 808 | } | 815 | } |
| 809 | 816 | ||
| 810 | /* Default if filename is empty string */ | 817 | /* Default if filename is empty string */ |
| @@ -828,7 +835,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, | |||
| 828 | dev->_line_size = (dev->_pixel_format == PIXEL_FRMT_422) ? | 835 | dev->_line_size = (dev->_pixel_format == PIXEL_FRMT_422) ? |
| 829 | (WIDTH_D1 * 2) : (WIDTH_D1 * 3) / 2; | 836 | (WIDTH_D1 * 2) : (WIDTH_D1 * 3) / 2; |
| 830 | 837 | ||
| 831 | retval = cx25821_sram_channel_setup_upstream(dev, sram_ch, | 838 | err = cx25821_sram_channel_setup_upstream(dev, sram_ch, |
| 832 | dev->_line_size, 0); | 839 | dev->_line_size, 0); |
| 833 | 840 | ||
| 834 | /* setup fifo + format */ | 841 | /* setup fifo + format */ |
| @@ -838,8 +845,8 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, | |||
| 838 | dev->upstream_databuf_size = data_frame_size * 2; | 845 | dev->upstream_databuf_size = data_frame_size * 2; |
| 839 | 846 | ||
| 840 | /* Allocating buffers and prepare RISC program */ | 847 | /* Allocating buffers and prepare RISC program */ |
| 841 | retval = cx25821_upstream_buffer_prepare(dev, sram_ch, dev->_line_size); | 848 | err = cx25821_upstream_buffer_prepare(dev, sram_ch, dev->_line_size); |
| 842 | if (retval < 0) { | 849 | if (err < 0) { |
| 843 | pr_err("%s: Failed to set up Video upstream buffers!\n", | 850 | pr_err("%s: Failed to set up Video upstream buffers!\n", |
| 844 | dev->name); | 851 | dev->name); |
| 845 | goto error; | 852 | goto error; |
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index 0a80245165d0..53b16dd70320 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c | |||
| @@ -291,9 +291,9 @@ int cx25821_start_video_dma(struct cx25821_dev *dev, | |||
| 291 | return 0; | 291 | return 0; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | int cx25821_restart_video_queue(struct cx25821_dev *dev, | 294 | static int cx25821_restart_video_queue(struct cx25821_dev *dev, |
| 295 | struct cx25821_dmaqueue *q, | 295 | struct cx25821_dmaqueue *q, |
| 296 | struct sram_channel *channel) | 296 | struct sram_channel *channel) |
| 297 | { | 297 | { |
| 298 | struct cx25821_buffer *buf, *prev; | 298 | struct cx25821_buffer *buf, *prev; |
| 299 | struct list_head *item; | 299 | struct list_head *item; |
| @@ -342,7 +342,7 @@ int cx25821_restart_video_queue(struct cx25821_dev *dev, | |||
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | void cx25821_vid_timeout(unsigned long data) | 345 | static void cx25821_vid_timeout(unsigned long data) |
| 346 | { | 346 | { |
| 347 | struct cx25821_data *timeout_data = (struct cx25821_data *)data; | 347 | struct cx25821_data *timeout_data = (struct cx25821_data *)data; |
| 348 | struct cx25821_dev *dev = timeout_data->dev; | 348 | struct cx25821_dev *dev = timeout_data->dev; |
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index 3aa6856ead3b..27d62623274b 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c | |||
| @@ -45,11 +45,15 @@ | |||
| 45 | #include "cx88.h" | 45 | #include "cx88.h" |
| 46 | #include "cx88-reg.h" | 46 | #include "cx88-reg.h" |
| 47 | 47 | ||
| 48 | #define dprintk(level,fmt, arg...) if (debug >= level) \ | 48 | #define dprintk(level, fmt, arg...) do { \ |
| 49 | printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg) | 49 | if (debug + 1 > level) \ |
| 50 | printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg);\ | ||
| 51 | } while(0) | ||
| 50 | 52 | ||
| 51 | #define dprintk_core(level,fmt, arg...) if (debug >= level) \ | 53 | #define dprintk_core(level, fmt, arg...) do { \ |
| 52 | printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg) | 54 | if (debug + 1 > level) \ |
| 55 | printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg);\ | ||
| 56 | } while(0) | ||
| 53 | 57 | ||
| 54 | /**************************************************************************** | 58 | /**************************************************************************** |
| 55 | Data type declarations - Can be moded to a header file later | 59 | Data type declarations - Can be moded to a header file later |
| @@ -536,7 +540,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = { | |||
| 536 | /* | 540 | /* |
| 537 | * create a PCM device | 541 | * create a PCM device |
| 538 | */ | 542 | */ |
| 539 | static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name) | 543 | static int snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name) |
| 540 | { | 544 | { |
| 541 | int err; | 545 | int err; |
| 542 | struct snd_pcm *pcm; | 546 | struct snd_pcm *pcm; |
| @@ -749,7 +753,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = { | |||
| 749 | * Only boards with eeprom and byte 1 at eeprom=1 have it | 753 | * Only boards with eeprom and byte 1 at eeprom=1 have it |
| 750 | */ | 754 | */ |
| 751 | 755 | ||
| 752 | static const struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { | 756 | static const struct pci_device_id cx88_audio_pci_tbl[] = { |
| 753 | {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, | 757 | {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, |
| 754 | {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, | 758 | {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, |
| 755 | {0, } | 759 | {0, } |
| @@ -788,10 +792,9 @@ static void snd_cx88_dev_free(struct snd_card * card) | |||
| 788 | */ | 792 | */ |
| 789 | 793 | ||
| 790 | static int devno; | 794 | static int devno; |
| 791 | static int __devinit snd_cx88_create(struct snd_card *card, | 795 | static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci, |
| 792 | struct pci_dev *pci, | 796 | snd_cx88_card_t **rchip, |
| 793 | snd_cx88_card_t **rchip, | 797 | struct cx88_core **core_ptr) |
| 794 | struct cx88_core **core_ptr) | ||
| 795 | { | 798 | { |
| 796 | snd_cx88_card_t *chip; | 799 | snd_cx88_card_t *chip; |
| 797 | struct cx88_core *core; | 800 | struct cx88_core *core; |
| @@ -858,8 +861,8 @@ static int __devinit snd_cx88_create(struct snd_card *card, | |||
| 858 | return 0; | 861 | return 0; |
| 859 | } | 862 | } |
| 860 | 863 | ||
| 861 | static int __devinit cx88_audio_initdev(struct pci_dev *pci, | 864 | static int cx88_audio_initdev(struct pci_dev *pci, |
| 862 | const struct pci_device_id *pci_id) | 865 | const struct pci_device_id *pci_id) |
| 863 | { | 866 | { |
| 864 | struct snd_card *card; | 867 | struct snd_card *card; |
| 865 | snd_cx88_card_t *chip; | 868 | snd_cx88_card_t *chip; |
| @@ -927,7 +930,7 @@ error: | |||
| 927 | /* | 930 | /* |
| 928 | * ALSA destructor | 931 | * ALSA destructor |
| 929 | */ | 932 | */ |
| 930 | static void __devexit cx88_audio_finidev(struct pci_dev *pci) | 933 | static void cx88_audio_finidev(struct pci_dev *pci) |
| 931 | { | 934 | { |
| 932 | struct cx88_audio_dev *card = pci_get_drvdata(pci); | 935 | struct cx88_audio_dev *card = pci_get_drvdata(pci); |
| 933 | 936 | ||
| @@ -946,7 +949,7 @@ static struct pci_driver cx88_audio_pci_driver = { | |||
| 946 | .name = "cx88_audio", | 949 | .name = "cx88_audio", |
| 947 | .id_table = cx88_audio_pci_tbl, | 950 | .id_table = cx88_audio_pci_tbl, |
| 948 | .probe = cx88_audio_initdev, | 951 | .probe = cx88_audio_initdev, |
| 949 | .remove = __devexit_p(cx88_audio_finidev), | 952 | .remove = cx88_audio_finidev, |
| 950 | }; | 953 | }; |
| 951 | 954 | ||
| 952 | /**************************************************************************** | 955 | /**************************************************************************** |
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c index 62184eb919e5..a6ff8a6f4fc0 100644 --- a/drivers/media/pci/cx88/cx88-blackbird.c +++ b/drivers/media/pci/cx88/cx88-blackbird.c | |||
| @@ -53,9 +53,10 @@ static unsigned int debug; | |||
| 53 | module_param(debug,int,0644); | 53 | module_param(debug,int,0644); |
| 54 | MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); | 54 | MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); |
| 55 | 55 | ||
| 56 | #define dprintk(level,fmt, arg...) if (debug >= level) \ | 56 | #define dprintk(level, fmt, arg...) do { \ |
| 57 | printk(KERN_DEBUG "%s/2-bb: " fmt, dev->core->name , ## arg) | 57 | if (debug + 1 > level) \ |
| 58 | 58 | printk(KERN_DEBUG "%s/2-bb: " fmt, dev->core->name , ## arg); \ | |
| 59 | } while(0) | ||
| 59 | 60 | ||
| 60 | /* ------------------------------------------------------------------ */ | 61 | /* ------------------------------------------------------------------ */ |
| 61 | 62 | ||
diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c index c97b174be3ab..19a58754c6e1 100644 --- a/drivers/media/pci/cx88/cx88-core.c +++ b/drivers/media/pci/cx88/cx88-core.c | |||
| @@ -646,22 +646,22 @@ int cx88_reset(struct cx88_core *core) | |||
| 646 | 646 | ||
| 647 | /* ------------------------------------------------------------------ */ | 647 | /* ------------------------------------------------------------------ */ |
| 648 | 648 | ||
| 649 | static unsigned int inline norm_swidth(v4l2_std_id norm) | 649 | static inline unsigned int norm_swidth(v4l2_std_id norm) |
| 650 | { | 650 | { |
| 651 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; | 651 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; |
| 652 | } | 652 | } |
| 653 | 653 | ||
| 654 | static unsigned int inline norm_hdelay(v4l2_std_id norm) | 654 | static inline unsigned int norm_hdelay(v4l2_std_id norm) |
| 655 | { | 655 | { |
| 656 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186; | 656 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186; |
| 657 | } | 657 | } |
| 658 | 658 | ||
| 659 | static unsigned int inline norm_vdelay(v4l2_std_id norm) | 659 | static inline unsigned int norm_vdelay(v4l2_std_id norm) |
| 660 | { | 660 | { |
| 661 | return (norm & V4L2_STD_625_50) ? 0x24 : 0x18; | 661 | return (norm & V4L2_STD_625_50) ? 0x24 : 0x18; |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | static unsigned int inline norm_fsc8(v4l2_std_id norm) | 664 | static inline unsigned int norm_fsc8(v4l2_std_id norm) |
| 665 | { | 665 | { |
| 666 | if (norm & V4L2_STD_PAL_M) | 666 | if (norm & V4L2_STD_PAL_M) |
| 667 | return 28604892; // 3.575611 MHz | 667 | return 28604892; // 3.575611 MHz |
| @@ -681,7 +681,7 @@ static unsigned int inline norm_fsc8(v4l2_std_id norm) | |||
| 681 | return 35468950; // 4.43361875 MHz +/- 5 Hz | 681 | return 35468950; // 4.43361875 MHz +/- 5 Hz |
| 682 | } | 682 | } |
| 683 | 683 | ||
| 684 | static unsigned int inline norm_htotal(v4l2_std_id norm) | 684 | static inline unsigned int norm_htotal(v4l2_std_id norm) |
| 685 | { | 685 | { |
| 686 | 686 | ||
| 687 | unsigned int fsc4=norm_fsc8(norm)/2; | 687 | unsigned int fsc4=norm_fsc8(norm)/2; |
| @@ -692,7 +692,7 @@ static unsigned int inline norm_htotal(v4l2_std_id norm) | |||
| 692 | ((fsc4+262)/525*1001+15000)/30000; | 692 | ((fsc4+262)/525*1001+15000)/30000; |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | static unsigned int inline norm_vbipack(v4l2_std_id norm) | 695 | static inline unsigned int norm_vbipack(v4l2_std_id norm) |
| 696 | { | 696 | { |
| 697 | return (norm & V4L2_STD_625_50) ? 511 : 400; | 697 | return (norm & V4L2_STD_625_50) ? 511 : 400; |
| 698 | } | 698 | } |
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index ebf448c48ca3..f29e18c72f44 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c | |||
| @@ -248,7 +248,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
| 248 | struct cx88_IR *ir; | 248 | struct cx88_IR *ir; |
| 249 | struct rc_dev *dev; | 249 | struct rc_dev *dev; |
| 250 | char *ir_codes = NULL; | 250 | char *ir_codes = NULL; |
| 251 | u64 rc_type = RC_TYPE_OTHER; | 251 | u64 rc_type = RC_BIT_OTHER; |
| 252 | int err = -ENOMEM; | 252 | int err = -ENOMEM; |
| 253 | u32 hardware_mask = 0; /* For devices with a hardware mask, when | 253 | u32 hardware_mask = 0; /* For devices with a hardware mask, when |
| 254 | * used with a full-code IR table | 254 | * used with a full-code IR table |
| @@ -416,7 +416,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
| 416 | break; | 416 | break; |
| 417 | case CX88_BOARD_TWINHAN_VP1027_DVBS: | 417 | case CX88_BOARD_TWINHAN_VP1027_DVBS: |
| 418 | ir_codes = RC_MAP_TWINHAN_VP1027_DVBS; | 418 | ir_codes = RC_MAP_TWINHAN_VP1027_DVBS; |
| 419 | rc_type = RC_TYPE_NEC; | 419 | rc_type = RC_BIT_NEC; |
| 420 | ir->sampling = 0xff00; /* address */ | 420 | ir->sampling = 0xff00; /* address */ |
| 421 | break; | 421 | break; |
| 422 | } | 422 | } |
| @@ -592,7 +592,7 @@ void cx88_i2c_init_ir(struct cx88_core *core) | |||
| 592 | case CX88_BOARD_LEADTEK_PVR2000: | 592 | case CX88_BOARD_LEADTEK_PVR2000: |
| 593 | addr_list = pvr2000_addr_list; | 593 | addr_list = pvr2000_addr_list; |
| 594 | core->init_data.name = "cx88 Leadtek PVR 2000 remote"; | 594 | core->init_data.name = "cx88 Leadtek PVR 2000 remote"; |
| 595 | core->init_data.type = RC_TYPE_UNKNOWN; | 595 | core->init_data.type = RC_BIT_UNKNOWN; |
| 596 | core->init_data.get_key = get_key_pvr2000; | 596 | core->init_data.get_key = get_key_pvr2000; |
| 597 | core->init_data.ir_codes = RC_MAP_EMPTY; | 597 | core->init_data.ir_codes = RC_MAP_EMPTY; |
| 598 | break; | 598 | break; |
| @@ -613,7 +613,7 @@ void cx88_i2c_init_ir(struct cx88_core *core) | |||
| 613 | /* Hauppauge XVR */ | 613 | /* Hauppauge XVR */ |
| 614 | core->init_data.name = "cx88 Hauppauge XVR remote"; | 614 | core->init_data.name = "cx88 Hauppauge XVR remote"; |
| 615 | core->init_data.ir_codes = RC_MAP_HAUPPAUGE; | 615 | core->init_data.ir_codes = RC_MAP_HAUPPAUGE; |
| 616 | core->init_data.type = RC_TYPE_RC5; | 616 | core->init_data.type = RC_BIT_RC5; |
| 617 | core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 617 | core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
| 618 | 618 | ||
| 619 | info.platform_data = &core->init_data; | 619 | info.platform_data = &core->init_data; |
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c index d154bc197356..c9d3182f79d5 100644 --- a/drivers/media/pci/cx88/cx88-mpeg.c +++ b/drivers/media/pci/cx88/cx88-mpeg.c | |||
| @@ -45,11 +45,15 @@ static unsigned int debug; | |||
| 45 | module_param(debug,int,0644); | 45 | module_param(debug,int,0644); |
| 46 | MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); | 46 | MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); |
| 47 | 47 | ||
| 48 | #define dprintk(level,fmt, arg...) if (debug >= level) \ | 48 | #define dprintk(level, fmt, arg...) do { \ |
| 49 | printk(KERN_DEBUG "%s/2-mpeg: " fmt, dev->core->name, ## arg) | 49 | if (debug + 1 > level) \ |
| 50 | printk(KERN_DEBUG "%s/2-mpeg: " fmt, dev->core->name, ## arg); \ | ||
| 51 | } while(0) | ||
| 50 | 52 | ||
| 51 | #define mpeg_dbg(level,fmt, arg...) if (debug >= level) \ | 53 | #define mpeg_dbg(level, fmt, arg...) do { \ |
| 52 | printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg) | 54 | if (debug + 1 > level) \ |
| 55 | printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg); \ | ||
| 56 | } while(0) | ||
| 53 | 57 | ||
| 54 | #if defined(CONFIG_MODULES) && defined(MODULE) | 58 | #if defined(CONFIG_MODULES) && defined(MODULE) |
| 55 | static void request_module_async(struct work_struct *work) | 59 | static void request_module_async(struct work_struct *work) |
| @@ -217,8 +221,7 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
| 217 | return 0; | 221 | return 0; |
| 218 | buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue); | 222 | buf = list_entry(q->queued.next, struct cx88_buffer, vb.queue); |
| 219 | if (NULL == prev) { | 223 | if (NULL == prev) { |
| 220 | list_del(&buf->vb.queue); | 224 | list_move_tail(&buf->vb.queue, &q->active); |
| 221 | list_add_tail(&buf->vb.queue,&q->active); | ||
| 222 | cx8802_start_dma(dev, q, buf); | 225 | cx8802_start_dma(dev, q, buf); |
| 223 | buf->vb.state = VIDEOBUF_ACTIVE; | 226 | buf->vb.state = VIDEOBUF_ACTIVE; |
| 224 | buf->count = q->count++; | 227 | buf->count = q->count++; |
| @@ -229,8 +232,7 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
| 229 | } else if (prev->vb.width == buf->vb.width && | 232 | } else if (prev->vb.width == buf->vb.width && |
| 230 | prev->vb.height == buf->vb.height && | 233 | prev->vb.height == buf->vb.height && |
| 231 | prev->fmt == buf->fmt) { | 234 | prev->fmt == buf->fmt) { |
| 232 | list_del(&buf->vb.queue); | 235 | list_move_tail(&buf->vb.queue, &q->active); |
| 233 | list_add_tail(&buf->vb.queue,&q->active); | ||
| 234 | buf->vb.state = VIDEOBUF_ACTIVE; | 236 | buf->vb.state = VIDEOBUF_ACTIVE; |
| 235 | buf->count = q->count++; | 237 | buf->count = q->count++; |
| 236 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 238 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
| @@ -789,8 +791,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) | |||
| 789 | } | 791 | } |
| 790 | 792 | ||
| 791 | /* ----------------------------------------------------------- */ | 793 | /* ----------------------------------------------------------- */ |
| 792 | static int __devinit cx8802_probe(struct pci_dev *pci_dev, | 794 | static int cx8802_probe(struct pci_dev *pci_dev, |
| 793 | const struct pci_device_id *pci_id) | 795 | const struct pci_device_id *pci_id) |
| 794 | { | 796 | { |
| 795 | struct cx8802_dev *dev; | 797 | struct cx8802_dev *dev; |
| 796 | struct cx88_core *core; | 798 | struct cx88_core *core; |
| @@ -838,7 +840,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
| 838 | return err; | 840 | return err; |
| 839 | } | 841 | } |
| 840 | 842 | ||
| 841 | static void __devexit cx8802_remove(struct pci_dev *pci_dev) | 843 | static void cx8802_remove(struct pci_dev *pci_dev) |
| 842 | { | 844 | { |
| 843 | struct cx8802_dev *dev; | 845 | struct cx8802_dev *dev; |
| 844 | 846 | ||
| @@ -896,7 +898,7 @@ static struct pci_driver cx8802_pci_driver = { | |||
| 896 | .name = "cx88-mpeg driver manager", | 898 | .name = "cx88-mpeg driver manager", |
| 897 | .id_table = cx8802_pci_tbl, | 899 | .id_table = cx8802_pci_tbl, |
| 898 | .probe = cx8802_probe, | 900 | .probe = cx8802_probe, |
| 899 | .remove = __devexit_p(cx8802_remove), | 901 | .remove = cx8802_remove, |
| 900 | }; | 902 | }; |
| 901 | 903 | ||
| 902 | static int __init cx8802_init(void) | 904 | static int __init cx8802_init(void) |
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 05171457bf28..bc78354262ac 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c | |||
| @@ -1696,8 +1696,8 @@ static void cx8800_unregister_video(struct cx8800_dev *dev) | |||
| 1696 | } | 1696 | } |
| 1697 | } | 1697 | } |
| 1698 | 1698 | ||
| 1699 | static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | 1699 | static int cx8800_initdev(struct pci_dev *pci_dev, |
| 1700 | const struct pci_device_id *pci_id) | 1700 | const struct pci_device_id *pci_id) |
| 1701 | { | 1701 | { |
| 1702 | struct cx8800_dev *dev; | 1702 | struct cx8800_dev *dev; |
| 1703 | struct cx88_core *core; | 1703 | struct cx88_core *core; |
| @@ -1923,7 +1923,7 @@ fail_free: | |||
| 1923 | return err; | 1923 | return err; |
| 1924 | } | 1924 | } |
| 1925 | 1925 | ||
| 1926 | static void __devexit cx8800_finidev(struct pci_dev *pci_dev) | 1926 | static void cx8800_finidev(struct pci_dev *pci_dev) |
| 1927 | { | 1927 | { |
| 1928 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 1928 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
| 1929 | struct cx88_core *core = dev->core; | 1929 | struct cx88_core *core = dev->core; |
| @@ -2052,7 +2052,7 @@ static struct pci_driver cx8800_pci_driver = { | |||
| 2052 | .name = "cx8800", | 2052 | .name = "cx8800", |
| 2053 | .id_table = cx8800_pci_tbl, | 2053 | .id_table = cx8800_pci_tbl, |
| 2054 | .probe = cx8800_initdev, | 2054 | .probe = cx8800_initdev, |
| 2055 | .remove = __devexit_p(cx8800_finidev), | 2055 | .remove = cx8800_finidev, |
| 2056 | #ifdef CONFIG_PM | 2056 | #ifdef CONFIG_PM |
| 2057 | .suspend = cx8800_suspend, | 2057 | .suspend = cx8800_suspend, |
| 2058 | .resume = cx8800_resume, | 2058 | .resume = cx8800_resume, |
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h index 44ffc8b3d45f..ba0dba4a4d22 100644 --- a/drivers/media/pci/cx88/cx88.h +++ b/drivers/media/pci/cx88/cx88.h | |||
| @@ -94,13 +94,13 @@ enum cx8802_board_access { | |||
| 94 | /* ----------------------------------------------------------- */ | 94 | /* ----------------------------------------------------------- */ |
| 95 | /* tv norms */ | 95 | /* tv norms */ |
| 96 | 96 | ||
| 97 | static unsigned int inline norm_maxw(v4l2_std_id norm) | 97 | static inline unsigned int norm_maxw(v4l2_std_id norm) |
| 98 | { | 98 | { |
| 99 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768; | 99 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | static unsigned int inline norm_maxh(v4l2_std_id norm) | 103 | static inline unsigned int norm_maxh(v4l2_std_id norm) |
| 104 | { | 104 | { |
| 105 | return (norm & V4L2_STD_625_50) ? 576 : 480; | 105 | return (norm & V4L2_STD_625_50) ? 576 : 480; |
| 106 | } | 106 | } |
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index feff57ee5a08..36e34522b9a8 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c | |||
| @@ -1542,7 +1542,7 @@ static void ddb_unmap(struct ddb *dev) | |||
| 1542 | } | 1542 | } |
| 1543 | 1543 | ||
| 1544 | 1544 | ||
| 1545 | static void __devexit ddb_remove(struct pci_dev *pdev) | 1545 | static void ddb_remove(struct pci_dev *pdev) |
| 1546 | { | 1546 | { |
| 1547 | struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev); | 1547 | struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev); |
| 1548 | 1548 | ||
| @@ -1565,8 +1565,7 @@ static void __devexit ddb_remove(struct pci_dev *pdev) | |||
| 1565 | } | 1565 | } |
| 1566 | 1566 | ||
| 1567 | 1567 | ||
| 1568 | static int __devinit ddb_probe(struct pci_dev *pdev, | 1568 | static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
| 1569 | const struct pci_device_id *id) | ||
| 1570 | { | 1569 | { |
| 1571 | struct ddb *dev; | 1570 | struct ddb *dev; |
| 1572 | int stat = 0; | 1571 | int stat = 0; |
| @@ -1679,7 +1678,7 @@ static struct ddb_info ddb_v6 = { | |||
| 1679 | .subvendor = _subvend, .subdevice = _subdev, \ | 1678 | .subvendor = _subvend, .subdevice = _subdev, \ |
| 1680 | .driver_data = (unsigned long)&_driverdata } | 1679 | .driver_data = (unsigned long)&_driverdata } |
| 1681 | 1680 | ||
| 1682 | static const struct pci_device_id ddb_id_tbl[] __devinitdata = { | 1681 | static const struct pci_device_id ddb_id_tbl[] = { |
| 1683 | DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus), | 1682 | DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus), |
| 1684 | DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus), | 1683 | DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus), |
| 1685 | DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le), | 1684 | DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le), |
| @@ -1696,7 +1695,7 @@ static struct pci_driver ddb_pci_driver = { | |||
| 1696 | .name = "DDBridge", | 1695 | .name = "DDBridge", |
| 1697 | .id_table = ddb_id_tbl, | 1696 | .id_table = ddb_id_tbl, |
| 1698 | .probe = ddb_probe, | 1697 | .probe = ddb_probe, |
| 1699 | .remove = __devexit_p(ddb_remove), | 1698 | .remove = ddb_remove, |
| 1700 | }; | 1699 | }; |
| 1701 | 1700 | ||
| 1702 | static __init int module_init_ddbridge(void) | 1701 | static __init int module_init_ddbridge(void) |
diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c index a609b3a9b146..904c3ea350f5 100644 --- a/drivers/media/pci/dm1105/dm1105.c +++ b/drivers/media/pci/dm1105/dm1105.c | |||
| @@ -616,7 +616,7 @@ static void dm1105_set_dma_addr(struct dm1105_dev *dev) | |||
| 616 | dm_writel(DM1105_STADR, cpu_to_le32(dev->dma_addr)); | 616 | dm_writel(DM1105_STADR, cpu_to_le32(dev->dma_addr)); |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | static int __devinit dm1105_dma_map(struct dm1105_dev *dev) | 619 | static int dm1105_dma_map(struct dm1105_dev *dev) |
| 620 | { | 620 | { |
| 621 | dev->ts_buf = pci_alloc_consistent(dev->pdev, | 621 | dev->ts_buf = pci_alloc_consistent(dev->pdev, |
| 622 | 6 * DM1105_DMA_BYTES, | 622 | 6 * DM1105_DMA_BYTES, |
| @@ -736,7 +736,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) | |||
| 736 | return IRQ_HANDLED; | 736 | return IRQ_HANDLED; |
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) | 739 | static int dm1105_ir_init(struct dm1105_dev *dm1105) |
| 740 | { | 740 | { |
| 741 | struct rc_dev *dev; | 741 | struct rc_dev *dev; |
| 742 | int err = -ENOMEM; | 742 | int err = -ENOMEM; |
| @@ -776,12 +776,12 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) | |||
| 776 | return 0; | 776 | return 0; |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) | 779 | static void dm1105_ir_exit(struct dm1105_dev *dm1105) |
| 780 | { | 780 | { |
| 781 | rc_unregister_device(dm1105->ir.dev); | 781 | rc_unregister_device(dm1105->ir.dev); |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | static int __devinit dm1105_hw_init(struct dm1105_dev *dev) | 784 | static int dm1105_hw_init(struct dm1105_dev *dev) |
| 785 | { | 785 | { |
| 786 | dm1105_disable_irqs(dev); | 786 | dm1105_disable_irqs(dev); |
| 787 | 787 | ||
| @@ -849,7 +849,7 @@ static struct ds3000_config dvbworld_ds3000_config = { | |||
| 849 | .demod_address = 0x68, | 849 | .demod_address = 0x68, |
| 850 | }; | 850 | }; |
| 851 | 851 | ||
| 852 | static int __devinit frontend_init(struct dm1105_dev *dev) | 852 | static int frontend_init(struct dm1105_dev *dev) |
| 853 | { | 853 | { |
| 854 | int ret; | 854 | int ret; |
| 855 | 855 | ||
| @@ -949,7 +949,7 @@ static int __devinit frontend_init(struct dm1105_dev *dev) | |||
| 949 | return 0; | 949 | return 0; |
| 950 | } | 950 | } |
| 951 | 951 | ||
| 952 | static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac) | 952 | static void dm1105_read_mac(struct dm1105_dev *dev, u8 *mac) |
| 953 | { | 953 | { |
| 954 | static u8 command[1] = { 0x28 }; | 954 | static u8 command[1] = { 0x28 }; |
| 955 | 955 | ||
| @@ -971,7 +971,7 @@ static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac) | |||
| 971 | dev_info(&dev->pdev->dev, "MAC %pM\n", mac); | 971 | dev_info(&dev->pdev->dev, "MAC %pM\n", mac); |
| 972 | } | 972 | } |
| 973 | 973 | ||
| 974 | static int __devinit dm1105_probe(struct pci_dev *pdev, | 974 | static int dm1105_probe(struct pci_dev *pdev, |
| 975 | const struct pci_device_id *ent) | 975 | const struct pci_device_id *ent) |
| 976 | { | 976 | { |
| 977 | struct dm1105_dev *dev; | 977 | struct dm1105_dev *dev; |
| @@ -1128,8 +1128,10 @@ static int __devinit dm1105_probe(struct pci_dev *pdev, | |||
| 1128 | INIT_WORK(&dev->work, dm1105_dmx_buffer); | 1128 | INIT_WORK(&dev->work, dm1105_dmx_buffer); |
| 1129 | sprintf(dev->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num); | 1129 | sprintf(dev->wqn, "%s/%d", dvb_adapter->name, dvb_adapter->num); |
| 1130 | dev->wq = create_singlethread_workqueue(dev->wqn); | 1130 | dev->wq = create_singlethread_workqueue(dev->wqn); |
| 1131 | if (!dev->wq) | 1131 | if (!dev->wq) { |
| 1132 | ret = -ENOMEM; | ||
| 1132 | goto err_dvb_net; | 1133 | goto err_dvb_net; |
| 1134 | } | ||
| 1133 | 1135 | ||
| 1134 | ret = request_irq(pdev->irq, dm1105_irq, IRQF_SHARED, | 1136 | ret = request_irq(pdev->irq, dm1105_irq, IRQF_SHARED, |
| 1135 | DRIVER_NAME, dev); | 1137 | DRIVER_NAME, dev); |
| @@ -1172,7 +1174,7 @@ err_kfree: | |||
| 1172 | return ret; | 1174 | return ret; |
| 1173 | } | 1175 | } |
| 1174 | 1176 | ||
| 1175 | static void __devexit dm1105_remove(struct pci_dev *pdev) | 1177 | static void dm1105_remove(struct pci_dev *pdev) |
| 1176 | { | 1178 | { |
| 1177 | struct dm1105_dev *dev = pci_get_drvdata(pdev); | 1179 | struct dm1105_dev *dev = pci_get_drvdata(pdev); |
| 1178 | struct dvb_adapter *dvb_adapter = &dev->dvb_adapter; | 1180 | struct dvb_adapter *dvb_adapter = &dev->dvb_adapter; |
| @@ -1205,7 +1207,7 @@ static void __devexit dm1105_remove(struct pci_dev *pdev) | |||
| 1205 | kfree(dev); | 1207 | kfree(dev); |
| 1206 | } | 1208 | } |
| 1207 | 1209 | ||
| 1208 | static struct pci_device_id dm1105_id_table[] __devinitdata = { | 1210 | static struct pci_device_id dm1105_id_table[] = { |
| 1209 | { | 1211 | { |
| 1210 | .vendor = PCI_VENDOR_ID_TRIGEM, | 1212 | .vendor = PCI_VENDOR_ID_TRIGEM, |
| 1211 | .device = PCI_DEVICE_ID_DM1105, | 1213 | .device = PCI_DEVICE_ID_DM1105, |
| @@ -1227,7 +1229,7 @@ static struct pci_driver dm1105_driver = { | |||
| 1227 | .name = DRIVER_NAME, | 1229 | .name = DRIVER_NAME, |
| 1228 | .id_table = dm1105_id_table, | 1230 | .id_table = dm1105_id_table, |
| 1229 | .probe = dm1105_probe, | 1231 | .probe = dm1105_probe, |
| 1230 | .remove = __devexit_p(dm1105_remove), | 1232 | .remove = dm1105_remove, |
| 1231 | }; | 1233 | }; |
| 1232 | 1234 | ||
| 1233 | static int __init dm1105_init(void) | 1235 | static int __init dm1105_init(void) |
diff --git a/drivers/media/pci/ivtv/ivtv-alsa-main.c b/drivers/media/pci/ivtv/ivtv-alsa-main.c index 8deab1629b3b..4a221c693995 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-main.c +++ b/drivers/media/pci/ivtv/ivtv-alsa-main.c | |||
| @@ -205,7 +205,7 @@ err_exit: | |||
| 205 | return ret; | 205 | return ret; |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | int ivtv_alsa_load(struct ivtv *itv) | 208 | static int __init ivtv_alsa_load(struct ivtv *itv) |
| 209 | { | 209 | { |
| 210 | struct v4l2_device *v4l2_dev = &itv->v4l2_dev; | 210 | struct v4l2_device *v4l2_dev = &itv->v4l2_dev; |
| 211 | struct ivtv_stream *s; | 211 | struct ivtv_stream *s; |
diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c index f7022bd58ffd..e1863dbf4edc 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c +++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include "ivtv-streams.h" | 37 | #include "ivtv-streams.h" |
| 38 | #include "ivtv-fileops.h" | 38 | #include "ivtv-fileops.h" |
| 39 | #include "ivtv-alsa.h" | 39 | #include "ivtv-alsa.h" |
| 40 | #include "ivtv-alsa-pcm.h" | ||
| 40 | 41 | ||
| 41 | static unsigned int pcm_debug; | 42 | static unsigned int pcm_debug; |
| 42 | module_param(pcm_debug, int, 0644); | 43 | module_param(pcm_debug, int, 0644); |
| @@ -69,8 +70,9 @@ static struct snd_pcm_hardware snd_ivtv_hw_capture = { | |||
| 69 | .periods_max = 98, /* 12544, */ | 70 | .periods_max = 98, /* 12544, */ |
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | void ivtv_alsa_announce_pcm_data(struct snd_ivtv_card *itvsc, u8 *pcm_data, | 73 | static void ivtv_alsa_announce_pcm_data(struct snd_ivtv_card *itvsc, |
| 73 | size_t num_bytes) | 74 | u8 *pcm_data, |
| 75 | size_t num_bytes) | ||
| 74 | { | 76 | { |
| 75 | struct snd_pcm_substream *substream; | 77 | struct snd_pcm_substream *substream; |
| 76 | struct snd_pcm_runtime *runtime; | 78 | struct snd_pcm_runtime *runtime; |
diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.h b/drivers/media/pci/ivtv/ivtv-alsa-pcm.h index 5ab18319ea4d..23dfe0d12400 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.h +++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.h | |||
| @@ -21,7 +21,3 @@ | |||
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | int __init snd_ivtv_pcm_create(struct snd_ivtv_card *itvsc); | 23 | int __init snd_ivtv_pcm_create(struct snd_ivtv_card *itvsc); |
| 24 | |||
| 25 | /* Used by ivtv driver to announce the PCM data to the module */ | ||
| 26 | void ivtv_alsa_announce_pcm_data(struct snd_ivtv_card *card, u8 *pcm_data, | ||
| 27 | size_t num_bytes); | ||
diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index 74e9a5032364..df88dc4ab555 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c | |||
| @@ -73,7 +73,7 @@ int (*ivtv_ext_init)(struct ivtv *); | |||
| 73 | EXPORT_SYMBOL(ivtv_ext_init); | 73 | EXPORT_SYMBOL(ivtv_ext_init); |
| 74 | 74 | ||
| 75 | /* add your revision and whatnot here */ | 75 | /* add your revision and whatnot here */ |
| 76 | static struct pci_device_id ivtv_pci_tbl[] __devinitdata = { | 76 | static struct pci_device_id ivtv_pci_tbl[] = { |
| 77 | {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV15, | 77 | {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV15, |
| 78 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 78 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 79 | {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV16, | 79 | {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV16, |
| @@ -736,7 +736,7 @@ done: | |||
| 736 | No assumptions on the card type may be made here (see ivtv_init_struct2 | 736 | No assumptions on the card type may be made here (see ivtv_init_struct2 |
| 737 | for that). | 737 | for that). |
| 738 | */ | 738 | */ |
| 739 | static int __devinit ivtv_init_struct1(struct ivtv *itv) | 739 | static int ivtv_init_struct1(struct ivtv *itv) |
| 740 | { | 740 | { |
| 741 | struct sched_param param = { .sched_priority = 99 }; | 741 | struct sched_param param = { .sched_priority = 99 }; |
| 742 | 742 | ||
| @@ -802,7 +802,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
| 802 | 802 | ||
| 803 | /* Second initialization part. Here the card type has been | 803 | /* Second initialization part. Here the card type has been |
| 804 | autodetected. */ | 804 | autodetected. */ |
| 805 | static void __devinit ivtv_init_struct2(struct ivtv *itv) | 805 | static void ivtv_init_struct2(struct ivtv *itv) |
| 806 | { | 806 | { |
| 807 | int i; | 807 | int i; |
| 808 | 808 | ||
| @@ -1001,8 +1001,7 @@ static void ivtv_load_and_init_modules(struct ivtv *itv) | |||
| 1001 | } | 1001 | } |
| 1002 | } | 1002 | } |
| 1003 | 1003 | ||
| 1004 | static int __devinit ivtv_probe(struct pci_dev *pdev, | 1004 | static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) |
| 1005 | const struct pci_device_id *pci_id) | ||
| 1006 | { | 1005 | { |
| 1007 | int retval = 0; | 1006 | int retval = 0; |
| 1008 | int vbi_buf_size; | 1007 | int vbi_buf_size; |
diff --git a/drivers/media/pci/ivtv/ivtv-firmware.c b/drivers/media/pci/ivtv/ivtv-firmware.c index 6ec7705af555..68387d4369d6 100644 --- a/drivers/media/pci/ivtv/ivtv-firmware.c +++ b/drivers/media/pci/ivtv/ivtv-firmware.c | |||
| @@ -276,7 +276,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv) | |||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | /* Try to restart the card & restore previous settings */ | 278 | /* Try to restart the card & restore previous settings */ |
| 279 | int ivtv_firmware_restart(struct ivtv *itv) | 279 | static int ivtv_firmware_restart(struct ivtv *itv) |
| 280 | { | 280 | { |
| 281 | int rc = 0; | 281 | int rc = 0; |
| 282 | v4l2_std_id std; | 282 | v4l2_std_id std; |
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c index d47f41a0ef66..46e262becb67 100644 --- a/drivers/media/pci/ivtv/ivtv-i2c.c +++ b/drivers/media/pci/ivtv/ivtv-i2c.c | |||
| @@ -200,21 +200,21 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
| 200 | init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; | 200 | init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; |
| 201 | init_data->internal_get_key_func = | 201 | init_data->internal_get_key_func = |
| 202 | IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; | 202 | IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; |
| 203 | init_data->type = RC_TYPE_OTHER; | 203 | init_data->type = RC_BIT_OTHER; |
| 204 | init_data->name = "AVerMedia AVerTV card"; | 204 | init_data->name = "AVerMedia AVerTV card"; |
| 205 | break; | 205 | break; |
| 206 | case IVTV_HW_I2C_IR_RX_HAUP_EXT: | 206 | case IVTV_HW_I2C_IR_RX_HAUP_EXT: |
| 207 | case IVTV_HW_I2C_IR_RX_HAUP_INT: | 207 | case IVTV_HW_I2C_IR_RX_HAUP_INT: |
| 208 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 208 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 209 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; | 209 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; |
| 210 | init_data->type = RC_TYPE_RC5; | 210 | init_data->type = RC_BIT_RC5; |
| 211 | init_data->name = itv->card_name; | 211 | init_data->name = itv->card_name; |
| 212 | break; | 212 | break; |
| 213 | case IVTV_HW_Z8F0811_IR_RX_HAUP: | 213 | case IVTV_HW_Z8F0811_IR_RX_HAUP: |
| 214 | /* Default to grey remote */ | 214 | /* Default to grey remote */ |
| 215 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 215 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 216 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 216 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
| 217 | init_data->type = RC_TYPE_RC5; | 217 | init_data->type = RC_BIT_RC5; |
| 218 | init_data->name = itv->card_name; | 218 | init_data->name = itv->card_name; |
| 219 | break; | 219 | break; |
| 220 | case IVTV_HW_I2C_IR_RX_ADAPTEC: | 220 | case IVTV_HW_I2C_IR_RX_ADAPTEC: |
| @@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
| 222 | init_data->name = itv->card_name; | 222 | init_data->name = itv->card_name; |
| 223 | /* FIXME: The protocol and RC_MAP needs to be corrected */ | 223 | /* FIXME: The protocol and RC_MAP needs to be corrected */ |
| 224 | init_data->ir_codes = RC_MAP_EMPTY; | 224 | init_data->ir_codes = RC_MAP_EMPTY; |
| 225 | init_data->type = RC_TYPE_UNKNOWN; | 225 | init_data->type = RC_BIT_UNKNOWN; |
| 226 | break; | 226 | break; |
| 227 | } | 227 | } |
| 228 | 228 | ||
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index 949ae230e119..7a8b0d0b6127 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c | |||
| @@ -993,7 +993,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp) | |||
| 993 | v4l2_std_id std; | 993 | v4l2_std_id std; |
| 994 | int i; | 994 | int i; |
| 995 | 995 | ||
| 996 | if (inp < 0 || inp >= itv->nof_inputs) | 996 | if (inp >= itv->nof_inputs) |
| 997 | return -EINVAL; | 997 | return -EINVAL; |
| 998 | 998 | ||
| 999 | if (inp == itv->active_input) { | 999 | if (inp == itv->active_input) { |
| @@ -1168,7 +1168,7 @@ void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std) | |||
| 1168 | } | 1168 | } |
| 1169 | } | 1169 | } |
| 1170 | 1170 | ||
| 1171 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | 1171 | static int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) |
| 1172 | { | 1172 | { |
| 1173 | struct ivtv *itv = fh2id(fh)->itv; | 1173 | struct ivtv *itv = fh2id(fh)->itv; |
| 1174 | 1174 | ||
diff --git a/drivers/media/pci/mantis/hopper_cards.c b/drivers/media/pci/mantis/hopper_cards.c index cc0251e01077..6fe9fe5293dc 100644 --- a/drivers/media/pci/mantis/hopper_cards.c +++ b/drivers/media/pci/mantis/hopper_cards.c | |||
| @@ -151,7 +151,8 @@ static irqreturn_t hopper_irq_handler(int irq, void *dev_id) | |||
| 151 | return IRQ_HANDLED; | 151 | return IRQ_HANDLED; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static int __devinit hopper_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | 154 | static int hopper_pci_probe(struct pci_dev *pdev, |
| 155 | const struct pci_device_id *pci_id) | ||
| 155 | { | 156 | { |
| 156 | struct mantis_pci *mantis; | 157 | struct mantis_pci *mantis; |
| 157 | struct mantis_hwconfig *config; | 158 | struct mantis_hwconfig *config; |
| @@ -230,7 +231,7 @@ fail0: | |||
| 230 | return err; | 231 | return err; |
| 231 | } | 232 | } |
| 232 | 233 | ||
| 233 | static void __devexit hopper_pci_remove(struct pci_dev *pdev) | 234 | static void hopper_pci_remove(struct pci_dev *pdev) |
| 234 | { | 235 | { |
| 235 | struct mantis_pci *mantis = pci_get_drvdata(pdev); | 236 | struct mantis_pci *mantis = pci_get_drvdata(pdev); |
| 236 | 237 | ||
| @@ -259,12 +260,12 @@ static struct pci_driver hopper_pci_driver = { | |||
| 259 | .remove = hopper_pci_remove, | 260 | .remove = hopper_pci_remove, |
| 260 | }; | 261 | }; |
| 261 | 262 | ||
| 262 | static int __devinit hopper_init(void) | 263 | static int hopper_init(void) |
| 263 | { | 264 | { |
| 264 | return pci_register_driver(&hopper_pci_driver); | 265 | return pci_register_driver(&hopper_pci_driver); |
| 265 | } | 266 | } |
| 266 | 267 | ||
| 267 | static void __devexit hopper_exit(void) | 268 | static void hopper_exit(void) |
| 268 | { | 269 | { |
| 269 | return pci_unregister_driver(&hopper_pci_driver); | 270 | return pci_unregister_driver(&hopper_pci_driver); |
| 270 | } | 271 | } |
diff --git a/drivers/media/pci/mantis/mantis_cards.c b/drivers/media/pci/mantis/mantis_cards.c index 0207d1f064e0..932a0d73a7f8 100644 --- a/drivers/media/pci/mantis/mantis_cards.c +++ b/drivers/media/pci/mantis/mantis_cards.c | |||
| @@ -159,7 +159,8 @@ static irqreturn_t mantis_irq_handler(int irq, void *dev_id) | |||
| 159 | return IRQ_HANDLED; | 159 | return IRQ_HANDLED; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static int __devinit mantis_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | 162 | static int mantis_pci_probe(struct pci_dev *pdev, |
| 163 | const struct pci_device_id *pci_id) | ||
| 163 | { | 164 | { |
| 164 | struct mantis_pci *mantis; | 165 | struct mantis_pci *mantis; |
| 165 | struct mantis_hwconfig *config; | 166 | struct mantis_hwconfig *config; |
| @@ -249,7 +250,7 @@ fail0: | |||
| 249 | return err; | 250 | return err; |
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | static void __devexit mantis_pci_remove(struct pci_dev *pdev) | 253 | static void mantis_pci_remove(struct pci_dev *pdev) |
| 253 | { | 254 | { |
| 254 | struct mantis_pci *mantis = pci_get_drvdata(pdev); | 255 | struct mantis_pci *mantis = pci_get_drvdata(pdev); |
| 255 | 256 | ||
| @@ -289,12 +290,12 @@ static struct pci_driver mantis_pci_driver = { | |||
| 289 | .remove = mantis_pci_remove, | 290 | .remove = mantis_pci_remove, |
| 290 | }; | 291 | }; |
| 291 | 292 | ||
| 292 | static int __devinit mantis_init(void) | 293 | static int mantis_init(void) |
| 293 | { | 294 | { |
| 294 | return pci_register_driver(&mantis_pci_driver); | 295 | return pci_register_driver(&mantis_pci_driver); |
| 295 | } | 296 | } |
| 296 | 297 | ||
| 297 | static void __devexit mantis_exit(void) | 298 | static void mantis_exit(void) |
| 298 | { | 299 | { |
| 299 | return pci_unregister_driver(&mantis_pci_driver); | 300 | return pci_unregister_driver(&mantis_pci_driver); |
| 300 | } | 301 | } |
diff --git a/drivers/media/pci/mantis/mantis_dvb.c b/drivers/media/pci/mantis/mantis_dvb.c index 5d15c6b74d9b..5a71e1791cf5 100644 --- a/drivers/media/pci/mantis/mantis_dvb.c +++ b/drivers/media/pci/mantis/mantis_dvb.c | |||
| @@ -144,7 +144,7 @@ static int mantis_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
| 144 | return 0; | 144 | return 0; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | int __devinit mantis_dvb_init(struct mantis_pci *mantis) | 147 | int mantis_dvb_init(struct mantis_pci *mantis) |
| 148 | { | 148 | { |
| 149 | struct mantis_hwconfig *config = mantis->hwconfig; | 149 | struct mantis_hwconfig *config = mantis->hwconfig; |
| 150 | int result = -1; | 150 | int result = -1; |
| @@ -271,7 +271,7 @@ err0: | |||
| 271 | } | 271 | } |
| 272 | EXPORT_SYMBOL_GPL(mantis_dvb_init); | 272 | EXPORT_SYMBOL_GPL(mantis_dvb_init); |
| 273 | 273 | ||
| 274 | int __devexit mantis_dvb_exit(struct mantis_pci *mantis) | 274 | int mantis_dvb_exit(struct mantis_pci *mantis) |
| 275 | { | 275 | { |
| 276 | int err; | 276 | int err; |
| 277 | 277 | ||
diff --git a/drivers/media/pci/mantis/mantis_i2c.c b/drivers/media/pci/mantis/mantis_i2c.c index e7794517fe26..937fb9d50213 100644 --- a/drivers/media/pci/mantis/mantis_i2c.c +++ b/drivers/media/pci/mantis/mantis_i2c.c | |||
| @@ -217,7 +217,7 @@ static struct i2c_algorithm mantis_algo = { | |||
| 217 | .functionality = mantis_i2c_func, | 217 | .functionality = mantis_i2c_func, |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | int __devinit mantis_i2c_init(struct mantis_pci *mantis) | 220 | int mantis_i2c_init(struct mantis_pci *mantis) |
| 221 | { | 221 | { |
| 222 | u32 intstat, intmask; | 222 | u32 intstat, intmask; |
| 223 | struct i2c_adapter *i2c_adapter = &mantis->adapter; | 223 | struct i2c_adapter *i2c_adapter = &mantis->adapter; |
diff --git a/drivers/media/pci/mantis/mantis_input.c b/drivers/media/pci/mantis/mantis_input.c index db6d54d3fec0..0e5252e5c0ef 100644 --- a/drivers/media/pci/mantis/mantis_input.c +++ b/drivers/media/pci/mantis/mantis_input.c | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #if 0 /* Currently unused */ | ||
| 22 | |||
| 21 | #include <media/rc-core.h> | 23 | #include <media/rc-core.h> |
| 22 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
| 23 | 25 | ||
| @@ -150,10 +152,11 @@ out: | |||
| 150 | return err; | 152 | return err; |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | int mantis_exit(struct mantis_pci *mantis) | 155 | int mantis_init_exit(struct mantis_pci *mantis) |
| 154 | { | 156 | { |
| 155 | rc_unregister_device(mantis->rc); | 157 | rc_unregister_device(mantis->rc); |
| 156 | rc_map_unregister(&ir_mantis_map); | 158 | rc_map_unregister(&ir_mantis_map); |
| 157 | return 0; | 159 | return 0; |
| 158 | } | 160 | } |
| 159 | 161 | ||
| 162 | #endif | ||
diff --git a/drivers/media/pci/mantis/mantis_pci.c b/drivers/media/pci/mantis/mantis_pci.c index 371558af2d96..a846036ea022 100644 --- a/drivers/media/pci/mantis/mantis_pci.c +++ b/drivers/media/pci/mantis/mantis_pci.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | #define DRIVER_NAME "Mantis Core" | 47 | #define DRIVER_NAME "Mantis Core" |
| 48 | 48 | ||
| 49 | int __devinit mantis_pci_init(struct mantis_pci *mantis) | 49 | int mantis_pci_init(struct mantis_pci *mantis) |
| 50 | { | 50 | { |
| 51 | u8 latency; | 51 | u8 latency; |
| 52 | struct mantis_hwconfig *config = mantis->hwconfig; | 52 | struct mantis_hwconfig *config = mantis->hwconfig; |
diff --git a/drivers/media/pci/mantis/mantis_uart.c b/drivers/media/pci/mantis/mantis_uart.c index 85e977861b4a..a70719218631 100644 --- a/drivers/media/pci/mantis/mantis_uart.c +++ b/drivers/media/pci/mantis/mantis_uart.c | |||
| @@ -61,7 +61,7 @@ static struct { | |||
| 61 | 61 | ||
| 62 | #define UART_MAX_BUF 16 | 62 | #define UART_MAX_BUF 16 |
| 63 | 63 | ||
| 64 | int mantis_uart_read(struct mantis_pci *mantis, u8 *data) | 64 | static int mantis_uart_read(struct mantis_pci *mantis, u8 *data) |
| 65 | { | 65 | { |
| 66 | struct mantis_hwconfig *config = mantis->hwconfig; | 66 | struct mantis_hwconfig *config = mantis->hwconfig; |
| 67 | u32 stat = 0, i; | 67 | u32 stat = 0, i; |
diff --git a/drivers/media/pci/mantis/mantis_vp1033.c b/drivers/media/pci/mantis/mantis_vp1033.c index ad013e93ed11..115003e8d19d 100644 --- a/drivers/media/pci/mantis/mantis_vp1033.c +++ b/drivers/media/pci/mantis/mantis_vp1033.c | |||
| @@ -83,7 +83,7 @@ u8 lgtdqcs001f_inittab[] = { | |||
| 83 | #define MANTIS_MODEL_NAME "VP-1033" | 83 | #define MANTIS_MODEL_NAME "VP-1033" |
| 84 | #define MANTIS_DEV_TYPE "DVB-S/DSS" | 84 | #define MANTIS_DEV_TYPE "DVB-S/DSS" |
| 85 | 85 | ||
| 86 | int lgtdqcs001f_tuner_set(struct dvb_frontend *fe) | 86 | static int lgtdqcs001f_tuner_set(struct dvb_frontend *fe) |
| 87 | { | 87 | { |
| 88 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; | 88 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
| 89 | struct mantis_pci *mantis = fe->dvb->priv; | 89 | struct mantis_pci *mantis = fe->dvb->priv; |
| @@ -115,8 +115,8 @@ int lgtdqcs001f_tuner_set(struct dvb_frontend *fe) | |||
| 115 | return 0; | 115 | return 0; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe, | 118 | static int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe, |
| 119 | u32 srate, u32 ratio) | 119 | u32 srate, u32 ratio) |
| 120 | { | 120 | { |
| 121 | u8 aclk = 0; | 121 | u8 aclk = 0; |
| 122 | u8 bclk = 0; | 122 | u8 bclk = 0; |
diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c index e5a76da86081..049e18667cd0 100644 --- a/drivers/media/pci/meye/meye.c +++ b/drivers/media/pci/meye/meye.c | |||
| @@ -1728,8 +1728,7 @@ static int meye_resume(struct pci_dev *pdev) | |||
| 1728 | } | 1728 | } |
| 1729 | #endif | 1729 | #endif |
| 1730 | 1730 | ||
| 1731 | static int __devinit meye_probe(struct pci_dev *pcidev, | 1731 | static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) |
| 1732 | const struct pci_device_id *ent) | ||
| 1733 | { | 1732 | { |
| 1734 | struct v4l2_device *v4l2_dev = &meye.v4l2_dev; | 1733 | struct v4l2_device *v4l2_dev = &meye.v4l2_dev; |
| 1735 | int ret = -EBUSY; | 1734 | int ret = -EBUSY; |
| @@ -1889,7 +1888,7 @@ outnotdev: | |||
| 1889 | return ret; | 1888 | return ret; |
| 1890 | } | 1889 | } |
| 1891 | 1890 | ||
| 1892 | static void __devexit meye_remove(struct pci_dev *pcidev) | 1891 | static void meye_remove(struct pci_dev *pcidev) |
| 1893 | { | 1892 | { |
| 1894 | video_unregister_device(meye.vdev); | 1893 | video_unregister_device(meye.vdev); |
| 1895 | 1894 | ||
| @@ -1935,7 +1934,7 @@ static struct pci_driver meye_driver = { | |||
| 1935 | .name = "meye", | 1934 | .name = "meye", |
| 1936 | .id_table = meye_pci_tbl, | 1935 | .id_table = meye_pci_tbl, |
| 1937 | .probe = meye_probe, | 1936 | .probe = meye_probe, |
| 1938 | .remove = __devexit_p(meye_remove), | 1937 | .remove = meye_remove, |
| 1939 | #ifdef CONFIG_PM | 1938 | #ifdef CONFIG_PM |
| 1940 | .suspend = meye_suspend, | 1939 | .suspend = meye_suspend, |
| 1941 | .resume = meye_resume, | 1940 | .resume = meye_resume, |
| @@ -1945,7 +1944,7 @@ static struct pci_driver meye_driver = { | |||
| 1945 | static int __init meye_init(void) | 1944 | static int __init meye_init(void) |
| 1946 | { | 1945 | { |
| 1947 | gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS)); | 1946 | gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS)); |
| 1948 | if (gbufsize < 0 || gbufsize > MEYE_MAX_BUFSIZE) | 1947 | if (gbufsize > MEYE_MAX_BUFSIZE) |
| 1949 | gbufsize = MEYE_MAX_BUFSIZE; | 1948 | gbufsize = MEYE_MAX_BUFSIZE; |
| 1950 | gbufsize = PAGE_ALIGN(gbufsize); | 1949 | gbufsize = PAGE_ALIGN(gbufsize); |
| 1951 | printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) " | 1950 | printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) " |
diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c index 96a13ed197d0..fad214113669 100644 --- a/drivers/media/pci/ngene/ngene-cards.c +++ b/drivers/media/pci/ngene/ngene-cards.c | |||
| @@ -425,8 +425,10 @@ static int ReadEEProm(struct i2c_adapter *adapter, | |||
| 425 | status = i2c_read_eeprom(adapter, 0x50, Addr, data, Length); | 425 | status = i2c_read_eeprom(adapter, 0x50, Addr, data, Length); |
| 426 | if (!status) { | 426 | if (!status) { |
| 427 | *pLength = EETag[2]; | 427 | *pLength = EETag[2]; |
| 428 | #if 0 | ||
| 428 | if (Length < EETag[2]) | 429 | if (Length < EETag[2]) |
| 429 | ; /*status=STATUS_BUFFER_OVERFLOW; */ | 430 | status = STATUS_BUFFER_OVERFLOW; |
| 431 | #endif | ||
| 430 | } | 432 | } |
| 431 | } | 433 | } |
| 432 | return status; | 434 | return status; |
| @@ -741,7 +743,7 @@ static struct ngene_info ngene_info_terratec = { | |||
| 741 | 743 | ||
| 742 | /****************************************************************************/ | 744 | /****************************************************************************/ |
| 743 | 745 | ||
| 744 | static const struct pci_device_id ngene_id_tbl[] __devinitdata = { | 746 | static const struct pci_device_id ngene_id_tbl[] = { |
| 745 | NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), | 747 | NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), |
| 746 | NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), | 748 | NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), |
| 747 | NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), | 749 | NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), |
| @@ -798,7 +800,7 @@ static struct pci_driver ngene_pci_driver = { | |||
| 798 | .name = "ngene", | 800 | .name = "ngene", |
| 799 | .id_table = ngene_id_tbl, | 801 | .id_table = ngene_id_tbl, |
| 800 | .probe = ngene_probe, | 802 | .probe = ngene_probe, |
| 801 | .remove = __devexit_p(ngene_remove), | 803 | .remove = ngene_remove, |
| 802 | .err_handler = &ngene_errors, | 804 | .err_handler = &ngene_errors, |
| 803 | .shutdown = ngene_shutdown, | 805 | .shutdown = ngene_shutdown, |
| 804 | }; | 806 | }; |
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index c8e0d5b99d4c..37ebc42392ad 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c | |||
| @@ -752,8 +752,8 @@ void set_transfer(struct ngene_channel *chan, int state) | |||
| 752 | if (chan->mode & NGENE_IO_TSIN) | 752 | if (chan->mode & NGENE_IO_TSIN) |
| 753 | chan->pBufferExchange = tsin_exchange; | 753 | chan->pBufferExchange = tsin_exchange; |
| 754 | spin_unlock_irq(&chan->state_lock); | 754 | spin_unlock_irq(&chan->state_lock); |
| 755 | } else | 755 | } |
| 756 | ;/* printk(KERN_INFO DEVICE_NAME ": lock=%08x\n", | 756 | /* else printk(KERN_INFO DEVICE_NAME ": lock=%08x\n", |
| 757 | ngreadl(0x9310)); */ | 757 | ngreadl(0x9310)); */ |
| 758 | 758 | ||
| 759 | ret = ngene_command_stream_control(dev, chan->number, | 759 | ret = ngene_command_stream_control(dev, chan->number, |
| @@ -1636,7 +1636,7 @@ void ngene_shutdown(struct pci_dev *pdev) | |||
| 1636 | /* device probe/remove calls ************************************************/ | 1636 | /* device probe/remove calls ************************************************/ |
| 1637 | /****************************************************************************/ | 1637 | /****************************************************************************/ |
| 1638 | 1638 | ||
| 1639 | void __devexit ngene_remove(struct pci_dev *pdev) | 1639 | void ngene_remove(struct pci_dev *pdev) |
| 1640 | { | 1640 | { |
| 1641 | struct ngene *dev = pci_get_drvdata(pdev); | 1641 | struct ngene *dev = pci_get_drvdata(pdev); |
| 1642 | int i; | 1642 | int i; |
| @@ -1652,8 +1652,7 @@ void __devexit ngene_remove(struct pci_dev *pdev) | |||
| 1652 | pci_disable_device(pdev); | 1652 | pci_disable_device(pdev); |
| 1653 | } | 1653 | } |
| 1654 | 1654 | ||
| 1655 | int __devinit ngene_probe(struct pci_dev *pci_dev, | 1655 | int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) |
| 1656 | const struct pci_device_id *id) | ||
| 1657 | { | 1656 | { |
| 1658 | struct ngene *dev; | 1657 | struct ngene *dev; |
| 1659 | int stat = 0; | 1658 | int stat = 0; |
| @@ -1691,7 +1690,8 @@ int __devinit ngene_probe(struct pci_dev *pci_dev, | |||
| 1691 | dev->i2c_current_bus = -1; | 1690 | dev->i2c_current_bus = -1; |
| 1692 | 1691 | ||
| 1693 | /* Register DVB adapters and devices for both channels */ | 1692 | /* Register DVB adapters and devices for both channels */ |
| 1694 | if (init_channels(dev) < 0) | 1693 | stat = init_channels(dev); |
| 1694 | if (stat < 0) | ||
| 1695 | goto fail2; | 1695 | goto fail2; |
| 1696 | 1696 | ||
| 1697 | return 0; | 1697 | return 0; |
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h index 5443dc0caea5..22c39ff6bfa0 100644 --- a/drivers/media/pci/ngene/ngene.h +++ b/drivers/media/pci/ngene/ngene.h | |||
| @@ -887,9 +887,8 @@ struct ngene_buffer { | |||
| 887 | 887 | ||
| 888 | 888 | ||
| 889 | /* Provided by ngene-core.c */ | 889 | /* Provided by ngene-core.c */ |
| 890 | int __devinit ngene_probe(struct pci_dev *pci_dev, | 890 | int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id); |
| 891 | const struct pci_device_id *id); | 891 | void ngene_remove(struct pci_dev *pdev); |
| 892 | void __devexit ngene_remove(struct pci_dev *pdev); | ||
| 893 | void ngene_shutdown(struct pci_dev *pdev); | 892 | void ngene_shutdown(struct pci_dev *pdev); |
| 894 | int ngene_command(struct ngene *dev, struct ngene_command *com); | 893 | int ngene_command(struct ngene *dev, struct ngene_command *com); |
| 895 | int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); | 894 | int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); |
diff --git a/drivers/media/pci/pluto2/pluto2.c b/drivers/media/pci/pluto2/pluto2.c index f148b19a206a..2290faee5852 100644 --- a/drivers/media/pci/pluto2/pluto2.c +++ b/drivers/media/pci/pluto2/pluto2.c | |||
| @@ -240,7 +240,7 @@ static void pluto_set_dma_addr(struct pluto *pluto) | |||
| 240 | pluto_writereg(pluto, REG_PCAR, pluto->dma_addr); | 240 | pluto_writereg(pluto, REG_PCAR, pluto->dma_addr); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static int __devinit pluto_dma_map(struct pluto *pluto) | 243 | static int pluto_dma_map(struct pluto *pluto) |
| 244 | { | 244 | { |
| 245 | pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf, | 245 | pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf, |
| 246 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); | 246 | TS_DMA_BYTES, PCI_DMA_FROMDEVICE); |
| @@ -368,7 +368,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id) | |||
| 368 | return IRQ_HANDLED; | 368 | return IRQ_HANDLED; |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | static void __devinit pluto_enable_irqs(struct pluto *pluto) | 371 | static void pluto_enable_irqs(struct pluto *pluto) |
| 372 | { | 372 | { |
| 373 | u32 val = pluto_readreg(pluto, REG_TSCR); | 373 | u32 val = pluto_readreg(pluto, REG_TSCR); |
| 374 | 374 | ||
| @@ -394,7 +394,7 @@ static void pluto_disable_irqs(struct pluto *pluto) | |||
| 394 | pluto_write_tscr(pluto, val); | 394 | pluto_write_tscr(pluto, val); |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | static int __devinit pluto_hw_init(struct pluto *pluto) | 397 | static int pluto_hw_init(struct pluto *pluto) |
| 398 | { | 398 | { |
| 399 | pluto_reset_frontend(pluto, 1); | 399 | pluto_reset_frontend(pluto, 1); |
| 400 | 400 | ||
| @@ -505,7 +505,7 @@ static int pluto2_request_firmware(struct dvb_frontend *fe, | |||
| 505 | return request_firmware(fw, name, &pluto->pdev->dev); | 505 | return request_firmware(fw, name, &pluto->pdev->dev); |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | static struct tda1004x_config pluto2_fe_config __devinitdata = { | 508 | static struct tda1004x_config pluto2_fe_config = { |
| 509 | .demod_address = I2C_ADDR_TDA10046 >> 1, | 509 | .demod_address = I2C_ADDR_TDA10046 >> 1, |
| 510 | .invert = 1, | 510 | .invert = 1, |
| 511 | .invert_oclk = 0, | 511 | .invert_oclk = 0, |
| @@ -515,7 +515,7 @@ static struct tda1004x_config pluto2_fe_config __devinitdata = { | |||
| 515 | .request_firmware = pluto2_request_firmware, | 515 | .request_firmware = pluto2_request_firmware, |
| 516 | }; | 516 | }; |
| 517 | 517 | ||
| 518 | static int __devinit frontend_init(struct pluto *pluto) | 518 | static int frontend_init(struct pluto *pluto) |
| 519 | { | 519 | { |
| 520 | int ret; | 520 | int ret; |
| 521 | 521 | ||
| @@ -536,14 +536,14 @@ static int __devinit frontend_init(struct pluto *pluto) | |||
| 536 | return 0; | 536 | return 0; |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | static void __devinit pluto_read_rev(struct pluto *pluto) | 539 | static void pluto_read_rev(struct pluto *pluto) |
| 540 | { | 540 | { |
| 541 | u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR; | 541 | u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR; |
| 542 | dev_info(&pluto->pdev->dev, "board revision %d.%d\n", | 542 | dev_info(&pluto->pdev->dev, "board revision %d.%d\n", |
| 543 | (val >> 12) & 0x0f, (val >> 4) & 0xff); | 543 | (val >> 12) & 0x0f, (val >> 4) & 0xff); |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | static void __devinit pluto_read_mac(struct pluto *pluto, u8 *mac) | 546 | static void pluto_read_mac(struct pluto *pluto, u8 *mac) |
| 547 | { | 547 | { |
| 548 | u32 val = pluto_readreg(pluto, REG_MMAC); | 548 | u32 val = pluto_readreg(pluto, REG_MMAC); |
| 549 | mac[0] = (val >> 8) & 0xff; | 549 | mac[0] = (val >> 8) & 0xff; |
| @@ -560,7 +560,7 @@ static void __devinit pluto_read_mac(struct pluto *pluto, u8 *mac) | |||
| 560 | dev_info(&pluto->pdev->dev, "MAC %pM\n", mac); | 560 | dev_info(&pluto->pdev->dev, "MAC %pM\n", mac); |
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | static int __devinit pluto_read_serial(struct pluto *pluto) | 563 | static int pluto_read_serial(struct pluto *pluto) |
| 564 | { | 564 | { |
| 565 | struct pci_dev *pdev = pluto->pdev; | 565 | struct pci_dev *pdev = pluto->pdev; |
| 566 | unsigned int i, j; | 566 | unsigned int i, j; |
| @@ -588,8 +588,7 @@ out: | |||
| 588 | return 0; | 588 | return 0; |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | static int __devinit pluto2_probe(struct pci_dev *pdev, | 591 | static int pluto2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 592 | const struct pci_device_id *ent) | ||
| 593 | { | 592 | { |
| 594 | struct pluto *pluto; | 593 | struct pluto *pluto; |
| 595 | struct dvb_adapter *dvb_adapter; | 594 | struct dvb_adapter *dvb_adapter; |
| @@ -742,7 +741,7 @@ err_kfree: | |||
| 742 | goto out; | 741 | goto out; |
| 743 | } | 742 | } |
| 744 | 743 | ||
| 745 | static void __devexit pluto2_remove(struct pci_dev *pdev) | 744 | static void pluto2_remove(struct pci_dev *pdev) |
| 746 | { | 745 | { |
| 747 | struct pluto *pluto = pci_get_drvdata(pdev); | 746 | struct pluto *pluto = pci_get_drvdata(pdev); |
| 748 | struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter; | 747 | struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter; |
| @@ -777,7 +776,7 @@ static void __devexit pluto2_remove(struct pci_dev *pdev) | |||
| 777 | #define PCI_DEVICE_ID_PLUTO2 0x0001 | 776 | #define PCI_DEVICE_ID_PLUTO2 0x0001 |
| 778 | #endif | 777 | #endif |
| 779 | 778 | ||
| 780 | static struct pci_device_id pluto2_id_table[] __devinitdata = { | 779 | static struct pci_device_id pluto2_id_table[] = { |
| 781 | { | 780 | { |
| 782 | .vendor = PCI_VENDOR_ID_SCM, | 781 | .vendor = PCI_VENDOR_ID_SCM, |
| 783 | .device = PCI_DEVICE_ID_PLUTO2, | 782 | .device = PCI_DEVICE_ID_PLUTO2, |
| @@ -794,7 +793,7 @@ static struct pci_driver pluto2_driver = { | |||
| 794 | .name = DRIVER_NAME, | 793 | .name = DRIVER_NAME, |
| 795 | .id_table = pluto2_id_table, | 794 | .id_table = pluto2_id_table, |
| 796 | .probe = pluto2_probe, | 795 | .probe = pluto2_probe, |
| 797 | .remove = __devexit_p(pluto2_remove), | 796 | .remove = pluto2_remove, |
| 798 | }; | 797 | }; |
| 799 | 798 | ||
| 800 | static int __init pluto2_init(void) | 799 | static int __init pluto2_init(void) |
diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c index 15b35c4725f1..e9211086df49 100644 --- a/drivers/media/pci/pt1/pt1.c +++ b/drivers/media/pci/pt1/pt1.c | |||
| @@ -1058,7 +1058,7 @@ static void pt1_i2c_init(struct pt1 *pt1) | |||
| 1058 | pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0); | 1058 | pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0); |
| 1059 | } | 1059 | } |
| 1060 | 1060 | ||
| 1061 | static void __devexit pt1_remove(struct pci_dev *pdev) | 1061 | static void pt1_remove(struct pci_dev *pdev) |
| 1062 | { | 1062 | { |
| 1063 | struct pt1 *pt1; | 1063 | struct pt1 *pt1; |
| 1064 | void __iomem *regs; | 1064 | void __iomem *regs; |
| @@ -1083,8 +1083,7 @@ static void __devexit pt1_remove(struct pci_dev *pdev) | |||
| 1083 | pci_disable_device(pdev); | 1083 | pci_disable_device(pdev); |
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | static int __devinit | 1086 | static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 1087 | pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
| 1088 | { | 1087 | { |
| 1089 | int ret; | 1088 | int ret; |
| 1090 | void __iomem *regs; | 1089 | void __iomem *regs; |
| @@ -1222,7 +1221,7 @@ MODULE_DEVICE_TABLE(pci, pt1_id_table); | |||
| 1222 | static struct pci_driver pt1_driver = { | 1221 | static struct pci_driver pt1_driver = { |
| 1223 | .name = DRIVER_NAME, | 1222 | .name = DRIVER_NAME, |
| 1224 | .probe = pt1_probe, | 1223 | .probe = pt1_probe, |
| 1225 | .remove = __devexit_p(pt1_remove), | 1224 | .remove = pt1_remove, |
| 1226 | .id_table = pt1_id_table, | 1225 | .id_table = pt1_id_table, |
| 1227 | }; | 1226 | }; |
| 1228 | 1227 | ||
diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index f2b37e05b964..e359d200d698 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c | |||
| @@ -754,7 +754,7 @@ static int saa7134_hwfini(struct saa7134_dev *dev) | |||
| 754 | return 0; | 754 | return 0; |
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | static void __devinit must_configure_manually(int has_eeprom) | 757 | static void must_configure_manually(int has_eeprom) |
| 758 | { | 758 | { |
| 759 | unsigned int i,p; | 759 | unsigned int i,p; |
| 760 | 760 | ||
| @@ -860,8 +860,8 @@ static void mpeg_ops_detach(struct saa7134_mpeg_ops *ops, | |||
| 860 | dev->mops = NULL; | 860 | dev->mops = NULL; |
| 861 | } | 861 | } |
| 862 | 862 | ||
| 863 | static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | 863 | static int saa7134_initdev(struct pci_dev *pci_dev, |
| 864 | const struct pci_device_id *pci_id) | 864 | const struct pci_device_id *pci_id) |
| 865 | { | 865 | { |
| 866 | struct saa7134_dev *dev; | 866 | struct saa7134_dev *dev; |
| 867 | struct saa7134_mpeg_ops *mops; | 867 | struct saa7134_mpeg_ops *mops; |
| @@ -944,8 +944,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
| 944 | 944 | ||
| 945 | /* board config */ | 945 | /* board config */ |
| 946 | dev->board = pci_id->driver_data; | 946 | dev->board = pci_id->driver_data; |
| 947 | if (card[dev->nr] >= 0 && | 947 | if ((unsigned)card[dev->nr] < saa7134_bcount) |
| 948 | card[dev->nr] < saa7134_bcount) | ||
| 949 | dev->board = card[dev->nr]; | 948 | dev->board = card[dev->nr]; |
| 950 | if (SAA7134_BOARD_UNKNOWN == dev->board) | 949 | if (SAA7134_BOARD_UNKNOWN == dev->board) |
| 951 | must_configure_manually(0); | 950 | must_configure_manually(0); |
| @@ -1103,7 +1102,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
| 1103 | return err; | 1102 | return err; |
| 1104 | } | 1103 | } |
| 1105 | 1104 | ||
| 1106 | static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | 1105 | static void saa7134_finidev(struct pci_dev *pci_dev) |
| 1107 | { | 1106 | { |
| 1108 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); | 1107 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 1109 | struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); | 1108 | struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); |
| @@ -1323,7 +1322,7 @@ static struct pci_driver saa7134_pci_driver = { | |||
| 1323 | .name = "saa7134", | 1322 | .name = "saa7134", |
| 1324 | .id_table = saa7134_pci_tbl, | 1323 | .id_table = saa7134_pci_tbl, |
| 1325 | .probe = saa7134_initdev, | 1324 | .probe = saa7134_initdev, |
| 1326 | .remove = __devexit_p(saa7134_finidev), | 1325 | .remove = saa7134_finidev, |
| 1327 | #ifdef CONFIG_PM | 1326 | #ifdef CONFIG_PM |
| 1328 | .suspend = saa7134_suspend, | 1327 | .suspend = saa7134_suspend, |
| 1329 | .resume = saa7134_resume | 1328 | .resume = saa7134_resume |
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index 0f78f5e537e2..e761262f7475 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c | |||
| @@ -990,7 +990,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
| 990 | dev->init_data.name = "BeholdTV"; | 990 | dev->init_data.name = "BeholdTV"; |
| 991 | dev->init_data.get_key = get_key_beholdm6xx; | 991 | dev->init_data.get_key = get_key_beholdm6xx; |
| 992 | dev->init_data.ir_codes = RC_MAP_BEHOLD; | 992 | dev->init_data.ir_codes = RC_MAP_BEHOLD; |
| 993 | dev->init_data.type = RC_TYPE_NEC; | 993 | dev->init_data.type = RC_BIT_NEC; |
| 994 | info.addr = 0x2d; | 994 | info.addr = 0x2d; |
| 995 | break; | 995 | break; |
| 996 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: | 996 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: |
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 4a77124ee70e..3abf52711e13 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c | |||
| @@ -2511,7 +2511,7 @@ int saa7134_video_init1(struct saa7134_dev *dev) | |||
| 2511 | /* sanitycheck insmod options */ | 2511 | /* sanitycheck insmod options */ |
| 2512 | if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME) | 2512 | if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME) |
| 2513 | gbuffers = 2; | 2513 | gbuffers = 2; |
| 2514 | if (gbufsize < 0 || gbufsize > gbufsize_max) | 2514 | if (gbufsize > gbufsize_max) |
| 2515 | gbufsize = gbufsize_max; | 2515 | gbufsize = gbufsize_max; |
| 2516 | gbufsize = (gbufsize + PAGE_SIZE - 1) & PAGE_MASK; | 2516 | gbufsize = (gbufsize + PAGE_SIZE - 1) & PAGE_MASK; |
| 2517 | 2517 | ||
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index c24b6512bd8f..075908fae4d9 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h | |||
| @@ -739,7 +739,7 @@ extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); | |||
| 739 | 739 | ||
| 740 | extern struct saa7134_board saa7134_boards[]; | 740 | extern struct saa7134_board saa7134_boards[]; |
| 741 | extern const unsigned int saa7134_bcount; | 741 | extern const unsigned int saa7134_bcount; |
| 742 | extern struct pci_device_id __devinitdata saa7134_pci_tbl[]; | 742 | extern struct pci_device_id saa7134_pci_tbl[]; |
| 743 | 743 | ||
| 744 | extern int saa7134_board_init1(struct saa7134_dev *dev); | 744 | extern int saa7134_board_init1(struct saa7134_dev *dev); |
| 745 | extern int saa7134_board_init2(struct saa7134_dev *dev); | 745 | extern int saa7134_board_init2(struct saa7134_dev *dev); |
diff --git a/drivers/media/pci/saa7164/saa7164-api.c b/drivers/media/pci/saa7164/saa7164-api.c index eff7135cf0e8..e042963d377d 100644 --- a/drivers/media/pci/saa7164/saa7164-api.c +++ b/drivers/media/pci/saa7164/saa7164-api.c | |||
| @@ -165,7 +165,7 @@ int saa7164_api_set_vbi_format(struct saa7164_port *port) | |||
| 165 | return ret; | 165 | return ret; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | int saa7164_api_set_gop_size(struct saa7164_port *port) | 168 | static int saa7164_api_set_gop_size(struct saa7164_port *port) |
| 169 | { | 169 | { |
| 170 | struct saa7164_dev *dev = port->dev; | 170 | struct saa7164_dev *dev = port->dev; |
| 171 | struct tmComResEncVideoGopStructure gs; | 171 | struct tmComResEncVideoGopStructure gs; |
| @@ -619,7 +619,7 @@ int saa7164_api_get_videomux(struct saa7164_port *port) | |||
| 619 | return ret; | 619 | return ret; |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val) | 622 | static int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val) |
| 623 | { | 623 | { |
| 624 | struct saa7164_dev *dev = port->dev; | 624 | struct saa7164_dev *dev = port->dev; |
| 625 | 625 | ||
| @@ -822,8 +822,8 @@ int saa7164_api_read_eeprom(struct saa7164_dev *dev, u8 *buf, int buflen) | |||
| 822 | ®[0], 128, buf); | 822 | ®[0], 128, buf); |
| 823 | } | 823 | } |
| 824 | 824 | ||
| 825 | int saa7164_api_configure_port_vbi(struct saa7164_dev *dev, | 825 | static int saa7164_api_configure_port_vbi(struct saa7164_dev *dev, |
| 826 | struct saa7164_port *port) | 826 | struct saa7164_port *port) |
| 827 | { | 827 | { |
| 828 | struct tmComResVBIFormatDescrHeader *fmt = &port->vbi_fmt_ntsc; | 828 | struct tmComResVBIFormatDescrHeader *fmt = &port->vbi_fmt_ntsc; |
| 829 | 829 | ||
| @@ -858,9 +858,10 @@ int saa7164_api_configure_port_vbi(struct saa7164_dev *dev, | |||
| 858 | return 0; | 858 | return 0; |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | int saa7164_api_configure_port_mpeg2ts(struct saa7164_dev *dev, | 861 | static int |
| 862 | struct saa7164_port *port, | 862 | saa7164_api_configure_port_mpeg2ts(struct saa7164_dev *dev, |
| 863 | struct tmComResTSFormatDescrHeader *tsfmt) | 863 | struct saa7164_port *port, |
| 864 | struct tmComResTSFormatDescrHeader *tsfmt) | ||
| 864 | { | 865 | { |
| 865 | dprintk(DBGLVL_API, " bFormatIndex = 0x%x\n", tsfmt->bFormatIndex); | 866 | dprintk(DBGLVL_API, " bFormatIndex = 0x%x\n", tsfmt->bFormatIndex); |
| 866 | dprintk(DBGLVL_API, " bDataOffset = 0x%x\n", tsfmt->bDataOffset); | 867 | dprintk(DBGLVL_API, " bDataOffset = 0x%x\n", tsfmt->bDataOffset); |
| @@ -892,9 +893,10 @@ int saa7164_api_configure_port_mpeg2ts(struct saa7164_dev *dev, | |||
| 892 | return 0; | 893 | return 0; |
| 893 | } | 894 | } |
| 894 | 895 | ||
| 895 | int saa7164_api_configure_port_mpeg2ps(struct saa7164_dev *dev, | 896 | static int |
| 896 | struct saa7164_port *port, | 897 | saa7164_api_configure_port_mpeg2ps(struct saa7164_dev *dev, |
| 897 | struct tmComResPSFormatDescrHeader *fmt) | 898 | struct saa7164_port *port, |
| 899 | struct tmComResPSFormatDescrHeader *fmt) | ||
| 898 | { | 900 | { |
| 899 | dprintk(DBGLVL_API, " bFormatIndex = 0x%x\n", fmt->bFormatIndex); | 901 | dprintk(DBGLVL_API, " bFormatIndex = 0x%x\n", fmt->bFormatIndex); |
| 900 | dprintk(DBGLVL_API, " wPacketLength= 0x%x\n", fmt->wPacketLength); | 902 | dprintk(DBGLVL_API, " wPacketLength= 0x%x\n", fmt->wPacketLength); |
| @@ -925,7 +927,7 @@ int saa7164_api_configure_port_mpeg2ps(struct saa7164_dev *dev, | |||
| 925 | return 0; | 927 | return 0; |
| 926 | } | 928 | } |
| 927 | 929 | ||
| 928 | int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) | 930 | static int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) |
| 929 | { | 931 | { |
| 930 | struct saa7164_port *tsport = NULL; | 932 | struct saa7164_port *tsport = NULL; |
| 931 | struct saa7164_port *encport = NULL; | 933 | struct saa7164_port *encport = NULL; |
| @@ -1486,7 +1488,7 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 addr, u32 datalen, | |||
| 1486 | return ret == SAA_OK ? 0 : -EIO; | 1488 | return ret == SAA_OK ? 0 : -EIO; |
| 1487 | } | 1489 | } |
| 1488 | 1490 | ||
| 1489 | int saa7164_api_modify_gpio(struct saa7164_dev *dev, u8 unitid, | 1491 | static int saa7164_api_modify_gpio(struct saa7164_dev *dev, u8 unitid, |
| 1490 | u8 pin, u8 state) | 1492 | u8 pin, u8 state) |
| 1491 | { | 1493 | { |
| 1492 | int ret; | 1494 | int ret; |
diff --git a/drivers/media/pci/saa7164/saa7164-bus.c b/drivers/media/pci/saa7164/saa7164-bus.c index a7f58a998752..5f6f3094c44e 100644 --- a/drivers/media/pci/saa7164/saa7164-bus.c +++ b/drivers/media/pci/saa7164/saa7164-bus.c | |||
| @@ -81,7 +81,7 @@ void saa7164_bus_dump(struct saa7164_dev *dev) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | /* Intensionally throw a BUG() if the state of the message bus looks corrupt */ | 83 | /* Intensionally throw a BUG() if the state of the message bus looks corrupt */ |
| 84 | void saa7164_bus_verify(struct saa7164_dev *dev) | 84 | static void saa7164_bus_verify(struct saa7164_dev *dev) |
| 85 | { | 85 | { |
| 86 | struct tmComResBusInfo *b = &dev->bus; | 86 | struct tmComResBusInfo *b = &dev->bus; |
| 87 | int bug = 0; | 87 | int bug = 0; |
| @@ -106,8 +106,8 @@ void saa7164_bus_verify(struct saa7164_dev *dev) | |||
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m, | 109 | static void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo *m, |
| 110 | void *buf) | 110 | void *buf) |
| 111 | { | 111 | { |
| 112 | dprintk(DBGLVL_BUS, "Dumping msg structure:\n"); | 112 | dprintk(DBGLVL_BUS, "Dumping msg structure:\n"); |
| 113 | dprintk(DBGLVL_BUS, " .id = %d\n", m->id); | 113 | dprintk(DBGLVL_BUS, " .id = %d\n", m->id); |
diff --git a/drivers/media/pci/saa7164/saa7164-cmd.c b/drivers/media/pci/saa7164/saa7164-cmd.c index 62fac7f9d04e..cfabcbacc33d 100644 --- a/drivers/media/pci/saa7164/saa7164-cmd.c +++ b/drivers/media/pci/saa7164/saa7164-cmd.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include "saa7164.h" | 24 | #include "saa7164.h" |
| 25 | 25 | ||
| 26 | int saa7164_cmd_alloc_seqno(struct saa7164_dev *dev) | 26 | static int saa7164_cmd_alloc_seqno(struct saa7164_dev *dev) |
| 27 | { | 27 | { |
| 28 | int i, ret = -1; | 28 | int i, ret = -1; |
| 29 | 29 | ||
| @@ -42,7 +42,7 @@ int saa7164_cmd_alloc_seqno(struct saa7164_dev *dev) | |||
| 42 | return ret; | 42 | return ret; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void saa7164_cmd_free_seqno(struct saa7164_dev *dev, u8 seqno) | 45 | static void saa7164_cmd_free_seqno(struct saa7164_dev *dev, u8 seqno) |
| 46 | { | 46 | { |
| 47 | mutex_lock(&dev->lock); | 47 | mutex_lock(&dev->lock); |
| 48 | if ((dev->cmds[seqno].inuse == 1) && | 48 | if ((dev->cmds[seqno].inuse == 1) && |
| @@ -54,7 +54,7 @@ void saa7164_cmd_free_seqno(struct saa7164_dev *dev, u8 seqno) | |||
| 54 | mutex_unlock(&dev->lock); | 54 | mutex_unlock(&dev->lock); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | void saa7164_cmd_timeout_seqno(struct saa7164_dev *dev, u8 seqno) | 57 | static void saa7164_cmd_timeout_seqno(struct saa7164_dev *dev, u8 seqno) |
| 58 | { | 58 | { |
| 59 | mutex_lock(&dev->lock); | 59 | mutex_lock(&dev->lock); |
| 60 | if ((dev->cmds[seqno].inuse == 1) && | 60 | if ((dev->cmds[seqno].inuse == 1) && |
| @@ -64,7 +64,7 @@ void saa7164_cmd_timeout_seqno(struct saa7164_dev *dev, u8 seqno) | |||
| 64 | mutex_unlock(&dev->lock); | 64 | mutex_unlock(&dev->lock); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | u32 saa7164_cmd_timeout_get(struct saa7164_dev *dev, u8 seqno) | 67 | static u32 saa7164_cmd_timeout_get(struct saa7164_dev *dev, u8 seqno) |
| 68 | { | 68 | { |
| 69 | int ret = 0; | 69 | int ret = 0; |
| 70 | 70 | ||
| @@ -132,7 +132,7 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev) | |||
| 132 | 132 | ||
| 133 | /* Commands to the f/w get marshelled to/from this code then onto the PCI | 133 | /* Commands to the f/w get marshelled to/from this code then onto the PCI |
| 134 | * -bus/c running buffer. */ | 134 | * -bus/c running buffer. */ |
| 135 | int saa7164_cmd_dequeue(struct saa7164_dev *dev) | 135 | static int saa7164_cmd_dequeue(struct saa7164_dev *dev) |
| 136 | { | 136 | { |
| 137 | int loop = 1; | 137 | int loop = 1; |
| 138 | int ret; | 138 | int ret; |
| @@ -186,8 +186,8 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev) | |||
| 186 | return SAA_OK; | 186 | return SAA_OK; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | int saa7164_cmd_set(struct saa7164_dev *dev, struct tmComResInfo *msg, | 189 | static int saa7164_cmd_set(struct saa7164_dev *dev, struct tmComResInfo *msg, |
| 190 | void *buf) | 190 | void *buf) |
| 191 | { | 191 | { |
| 192 | struct tmComResBusInfo *bus = &dev->bus; | 192 | struct tmComResBusInfo *bus = &dev->bus; |
| 193 | u8 cmd_sent; | 193 | u8 cmd_sent; |
| @@ -259,7 +259,7 @@ out: | |||
| 259 | /* Wait for a signal event, without holding a mutex. Either return TIMEOUT if | 259 | /* Wait for a signal event, without holding a mutex. Either return TIMEOUT if |
| 260 | * the event never occurred, or SAA_OK if it was signaled during the wait. | 260 | * the event never occurred, or SAA_OK if it was signaled during the wait. |
| 261 | */ | 261 | */ |
| 262 | int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno) | 262 | static int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno) |
| 263 | { | 263 | { |
| 264 | wait_queue_head_t *q = NULL; | 264 | wait_queue_head_t *q = NULL; |
| 265 | int ret = SAA_BUS_TIMEOUT; | 265 | int ret = SAA_BUS_TIMEOUT; |
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c index 2c9ad878bef3..63502e7a2a76 100644 --- a/drivers/media/pci/saa7164/saa7164-core.c +++ b/drivers/media/pci/saa7164/saa7164-core.c | |||
| @@ -410,7 +410,7 @@ static void saa7164_work_enchandler(struct work_struct *w) | |||
| 410 | } else | 410 | } else |
| 411 | rp = (port->last_svc_rp + 1) % 8; | 411 | rp = (port->last_svc_rp + 1) % 8; |
| 412 | 412 | ||
| 413 | if ((rp < 0) || (rp > (port->hwcfg.buffercount - 1))) { | 413 | if (rp > (port->hwcfg.buffercount - 1)) { |
| 414 | printk(KERN_ERR "%s() illegal rp count %d\n", __func__, rp); | 414 | printk(KERN_ERR "%s() illegal rp count %d\n", __func__, rp); |
| 415 | break; | 415 | break; |
| 416 | } | 416 | } |
| @@ -486,7 +486,7 @@ static void saa7164_work_vbihandler(struct work_struct *w) | |||
| 486 | } else | 486 | } else |
| 487 | rp = (port->last_svc_rp + 1) % 8; | 487 | rp = (port->last_svc_rp + 1) % 8; |
| 488 | 488 | ||
| 489 | if ((rp < 0) || (rp > (port->hwcfg.buffercount - 1))) { | 489 | if (rp > (port->hwcfg.buffercount - 1)) { |
| 490 | printk(KERN_ERR "%s() illegal rp count %d\n", __func__, rp); | 490 | printk(KERN_ERR "%s() illegal rp count %d\n", __func__, rp); |
| 491 | break; | 491 | break; |
| 492 | } | 492 | } |
| @@ -1185,8 +1185,8 @@ static int saa7164_thread_function(void *data) | |||
| 1185 | return 0; | 1185 | return 0; |
| 1186 | } | 1186 | } |
| 1187 | 1187 | ||
| 1188 | static int __devinit saa7164_initdev(struct pci_dev *pci_dev, | 1188 | static int saa7164_initdev(struct pci_dev *pci_dev, |
| 1189 | const struct pci_device_id *pci_id) | 1189 | const struct pci_device_id *pci_id) |
| 1190 | { | 1190 | { |
| 1191 | struct saa7164_dev *dev; | 1191 | struct saa7164_dev *dev; |
| 1192 | int err, i; | 1192 | int err, i; |
| @@ -1376,7 +1376,7 @@ static void saa7164_shutdown(struct saa7164_dev *dev) | |||
| 1376 | dprintk(1, "%s()\n", __func__); | 1376 | dprintk(1, "%s()\n", __func__); |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
| 1379 | static void __devexit saa7164_finidev(struct pci_dev *pci_dev) | 1379 | static void saa7164_finidev(struct pci_dev *pci_dev) |
| 1380 | { | 1380 | { |
| 1381 | struct saa7164_dev *dev = pci_get_drvdata(pci_dev); | 1381 | struct saa7164_dev *dev = pci_get_drvdata(pci_dev); |
| 1382 | 1382 | ||
| @@ -1459,7 +1459,7 @@ static struct pci_driver saa7164_pci_driver = { | |||
| 1459 | .name = "saa7164", | 1459 | .name = "saa7164", |
| 1460 | .id_table = saa7164_pci_tbl, | 1460 | .id_table = saa7164_pci_tbl, |
| 1461 | .probe = saa7164_initdev, | 1461 | .probe = saa7164_initdev, |
| 1462 | .remove = __devexit_p(saa7164_finidev), | 1462 | .remove = saa7164_finidev, |
| 1463 | /* TODO */ | 1463 | /* TODO */ |
| 1464 | .suspend = NULL, | 1464 | .suspend = NULL, |
| 1465 | .resume = NULL, | 1465 | .resume = NULL, |
diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c index a9ed686ad08a..994018e2d0d6 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c | |||
| @@ -1101,7 +1101,8 @@ static int fops_release(struct file *file) | |||
| 1101 | return 0; | 1101 | return 0; |
| 1102 | } | 1102 | } |
| 1103 | 1103 | ||
| 1104 | struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port) | 1104 | static struct |
| 1105 | saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port) | ||
| 1105 | { | 1106 | { |
| 1106 | struct saa7164_user_buffer *ubuf = NULL; | 1107 | struct saa7164_user_buffer *ubuf = NULL; |
| 1107 | struct saa7164_dev *dev = port->dev; | 1108 | struct saa7164_dev *dev = port->dev; |
| @@ -1287,8 +1288,8 @@ static const struct v4l2_file_operations mpeg_fops = { | |||
| 1287 | .unlocked_ioctl = video_ioctl2, | 1288 | .unlocked_ioctl = video_ioctl2, |
| 1288 | }; | 1289 | }; |
| 1289 | 1290 | ||
| 1290 | int saa7164_g_chip_ident(struct file *file, void *fh, | 1291 | static int saa7164_g_chip_ident(struct file *file, void *fh, |
| 1291 | struct v4l2_dbg_chip_ident *chip) | 1292 | struct v4l2_dbg_chip_ident *chip) |
| 1292 | { | 1293 | { |
| 1293 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; | 1294 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; |
| 1294 | struct saa7164_dev *dev = port->dev; | 1295 | struct saa7164_dev *dev = port->dev; |
| @@ -1297,8 +1298,8 @@ int saa7164_g_chip_ident(struct file *file, void *fh, | |||
| 1297 | return 0; | 1298 | return 0; |
| 1298 | } | 1299 | } |
| 1299 | 1300 | ||
| 1300 | int saa7164_g_register(struct file *file, void *fh, | 1301 | static int saa7164_g_register(struct file *file, void *fh, |
| 1301 | struct v4l2_dbg_register *reg) | 1302 | struct v4l2_dbg_register *reg) |
| 1302 | { | 1303 | { |
| 1303 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; | 1304 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; |
| 1304 | struct saa7164_dev *dev = port->dev; | 1305 | struct saa7164_dev *dev = port->dev; |
| @@ -1310,8 +1311,8 @@ int saa7164_g_register(struct file *file, void *fh, | |||
| 1310 | return 0; | 1311 | return 0; |
| 1311 | } | 1312 | } |
| 1312 | 1313 | ||
| 1313 | int saa7164_s_register(struct file *file, void *fh, | 1314 | static int saa7164_s_register(struct file *file, void *fh, |
| 1314 | struct v4l2_dbg_register *reg) | 1315 | struct v4l2_dbg_register *reg) |
| 1315 | { | 1316 | { |
| 1316 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; | 1317 | struct saa7164_port *port = ((struct saa7164_encoder_fh *)fh)->port; |
| 1317 | struct saa7164_dev *dev = port->dev; | 1318 | struct saa7164_dev *dev = port->dev; |
diff --git a/drivers/media/pci/saa7164/saa7164-fw.c b/drivers/media/pci/saa7164/saa7164-fw.c index a266bf0169e6..86763203d61d 100644 --- a/drivers/media/pci/saa7164/saa7164-fw.c +++ b/drivers/media/pci/saa7164/saa7164-fw.c | |||
| @@ -37,7 +37,7 @@ struct fw_header { | |||
| 37 | u32 version; | 37 | u32 version; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | int saa7164_dl_wait_ack(struct saa7164_dev *dev, u32 reg) | 40 | static int saa7164_dl_wait_ack(struct saa7164_dev *dev, u32 reg) |
| 41 | { | 41 | { |
| 42 | u32 timeout = SAA_DEVICE_TIMEOUT; | 42 | u32 timeout = SAA_DEVICE_TIMEOUT; |
| 43 | while ((saa7164_readl(reg) & 0x01) == 0) { | 43 | while ((saa7164_readl(reg) & 0x01) == 0) { |
| @@ -53,7 +53,7 @@ int saa7164_dl_wait_ack(struct saa7164_dev *dev, u32 reg) | |||
| 53 | return 0; | 53 | return 0; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | int saa7164_dl_wait_clr(struct saa7164_dev *dev, u32 reg) | 56 | static int saa7164_dl_wait_clr(struct saa7164_dev *dev, u32 reg) |
| 57 | { | 57 | { |
| 58 | u32 timeout = SAA_DEVICE_TIMEOUT; | 58 | u32 timeout = SAA_DEVICE_TIMEOUT; |
| 59 | while (saa7164_readl(reg) & 0x01) { | 59 | while (saa7164_readl(reg) & 0x01) { |
| @@ -71,8 +71,8 @@ int saa7164_dl_wait_clr(struct saa7164_dev *dev, u32 reg) | |||
| 71 | 71 | ||
| 72 | /* TODO: move dlflags into dev-> and change to write/readl/b */ | 72 | /* TODO: move dlflags into dev-> and change to write/readl/b */ |
| 73 | /* TODO: Excessive levels of debug */ | 73 | /* TODO: Excessive levels of debug */ |
| 74 | int saa7164_downloadimage(struct saa7164_dev *dev, u8 *src, u32 srcsize, | 74 | static int saa7164_downloadimage(struct saa7164_dev *dev, u8 *src, u32 srcsize, |
| 75 | u32 dlflags, u8 *dst, u32 dstsize) | 75 | u32 dlflags, u8 *dst, u32 dstsize) |
| 76 | { | 76 | { |
| 77 | u32 reg, timeout, offset; | 77 | u32 reg, timeout, offset; |
| 78 | u8 *srcbuf = NULL; | 78 | u8 *srcbuf = NULL; |
diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c index d8e6c8f14079..b4532299c0ed 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c | |||
| @@ -984,7 +984,8 @@ out: | |||
| 984 | return ret; | 984 | return ret; |
| 985 | } | 985 | } |
| 986 | 986 | ||
| 987 | int saa7164_vbi_fmt(struct file *file, void *priv, struct v4l2_format *f) | 987 | static int saa7164_vbi_fmt(struct file *file, void *priv, |
| 988 | struct v4l2_format *f) | ||
| 988 | { | 989 | { |
| 989 | /* ntsc */ | 990 | /* ntsc */ |
| 990 | f->fmt.vbi.samples_per_line = 1600; | 991 | f->fmt.vbi.samples_per_line = 1600; |
| @@ -1047,7 +1048,8 @@ static int fops_release(struct file *file) | |||
| 1047 | return 0; | 1048 | return 0; |
| 1048 | } | 1049 | } |
| 1049 | 1050 | ||
| 1050 | struct saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port) | 1051 | static struct |
| 1052 | saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port) | ||
| 1051 | { | 1053 | { |
| 1052 | struct saa7164_user_buffer *ubuf = NULL; | 1054 | struct saa7164_user_buffer *ubuf = NULL; |
| 1053 | struct saa7164_dev *dev = port->dev; | 1055 | struct saa7164_dev *dev = port->dev; |
diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c index 4c10205264d4..27ae48842656 100644 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c | |||
| @@ -1205,8 +1205,8 @@ static void vip_gpio_release(struct device *dev, int pin, const char *name) | |||
| 1205 | * | 1205 | * |
| 1206 | * -ENODEV, device could not be detected or registered | 1206 | * -ENODEV, device could not be detected or registered |
| 1207 | */ | 1207 | */ |
| 1208 | static int __devinit sta2x11_vip_init_one(struct pci_dev *pdev, | 1208 | static int sta2x11_vip_init_one(struct pci_dev *pdev, |
| 1209 | const struct pci_device_id *ent) | 1209 | const struct pci_device_id *ent) |
| 1210 | { | 1210 | { |
| 1211 | int ret; | 1211 | int ret; |
| 1212 | struct sta2x11_vip *vip; | 1212 | struct sta2x11_vip *vip; |
| @@ -1376,7 +1376,7 @@ disable: | |||
| 1376 | * free memory | 1376 | * free memory |
| 1377 | * free GPIO pins | 1377 | * free GPIO pins |
| 1378 | */ | 1378 | */ |
| 1379 | static void __devexit sta2x11_vip_remove_one(struct pci_dev *pdev) | 1379 | static void sta2x11_vip_remove_one(struct pci_dev *pdev) |
| 1380 | { | 1380 | { |
| 1381 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); | 1381 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); |
| 1382 | struct sta2x11_vip *vip = | 1382 | struct sta2x11_vip *vip = |
| @@ -1517,7 +1517,7 @@ static DEFINE_PCI_DEVICE_TABLE(sta2x11_vip_pci_tbl) = { | |||
| 1517 | static struct pci_driver sta2x11_vip_driver = { | 1517 | static struct pci_driver sta2x11_vip_driver = { |
| 1518 | .name = DRV_NAME, | 1518 | .name = DRV_NAME, |
| 1519 | .probe = sta2x11_vip_init_one, | 1519 | .probe = sta2x11_vip_init_one, |
| 1520 | .remove = __devexit_p(sta2x11_vip_remove_one), | 1520 | .remove = sta2x11_vip_remove_one, |
| 1521 | .id_table = sta2x11_vip_pci_tbl, | 1521 | .id_table = sta2x11_vip_pci_tbl, |
| 1522 | #ifdef CONFIG_PM | 1522 | #ifdef CONFIG_PM |
| 1523 | .suspend = sta2x11_vip_suspend, | 1523 | .suspend = sta2x11_vip_suspend, |
diff --git a/drivers/media/pci/ttpci/av7110.c b/drivers/media/pci/ttpci/av7110.c index 4bd8bd56befc..4656d4a10af0 100644 --- a/drivers/media/pci/ttpci/av7110.c +++ b/drivers/media/pci/ttpci/av7110.c | |||
| @@ -2367,8 +2367,8 @@ static int frontend_init(struct av7110 *av7110) | |||
| 2367 | * The same behaviour of missing VSYNC can be duplicated on budget | 2367 | * The same behaviour of missing VSYNC can be duplicated on budget |
| 2368 | * cards, by seting DD1_INIT trigger mode 7 in 3rd nibble. | 2368 | * cards, by seting DD1_INIT trigger mode 7 in 3rd nibble. |
| 2369 | */ | 2369 | */ |
| 2370 | static int __devinit av7110_attach(struct saa7146_dev* dev, | 2370 | static int av7110_attach(struct saa7146_dev* dev, |
| 2371 | struct saa7146_pci_extension_data *pci_ext) | 2371 | struct saa7146_pci_extension_data *pci_ext) |
| 2372 | { | 2372 | { |
| 2373 | const int length = TS_WIDTH * TS_HEIGHT; | 2373 | const int length = TS_WIDTH * TS_HEIGHT; |
| 2374 | struct pci_dev *pdev = dev->pci; | 2374 | struct pci_dev *pdev = dev->pci; |
| @@ -2761,7 +2761,7 @@ err_kfree_0: | |||
| 2761 | goto out; | 2761 | goto out; |
| 2762 | } | 2762 | } |
| 2763 | 2763 | ||
| 2764 | static int __devexit av7110_detach(struct saa7146_dev* saa) | 2764 | static int av7110_detach(struct saa7146_dev* saa) |
| 2765 | { | 2765 | { |
| 2766 | struct av7110 *av7110 = saa->ext_priv; | 2766 | struct av7110 *av7110 = saa->ext_priv; |
| 2767 | dprintk(4, "%p\n", av7110); | 2767 | dprintk(4, "%p\n", av7110); |
| @@ -2910,7 +2910,7 @@ static struct saa7146_extension av7110_extension_driver = { | |||
| 2910 | .module = THIS_MODULE, | 2910 | .module = THIS_MODULE, |
| 2911 | .pci_tbl = &pci_tbl[0], | 2911 | .pci_tbl = &pci_tbl[0], |
| 2912 | .attach = av7110_attach, | 2912 | .attach = av7110_attach, |
| 2913 | .detach = __devexit_p(av7110_detach), | 2913 | .detach = av7110_detach, |
| 2914 | 2914 | ||
| 2915 | .irq_mask = MASK_19 | MASK_03 | MASK_10, | 2915 | .irq_mask = MASK_19 | MASK_03 | MASK_10, |
| 2916 | .irq_func = av7110_irq, | 2916 | .irq_func = av7110_irq, |
diff --git a/drivers/media/pci/ttpci/av7110.h b/drivers/media/pci/ttpci/av7110.h index 88b3b2d6cc0e..a378662b1dcf 100644 --- a/drivers/media/pci/ttpci/av7110.h +++ b/drivers/media/pci/ttpci/av7110.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/netdevice.h> | 6 | #include <linux/netdevice.h> |
| 7 | #include <linux/i2c.h> | 7 | #include <linux/i2c.h> |
| 8 | #include <linux/input.h> | 8 | #include <linux/input.h> |
| 9 | #include <linux/time.h> | ||
| 9 | 10 | ||
| 10 | #include <linux/dvb/video.h> | 11 | #include <linux/dvb/video.h> |
| 11 | #include <linux/dvb/audio.h> | 12 | #include <linux/dvb/audio.h> |
diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c index 908f272fe26c..eb822862a646 100644 --- a/drivers/media/pci/ttpci/av7110_ir.c +++ b/drivers/media/pci/ttpci/av7110_ir.c | |||
| @@ -324,7 +324,7 @@ static void ir_handler(struct av7110 *av7110, u32 ircom) | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | 326 | ||
| 327 | int __devinit av7110_ir_init(struct av7110 *av7110) | 327 | int av7110_ir_init(struct av7110 *av7110) |
| 328 | { | 328 | { |
| 329 | struct input_dev *input_dev; | 329 | struct input_dev *input_dev; |
| 330 | static struct proc_dir_entry *e; | 330 | static struct proc_dir_entry *e; |
| @@ -385,7 +385,7 @@ int __devinit av7110_ir_init(struct av7110 *av7110) | |||
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | 387 | ||
| 388 | void __devexit av7110_ir_exit(struct av7110 *av7110) | 388 | void av7110_ir_exit(struct av7110 *av7110) |
| 389 | { | 389 | { |
| 390 | int i; | 390 | int i; |
| 391 | 391 | ||
diff --git a/drivers/media/pci/ttpci/budget-av.c b/drivers/media/pci/ttpci/budget-av.c index 12ddb53c58dc..1f8b1bb0bf9f 100644 --- a/drivers/media/pci/ttpci/budget-av.c +++ b/drivers/media/pci/ttpci/budget-av.c | |||
| @@ -1477,8 +1477,8 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio | |||
| 1477 | 1477 | ||
| 1478 | if (saa7113_init(budget_av) == 0) { | 1478 | if (saa7113_init(budget_av) == 0) { |
| 1479 | budget_av->has_saa7113 = 1; | 1479 | budget_av->has_saa7113 = 1; |
| 1480 | 1480 | err = saa7146_vv_init(dev, &vv_data); | |
| 1481 | if (0 != saa7146_vv_init(dev, &vv_data)) { | 1481 | if (err != 0) { |
| 1482 | /* fixme: proper cleanup here */ | 1482 | /* fixme: proper cleanup here */ |
| 1483 | ERR("cannot init vv subsystem\n"); | 1483 | ERR("cannot init vv subsystem\n"); |
| 1484 | return err; | 1484 | return err; |
diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c index fffc54b452c8..a90a3b9b09bf 100644 --- a/drivers/media/pci/zoran/zoran_card.c +++ b/drivers/media/pci/zoran/zoran_card.c | |||
| @@ -369,7 +369,7 @@ static const unsigned short bt819_addrs[] = { 0x45, I2C_CLIENT_END }; | |||
| 369 | static const unsigned short bt856_addrs[] = { 0x44, I2C_CLIENT_END }; | 369 | static const unsigned short bt856_addrs[] = { 0x44, I2C_CLIENT_END }; |
| 370 | static const unsigned short bt866_addrs[] = { 0x44, I2C_CLIENT_END }; | 370 | static const unsigned short bt866_addrs[] = { 0x44, I2C_CLIENT_END }; |
| 371 | 371 | ||
| 372 | static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | 372 | static struct card_info zoran_cards[NUM_CARDS] = { |
| 373 | { | 373 | { |
| 374 | .type = DC10_old, | 374 | .type = DC10_old, |
| 375 | .name = "DC10(old)", | 375 | .name = "DC10(old)", |
| @@ -948,8 +948,7 @@ zoran_open_init_params (struct zoran *zr) | |||
| 948 | zr->testing = 0; | 948 | zr->testing = 0; |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | static void __devinit | 951 | static void test_interrupts (struct zoran *zr) |
| 952 | test_interrupts (struct zoran *zr) | ||
| 953 | { | 952 | { |
| 954 | DEFINE_WAIT(wait); | 953 | DEFINE_WAIT(wait); |
| 955 | int timeout, icr; | 954 | int timeout, icr; |
| @@ -974,8 +973,7 @@ test_interrupts (struct zoran *zr) | |||
| 974 | btwrite(icr, ZR36057_ICR); | 973 | btwrite(icr, ZR36057_ICR); |
| 975 | } | 974 | } |
| 976 | 975 | ||
| 977 | static int __devinit | 976 | static int zr36057_init (struct zoran *zr) |
| 978 | zr36057_init (struct zoran *zr) | ||
| 979 | { | 977 | { |
| 980 | int j, err; | 978 | int j, err; |
| 981 | 979 | ||
| @@ -1083,7 +1081,7 @@ exit_free: | |||
| 1083 | return err; | 1081 | return err; |
| 1084 | } | 1082 | } |
| 1085 | 1083 | ||
| 1086 | static void __devexit zoran_remove(struct pci_dev *pdev) | 1084 | static void zoran_remove(struct pci_dev *pdev) |
| 1087 | { | 1085 | { |
| 1088 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); | 1086 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); |
| 1089 | struct zoran *zr = to_zoran(v4l2_dev); | 1087 | struct zoran *zr = to_zoran(v4l2_dev); |
| @@ -1129,9 +1127,8 @@ zoran_vdev_release (struct video_device *vdev) | |||
| 1129 | kfree(vdev); | 1127 | kfree(vdev); |
| 1130 | } | 1128 | } |
| 1131 | 1129 | ||
| 1132 | static struct videocodec_master * __devinit | 1130 | static struct videocodec_master *zoran_setup_videocodec(struct zoran *zr, |
| 1133 | zoran_setup_videocodec (struct zoran *zr, | 1131 | int type) |
| 1134 | int type) | ||
| 1135 | { | 1132 | { |
| 1136 | struct videocodec_master *m = NULL; | 1133 | struct videocodec_master *m = NULL; |
| 1137 | 1134 | ||
| @@ -1192,8 +1189,7 @@ static void zoran_subdev_notify(struct v4l2_subdev *sd, unsigned int cmd, void * | |||
| 1192 | * Scan for a Buz card (actually for the PCI controller ZR36057), | 1189 | * Scan for a Buz card (actually for the PCI controller ZR36057), |
| 1193 | * request the irq and map the io memory | 1190 | * request the irq and map the io memory |
| 1194 | */ | 1191 | */ |
| 1195 | static int __devinit zoran_probe(struct pci_dev *pdev, | 1192 | static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 1196 | const struct pci_device_id *ent) | ||
| 1197 | { | 1193 | { |
| 1198 | unsigned char latency, need_latency; | 1194 | unsigned char latency, need_latency; |
| 1199 | struct zoran *zr; | 1195 | struct zoran *zr; |
| @@ -1459,7 +1455,7 @@ static struct pci_driver zoran_driver = { | |||
| 1459 | .name = "zr36067", | 1455 | .name = "zr36067", |
| 1460 | .id_table = zr36067_pci_tbl, | 1456 | .id_table = zr36067_pci_tbl, |
| 1461 | .probe = zoran_probe, | 1457 | .probe = zoran_probe, |
| 1462 | .remove = __devexit_p(zoran_remove), | 1458 | .remove = zoran_remove, |
| 1463 | }; | 1459 | }; |
| 1464 | 1460 | ||
| 1465 | static int __init zoran_init(void) | 1461 | static int __init zoran_init(void) |
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c index 53f12c7466b0..e60ae41e2319 100644 --- a/drivers/media/pci/zoran/zoran_driver.c +++ b/drivers/media/pci/zoran/zoran_driver.c | |||
| @@ -3080,7 +3080,7 @@ static const struct v4l2_file_operations zoran_fops = { | |||
| 3080 | .poll = zoran_poll, | 3080 | .poll = zoran_poll, |
| 3081 | }; | 3081 | }; |
| 3082 | 3082 | ||
| 3083 | struct video_device zoran_template __devinitdata = { | 3083 | struct video_device zoran_template = { |
| 3084 | .name = ZORAN_NAME, | 3084 | .name = ZORAN_NAME, |
| 3085 | .fops = &zoran_fops, | 3085 | .fops = &zoran_fops, |
| 3086 | .ioctl_ops = &zoran_ioctl_ops, | 3086 | .ioctl_ops = &zoran_ioctl_ops, |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 181c7686e412..3dcfea612c42 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
| @@ -109,6 +109,18 @@ config VIDEO_OMAP3_DEBUG | |||
| 109 | ---help--- | 109 | ---help--- |
| 110 | Enable debug messages on OMAP 3 camera controller driver. | 110 | Enable debug messages on OMAP 3 camera controller driver. |
| 111 | 111 | ||
| 112 | config VIDEO_S3C_CAMIF | ||
| 113 | tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver" | ||
| 114 | depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API | ||
| 115 | depends on (PLAT_S3C64XX || PLAT_S3C24XX) && PM_RUNTIME | ||
| 116 | select VIDEOBUF2_DMA_CONTIG | ||
| 117 | ---help--- | ||
| 118 | This is a v4l2 driver for s3c24xx and s3c64xx SoC series camera | ||
| 119 | host interface (CAMIF). | ||
| 120 | |||
| 121 | To compile this driver as a module, choose M here: the module | ||
| 122 | will be called s3c-camif. | ||
| 123 | |||
| 112 | source "drivers/media/platform/soc_camera/Kconfig" | 124 | source "drivers/media/platform/soc_camera/Kconfig" |
| 113 | source "drivers/media/platform/s5p-fimc/Kconfig" | 125 | source "drivers/media/platform/s5p-fimc/Kconfig" |
| 114 | source "drivers/media/platform/s5p-tv/Kconfig" | 126 | source "drivers/media/platform/s5p-tv/Kconfig" |
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index baaa55026c8e..4817d2802171 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile | |||
| @@ -27,6 +27,7 @@ obj-$(CONFIG_VIDEO_CODA) += coda.o | |||
| 27 | 27 | ||
| 28 | obj-$(CONFIG_VIDEO_MEM2MEM_DEINTERLACE) += m2m-deinterlace.o | 28 | obj-$(CONFIG_VIDEO_MEM2MEM_DEINTERLACE) += m2m-deinterlace.o |
| 29 | 29 | ||
| 30 | obj-$(CONFIG_VIDEO_S3C_CAMIF) += s3c-camif/ | ||
| 30 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) += s5p-fimc/ | 31 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) += s5p-fimc/ |
| 31 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg/ | 32 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg/ |
| 32 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc/ | 33 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc/ |
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index cb2eb26850b1..1aad2a65d2f3 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c | |||
| @@ -862,7 +862,7 @@ static struct v4l2_file_operations bcap_fops = { | |||
| 862 | .poll = bcap_poll | 862 | .poll = bcap_poll |
| 863 | }; | 863 | }; |
| 864 | 864 | ||
| 865 | static int __devinit bcap_probe(struct platform_device *pdev) | 865 | static int bcap_probe(struct platform_device *pdev) |
| 866 | { | 866 | { |
| 867 | struct bcap_device *bcap_dev; | 867 | struct bcap_device *bcap_dev; |
| 868 | struct video_device *vfd; | 868 | struct video_device *vfd; |
| @@ -1026,7 +1026,7 @@ err_free_dev: | |||
| 1026 | return ret; | 1026 | return ret; |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| 1029 | static int __devexit bcap_remove(struct platform_device *pdev) | 1029 | static int bcap_remove(struct platform_device *pdev) |
| 1030 | { | 1030 | { |
| 1031 | struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); | 1031 | struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); |
| 1032 | struct bcap_device *bcap_dev = container_of(v4l2_dev, | 1032 | struct bcap_device *bcap_dev = container_of(v4l2_dev, |
| @@ -1048,21 +1048,9 @@ static struct platform_driver bcap_driver = { | |||
| 1048 | .owner = THIS_MODULE, | 1048 | .owner = THIS_MODULE, |
| 1049 | }, | 1049 | }, |
| 1050 | .probe = bcap_probe, | 1050 | .probe = bcap_probe, |
| 1051 | .remove = __devexit_p(bcap_remove), | 1051 | .remove = bcap_remove, |
| 1052 | }; | 1052 | }; |
| 1053 | 1053 | module_platform_driver(bcap_driver); | |
| 1054 | static __init int bcap_init(void) | ||
| 1055 | { | ||
| 1056 | return platform_driver_register(&bcap_driver); | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static __exit void bcap_exit(void) | ||
| 1060 | { | ||
| 1061 | platform_driver_unregister(&bcap_driver); | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | module_init(bcap_init); | ||
| 1065 | module_exit(bcap_exit); | ||
| 1066 | 1054 | ||
| 1067 | MODULE_DESCRIPTION("Analog Devices blackfin video capture driver"); | 1055 | MODULE_DESCRIPTION("Analog Devices blackfin video capture driver"); |
| 1068 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); | 1056 | MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>"); |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index cd04ae252c30..1cf8293c0fb0 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
| @@ -1540,7 +1540,7 @@ static irqreturn_t coda_irq_handler(int irq, void *data) | |||
| 1540 | u32 wr_ptr, start_ptr; | 1540 | u32 wr_ptr, start_ptr; |
| 1541 | struct coda_ctx *ctx; | 1541 | struct coda_ctx *ctx; |
| 1542 | 1542 | ||
| 1543 | __cancel_delayed_work(&dev->timeout); | 1543 | cancel_delayed_work(&dev->timeout); |
| 1544 | 1544 | ||
| 1545 | /* read status register to attend the IRQ */ | 1545 | /* read status register to attend the IRQ */ |
| 1546 | coda_read(dev, CODA_REG_BIT_INT_STATUS); | 1546 | coda_read(dev, CODA_REG_BIT_INT_STATUS); |
| @@ -1877,7 +1877,7 @@ static const struct coda_devtype coda_devdata[] = { | |||
| 1877 | 1877 | ||
| 1878 | static struct platform_device_id coda_platform_ids[] = { | 1878 | static struct platform_device_id coda_platform_ids[] = { |
| 1879 | { .name = "coda-imx27", .driver_data = CODA_IMX27 }, | 1879 | { .name = "coda-imx27", .driver_data = CODA_IMX27 }, |
| 1880 | { .name = "coda-imx53", .driver_data = CODA_7541 }, | 1880 | { .name = "coda-imx53", .driver_data = CODA_IMX53 }, |
| 1881 | { /* sentinel */ } | 1881 | { /* sentinel */ } |
| 1882 | }; | 1882 | }; |
| 1883 | MODULE_DEVICE_TABLE(platform, coda_platform_ids); | 1883 | MODULE_DEVICE_TABLE(platform, coda_platform_ids); |
| @@ -1891,7 +1891,7 @@ static const struct of_device_id coda_dt_ids[] = { | |||
| 1891 | MODULE_DEVICE_TABLE(of, coda_dt_ids); | 1891 | MODULE_DEVICE_TABLE(of, coda_dt_ids); |
| 1892 | #endif | 1892 | #endif |
| 1893 | 1893 | ||
| 1894 | static int __devinit coda_probe(struct platform_device *pdev) | 1894 | static int coda_probe(struct platform_device *pdev) |
| 1895 | { | 1895 | { |
| 1896 | const struct of_device_id *of_id = | 1896 | const struct of_device_id *of_id = |
| 1897 | of_match_device(of_match_ptr(coda_dt_ids), &pdev->dev); | 1897 | of_match_device(of_match_ptr(coda_dt_ids), &pdev->dev); |
| @@ -2033,7 +2033,7 @@ static int coda_remove(struct platform_device *pdev) | |||
| 2033 | 2033 | ||
| 2034 | static struct platform_driver coda_driver = { | 2034 | static struct platform_driver coda_driver = { |
| 2035 | .probe = coda_probe, | 2035 | .probe = coda_probe, |
| 2036 | .remove = __devexit_p(coda_remove), | 2036 | .remove = coda_remove, |
| 2037 | .driver = { | 2037 | .driver = { |
| 2038 | .name = CODA_NAME, | 2038 | .name = CODA_NAME, |
| 2039 | .owner = THIS_MODULE, | 2039 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/davinci/Kconfig b/drivers/media/platform/davinci/Kconfig index 78e26d24f637..3c56037c82fc 100644 --- a/drivers/media/platform/davinci/Kconfig +++ b/drivers/media/platform/davinci/Kconfig | |||
| @@ -101,7 +101,7 @@ config VIDEO_DM644X_VPBE | |||
| 101 | tristate "DM644X VPBE HW module" | 101 | tristate "DM644X VPBE HW module" |
| 102 | depends on ARCH_DAVINCI_DM644x | 102 | depends on ARCH_DAVINCI_DM644x |
| 103 | select VIDEO_VPSS_SYSTEM | 103 | select VIDEO_VPSS_SYSTEM |
| 104 | select VIDEOBUF_DMA_CONTIG | 104 | select VIDEOBUF2_DMA_CONTIG |
| 105 | help | 105 | help |
| 106 | Enables VPBE modules used for display on a DM644x | 106 | Enables VPBE modules used for display on a DM644x |
| 107 | SoC. | 107 | SoC. |
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c index ce0e4131c067..f263cabade7a 100644 --- a/drivers/media/platform/davinci/dm355_ccdc.c +++ b/drivers/media/platform/davinci/dm355_ccdc.c | |||
| @@ -965,7 +965,7 @@ static struct ccdc_hw_device ccdc_hw_dev = { | |||
| 965 | }, | 965 | }, |
| 966 | }; | 966 | }; |
| 967 | 967 | ||
| 968 | static int __devinit dm355_ccdc_probe(struct platform_device *pdev) | 968 | static int dm355_ccdc_probe(struct platform_device *pdev) |
| 969 | { | 969 | { |
| 970 | void (*setup_pinmux)(void); | 970 | void (*setup_pinmux)(void); |
| 971 | struct resource *res; | 971 | struct resource *res; |
| @@ -1003,7 +1003,7 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev) | |||
| 1003 | status = PTR_ERR(ccdc_cfg.mclk); | 1003 | status = PTR_ERR(ccdc_cfg.mclk); |
| 1004 | goto fail_nomap; | 1004 | goto fail_nomap; |
| 1005 | } | 1005 | } |
| 1006 | if (clk_enable(ccdc_cfg.mclk)) { | 1006 | if (clk_prepare_enable(ccdc_cfg.mclk)) { |
| 1007 | status = -ENODEV; | 1007 | status = -ENODEV; |
| 1008 | goto fail_mclk; | 1008 | goto fail_mclk; |
| 1009 | } | 1009 | } |
| @@ -1014,7 +1014,7 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev) | |||
| 1014 | status = PTR_ERR(ccdc_cfg.sclk); | 1014 | status = PTR_ERR(ccdc_cfg.sclk); |
| 1015 | goto fail_mclk; | 1015 | goto fail_mclk; |
| 1016 | } | 1016 | } |
| 1017 | if (clk_enable(ccdc_cfg.sclk)) { | 1017 | if (clk_prepare_enable(ccdc_cfg.sclk)) { |
| 1018 | status = -ENODEV; | 1018 | status = -ENODEV; |
| 1019 | goto fail_sclk; | 1019 | goto fail_sclk; |
| 1020 | } | 1020 | } |
| @@ -1034,8 +1034,10 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev) | |||
| 1034 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); | 1034 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); |
| 1035 | return 0; | 1035 | return 0; |
| 1036 | fail_sclk: | 1036 | fail_sclk: |
| 1037 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
| 1037 | clk_put(ccdc_cfg.sclk); | 1038 | clk_put(ccdc_cfg.sclk); |
| 1038 | fail_mclk: | 1039 | fail_mclk: |
| 1040 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
| 1039 | clk_put(ccdc_cfg.mclk); | 1041 | clk_put(ccdc_cfg.mclk); |
| 1040 | fail_nomap: | 1042 | fail_nomap: |
| 1041 | iounmap(ccdc_cfg.base_addr); | 1043 | iounmap(ccdc_cfg.base_addr); |
| @@ -1050,6 +1052,8 @@ static int dm355_ccdc_remove(struct platform_device *pdev) | |||
| 1050 | { | 1052 | { |
| 1051 | struct resource *res; | 1053 | struct resource *res; |
| 1052 | 1054 | ||
| 1055 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
| 1056 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
| 1053 | clk_put(ccdc_cfg.mclk); | 1057 | clk_put(ccdc_cfg.mclk); |
| 1054 | clk_put(ccdc_cfg.sclk); | 1058 | clk_put(ccdc_cfg.sclk); |
| 1055 | iounmap(ccdc_cfg.base_addr); | 1059 | iounmap(ccdc_cfg.base_addr); |
| @@ -1065,7 +1069,7 @@ static struct platform_driver dm355_ccdc_driver = { | |||
| 1065 | .name = "dm355_ccdc", | 1069 | .name = "dm355_ccdc", |
| 1066 | .owner = THIS_MODULE, | 1070 | .owner = THIS_MODULE, |
| 1067 | }, | 1071 | }, |
| 1068 | .remove = __devexit_p(dm355_ccdc_remove), | 1072 | .remove = dm355_ccdc_remove, |
| 1069 | .probe = dm355_ccdc_probe, | 1073 | .probe = dm355_ccdc_probe, |
| 1070 | }; | 1074 | }; |
| 1071 | 1075 | ||
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c index ee7942b1996e..318e80512998 100644 --- a/drivers/media/platform/davinci/dm644x_ccdc.c +++ b/drivers/media/platform/davinci/dm644x_ccdc.c | |||
| @@ -957,7 +957,7 @@ static struct ccdc_hw_device ccdc_hw_dev = { | |||
| 957 | }, | 957 | }, |
| 958 | }; | 958 | }; |
| 959 | 959 | ||
| 960 | static int __devinit dm644x_ccdc_probe(struct platform_device *pdev) | 960 | static int dm644x_ccdc_probe(struct platform_device *pdev) |
| 961 | { | 961 | { |
| 962 | struct resource *res; | 962 | struct resource *res; |
| 963 | int status = 0; | 963 | int status = 0; |
| @@ -994,7 +994,7 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev) | |||
| 994 | status = PTR_ERR(ccdc_cfg.mclk); | 994 | status = PTR_ERR(ccdc_cfg.mclk); |
| 995 | goto fail_nomap; | 995 | goto fail_nomap; |
| 996 | } | 996 | } |
| 997 | if (clk_enable(ccdc_cfg.mclk)) { | 997 | if (clk_prepare_enable(ccdc_cfg.mclk)) { |
| 998 | status = -ENODEV; | 998 | status = -ENODEV; |
| 999 | goto fail_mclk; | 999 | goto fail_mclk; |
| 1000 | } | 1000 | } |
| @@ -1005,7 +1005,7 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev) | |||
| 1005 | status = PTR_ERR(ccdc_cfg.sclk); | 1005 | status = PTR_ERR(ccdc_cfg.sclk); |
| 1006 | goto fail_mclk; | 1006 | goto fail_mclk; |
| 1007 | } | 1007 | } |
| 1008 | if (clk_enable(ccdc_cfg.sclk)) { | 1008 | if (clk_prepare_enable(ccdc_cfg.sclk)) { |
| 1009 | status = -ENODEV; | 1009 | status = -ENODEV; |
| 1010 | goto fail_sclk; | 1010 | goto fail_sclk; |
| 1011 | } | 1011 | } |
| @@ -1013,8 +1013,10 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev) | |||
| 1013 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); | 1013 | printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); |
| 1014 | return 0; | 1014 | return 0; |
| 1015 | fail_sclk: | 1015 | fail_sclk: |
| 1016 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
| 1016 | clk_put(ccdc_cfg.sclk); | 1017 | clk_put(ccdc_cfg.sclk); |
| 1017 | fail_mclk: | 1018 | fail_mclk: |
| 1019 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
| 1018 | clk_put(ccdc_cfg.mclk); | 1020 | clk_put(ccdc_cfg.mclk); |
| 1019 | fail_nomap: | 1021 | fail_nomap: |
| 1020 | iounmap(ccdc_cfg.base_addr); | 1022 | iounmap(ccdc_cfg.base_addr); |
| @@ -1029,6 +1031,8 @@ static int dm644x_ccdc_remove(struct platform_device *pdev) | |||
| 1029 | { | 1031 | { |
| 1030 | struct resource *res; | 1032 | struct resource *res; |
| 1031 | 1033 | ||
| 1034 | clk_disable_unprepare(ccdc_cfg.mclk); | ||
| 1035 | clk_disable_unprepare(ccdc_cfg.sclk); | ||
| 1032 | clk_put(ccdc_cfg.mclk); | 1036 | clk_put(ccdc_cfg.mclk); |
| 1033 | clk_put(ccdc_cfg.sclk); | 1037 | clk_put(ccdc_cfg.sclk); |
| 1034 | iounmap(ccdc_cfg.base_addr); | 1038 | iounmap(ccdc_cfg.base_addr); |
| @@ -1046,8 +1050,8 @@ static int dm644x_ccdc_suspend(struct device *dev) | |||
| 1046 | /* Disable CCDC */ | 1050 | /* Disable CCDC */ |
| 1047 | ccdc_enable(0); | 1051 | ccdc_enable(0); |
| 1048 | /* Disable both master and slave clock */ | 1052 | /* Disable both master and slave clock */ |
| 1049 | clk_disable(ccdc_cfg.mclk); | 1053 | clk_disable_unprepare(ccdc_cfg.mclk); |
| 1050 | clk_disable(ccdc_cfg.sclk); | 1054 | clk_disable_unprepare(ccdc_cfg.sclk); |
| 1051 | 1055 | ||
| 1052 | return 0; | 1056 | return 0; |
| 1053 | } | 1057 | } |
| @@ -1055,8 +1059,8 @@ static int dm644x_ccdc_suspend(struct device *dev) | |||
| 1055 | static int dm644x_ccdc_resume(struct device *dev) | 1059 | static int dm644x_ccdc_resume(struct device *dev) |
| 1056 | { | 1060 | { |
| 1057 | /* Enable both master and slave clock */ | 1061 | /* Enable both master and slave clock */ |
| 1058 | clk_enable(ccdc_cfg.mclk); | 1062 | clk_prepare_enable(ccdc_cfg.mclk); |
| 1059 | clk_enable(ccdc_cfg.sclk); | 1063 | clk_prepare_enable(ccdc_cfg.sclk); |
| 1060 | /* Restore CCDC context */ | 1064 | /* Restore CCDC context */ |
| 1061 | ccdc_restore_context(); | 1065 | ccdc_restore_context(); |
| 1062 | 1066 | ||
| @@ -1074,7 +1078,7 @@ static struct platform_driver dm644x_ccdc_driver = { | |||
| 1074 | .owner = THIS_MODULE, | 1078 | .owner = THIS_MODULE, |
| 1075 | .pm = &dm644x_ccdc_pm_ops, | 1079 | .pm = &dm644x_ccdc_pm_ops, |
| 1076 | }, | 1080 | }, |
| 1077 | .remove = __devexit_p(dm644x_ccdc_remove), | 1081 | .remove = dm644x_ccdc_remove, |
| 1078 | .probe = dm644x_ccdc_probe, | 1082 | .probe = dm644x_ccdc_probe, |
| 1079 | }; | 1083 | }; |
| 1080 | 1084 | ||
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c index b99d5423e3a8..5050f9265f48 100644 --- a/drivers/media/platform/davinci/isif.c +++ b/drivers/media/platform/davinci/isif.c | |||
| @@ -1032,7 +1032,7 @@ static struct ccdc_hw_device isif_hw_dev = { | |||
| 1032 | }, | 1032 | }, |
| 1033 | }; | 1033 | }; |
| 1034 | 1034 | ||
| 1035 | static int __devinit isif_probe(struct platform_device *pdev) | 1035 | static int isif_probe(struct platform_device *pdev) |
| 1036 | { | 1036 | { |
| 1037 | void (*setup_pinmux)(void); | 1037 | void (*setup_pinmux)(void); |
| 1038 | struct resource *res; | 1038 | struct resource *res; |
| @@ -1053,7 +1053,7 @@ static int __devinit isif_probe(struct platform_device *pdev) | |||
| 1053 | status = PTR_ERR(isif_cfg.mclk); | 1053 | status = PTR_ERR(isif_cfg.mclk); |
| 1054 | goto fail_mclk; | 1054 | goto fail_mclk; |
| 1055 | } | 1055 | } |
| 1056 | if (clk_enable(isif_cfg.mclk)) { | 1056 | if (clk_prepare_enable(isif_cfg.mclk)) { |
| 1057 | status = -ENODEV; | 1057 | status = -ENODEV; |
| 1058 | goto fail_mclk; | 1058 | goto fail_mclk; |
| 1059 | } | 1059 | } |
| @@ -1125,6 +1125,7 @@ fail_nobase_res: | |||
| 1125 | i--; | 1125 | i--; |
| 1126 | } | 1126 | } |
| 1127 | fail_mclk: | 1127 | fail_mclk: |
| 1128 | clk_disable_unprepare(isif_cfg.mclk); | ||
| 1128 | clk_put(isif_cfg.mclk); | 1129 | clk_put(isif_cfg.mclk); |
| 1129 | vpfe_unregister_ccdc_device(&isif_hw_dev); | 1130 | vpfe_unregister_ccdc_device(&isif_hw_dev); |
| 1130 | return status; | 1131 | return status; |
| @@ -1145,6 +1146,8 @@ static int isif_remove(struct platform_device *pdev) | |||
| 1145 | i++; | 1146 | i++; |
| 1146 | } | 1147 | } |
| 1147 | vpfe_unregister_ccdc_device(&isif_hw_dev); | 1148 | vpfe_unregister_ccdc_device(&isif_hw_dev); |
| 1149 | clk_disable_unprepare(isif_cfg.mclk); | ||
| 1150 | clk_put(isif_cfg.mclk); | ||
| 1148 | return 0; | 1151 | return 0; |
| 1149 | } | 1152 | } |
| 1150 | 1153 | ||
| @@ -1153,7 +1156,7 @@ static struct platform_driver isif_driver = { | |||
| 1153 | .name = "isif", | 1156 | .name = "isif", |
| 1154 | .owner = THIS_MODULE, | 1157 | .owner = THIS_MODULE, |
| 1155 | }, | 1158 | }, |
| 1156 | .remove = __devexit_p(isif_remove), | 1159 | .remove = isif_remove, |
| 1157 | .probe = isif_probe, | 1160 | .probe = isif_probe, |
| 1158 | }; | 1161 | }; |
| 1159 | 1162 | ||
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c index 69d7a58c92c3..841b91a3d255 100644 --- a/drivers/media/platform/davinci/vpbe.c +++ b/drivers/media/platform/davinci/vpbe.c | |||
| @@ -612,7 +612,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) | |||
| 612 | ret = PTR_ERR(vpbe_dev->dac_clk); | 612 | ret = PTR_ERR(vpbe_dev->dac_clk); |
| 613 | goto fail_mutex_unlock; | 613 | goto fail_mutex_unlock; |
| 614 | } | 614 | } |
| 615 | if (clk_enable(vpbe_dev->dac_clk)) { | 615 | if (clk_prepare_enable(vpbe_dev->dac_clk)) { |
| 616 | ret = -ENODEV; | 616 | ret = -ENODEV; |
| 617 | goto fail_mutex_unlock; | 617 | goto fail_mutex_unlock; |
| 618 | } | 618 | } |
| @@ -759,8 +759,10 @@ fail_kfree_encoders: | |||
| 759 | fail_dev_unregister: | 759 | fail_dev_unregister: |
| 760 | v4l2_device_unregister(&vpbe_dev->v4l2_dev); | 760 | v4l2_device_unregister(&vpbe_dev->v4l2_dev); |
| 761 | fail_clk_put: | 761 | fail_clk_put: |
| 762 | if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) | 762 | if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) { |
| 763 | clk_disable_unprepare(vpbe_dev->dac_clk); | ||
| 763 | clk_put(vpbe_dev->dac_clk); | 764 | clk_put(vpbe_dev->dac_clk); |
| 765 | } | ||
| 764 | fail_mutex_unlock: | 766 | fail_mutex_unlock: |
| 765 | mutex_unlock(&vpbe_dev->lock); | 767 | mutex_unlock(&vpbe_dev->lock); |
| 766 | return ret; | 768 | return ret; |
| @@ -777,8 +779,10 @@ fail_mutex_unlock: | |||
| 777 | static void vpbe_deinitialize(struct device *dev, struct vpbe_device *vpbe_dev) | 779 | static void vpbe_deinitialize(struct device *dev, struct vpbe_device *vpbe_dev) |
| 778 | { | 780 | { |
| 779 | v4l2_device_unregister(&vpbe_dev->v4l2_dev); | 781 | v4l2_device_unregister(&vpbe_dev->v4l2_dev); |
| 780 | if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) | 782 | if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) { |
| 783 | clk_disable_unprepare(vpbe_dev->dac_clk); | ||
| 781 | clk_put(vpbe_dev->dac_clk); | 784 | clk_put(vpbe_dev->dac_clk); |
| 785 | } | ||
| 782 | 786 | ||
| 783 | kfree(vpbe_dev->amp); | 787 | kfree(vpbe_dev->amp); |
| 784 | kfree(vpbe_dev->encoders); | 788 | kfree(vpbe_dev->encoders); |
| @@ -803,7 +807,7 @@ static struct vpbe_device_ops vpbe_dev_ops = { | |||
| 803 | .set_mode = vpbe_set_mode, | 807 | .set_mode = vpbe_set_mode, |
| 804 | }; | 808 | }; |
| 805 | 809 | ||
| 806 | static __devinit int vpbe_probe(struct platform_device *pdev) | 810 | static int vpbe_probe(struct platform_device *pdev) |
| 807 | { | 811 | { |
| 808 | struct vpbe_device *vpbe_dev; | 812 | struct vpbe_device *vpbe_dev; |
| 809 | struct vpbe_config *cfg; | 813 | struct vpbe_config *cfg; |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 161c77650e2f..e707a6f2325b 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
| @@ -47,6 +47,9 @@ static int debug; | |||
| 47 | 47 | ||
| 48 | module_param(debug, int, 0644); | 48 | module_param(debug, int, 0644); |
| 49 | 49 | ||
| 50 | static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev, | ||
| 51 | struct vpbe_layer *layer); | ||
| 52 | |||
| 50 | static int venc_is_second_field(struct vpbe_display *disp_dev) | 53 | static int venc_is_second_field(struct vpbe_display *disp_dev) |
| 51 | { | 54 | { |
| 52 | struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; | 55 | struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; |
| @@ -73,10 +76,11 @@ static void vpbe_isr_even_field(struct vpbe_display *disp_obj, | |||
| 73 | if (layer->cur_frm == layer->next_frm) | 76 | if (layer->cur_frm == layer->next_frm) |
| 74 | return; | 77 | return; |
| 75 | ktime_get_ts(&timevalue); | 78 | ktime_get_ts(&timevalue); |
| 76 | layer->cur_frm->ts.tv_sec = timevalue.tv_sec; | 79 | layer->cur_frm->vb.v4l2_buf.timestamp.tv_sec = |
| 77 | layer->cur_frm->ts.tv_usec = timevalue.tv_nsec / NSEC_PER_USEC; | 80 | timevalue.tv_sec; |
| 78 | layer->cur_frm->state = VIDEOBUF_DONE; | 81 | layer->cur_frm->vb.v4l2_buf.timestamp.tv_usec = |
| 79 | wake_up_interruptible(&layer->cur_frm->done); | 82 | timevalue.tv_nsec / NSEC_PER_USEC; |
| 83 | vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_DONE); | ||
| 80 | /* Make cur_frm pointing to next_frm */ | 84 | /* Make cur_frm pointing to next_frm */ |
| 81 | layer->cur_frm = layer->next_frm; | 85 | layer->cur_frm = layer->next_frm; |
| 82 | } | 86 | } |
| @@ -99,16 +103,14 @@ static void vpbe_isr_odd_field(struct vpbe_display *disp_obj, | |||
| 99 | * otherwise hold on current frame | 103 | * otherwise hold on current frame |
| 100 | * Get next from the buffer queue | 104 | * Get next from the buffer queue |
| 101 | */ | 105 | */ |
| 102 | layer->next_frm = list_entry( | 106 | layer->next_frm = list_entry(layer->dma_queue.next, |
| 103 | layer->dma_queue.next, | 107 | struct vpbe_disp_buffer, list); |
| 104 | struct videobuf_buffer, | ||
| 105 | queue); | ||
| 106 | /* Remove that from the buffer queue */ | 108 | /* Remove that from the buffer queue */ |
| 107 | list_del(&layer->next_frm->queue); | 109 | list_del(&layer->next_frm->list); |
| 108 | spin_unlock(&disp_obj->dma_queue_lock); | 110 | spin_unlock(&disp_obj->dma_queue_lock); |
| 109 | /* Mark state of the frame to active */ | 111 | /* Mark state of the frame to active */ |
| 110 | layer->next_frm->state = VIDEOBUF_ACTIVE; | 112 | layer->next_frm->vb.state = VB2_BUF_STATE_ACTIVE; |
| 111 | addr = videobuf_to_dma_contig(layer->next_frm); | 113 | addr = vb2_dma_contig_plane_dma_addr(&layer->next_frm->vb, 0); |
| 112 | osd_device->ops.start_layer(osd_device, | 114 | osd_device->ops.start_layer(osd_device, |
| 113 | layer->layer_info.id, | 115 | layer->layer_info.id, |
| 114 | addr, | 116 | addr, |
| @@ -199,39 +201,29 @@ static irqreturn_t venc_isr(int irq, void *arg) | |||
| 199 | 201 | ||
| 200 | /* | 202 | /* |
| 201 | * vpbe_buffer_prepare() | 203 | * vpbe_buffer_prepare() |
| 202 | * This is the callback function called from videobuf_qbuf() function | 204 | * This is the callback function called from vb2_qbuf() function |
| 203 | * the buffer is prepared and user space virtual address is converted into | 205 | * the buffer is prepared and user space virtual address is converted into |
| 204 | * physical address | 206 | * physical address |
| 205 | */ | 207 | */ |
| 206 | static int vpbe_buffer_prepare(struct videobuf_queue *q, | 208 | static int vpbe_buffer_prepare(struct vb2_buffer *vb) |
| 207 | struct videobuf_buffer *vb, | ||
| 208 | enum v4l2_field field) | ||
| 209 | { | 209 | { |
| 210 | struct vpbe_fh *fh = q->priv_data; | 210 | struct vpbe_fh *fh = vb2_get_drv_priv(vb->vb2_queue); |
| 211 | struct vb2_queue *q = vb->vb2_queue; | ||
| 211 | struct vpbe_layer *layer = fh->layer; | 212 | struct vpbe_layer *layer = fh->layer; |
| 212 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 213 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 213 | unsigned long addr; | 214 | unsigned long addr; |
| 214 | int ret; | ||
| 215 | 215 | ||
| 216 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, | 216 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, |
| 217 | "vpbe_buffer_prepare\n"); | 217 | "vpbe_buffer_prepare\n"); |
| 218 | 218 | ||
| 219 | /* If buffer is not initialized, initialize it */ | 219 | if (vb->state != VB2_BUF_STATE_ACTIVE && |
| 220 | if (VIDEOBUF_NEEDS_INIT == vb->state) { | 220 | vb->state != VB2_BUF_STATE_PREPARED) { |
| 221 | vb->width = layer->pix_fmt.width; | 221 | vb2_set_plane_payload(vb, 0, layer->pix_fmt.sizeimage); |
| 222 | vb->height = layer->pix_fmt.height; | 222 | if (vb2_plane_vaddr(vb, 0) && |
| 223 | vb->size = layer->pix_fmt.sizeimage; | 223 | vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) |
| 224 | vb->field = field; | ||
| 225 | |||
| 226 | ret = videobuf_iolock(q, vb, NULL); | ||
| 227 | if (ret < 0) { | ||
| 228 | v4l2_err(&vpbe_dev->v4l2_dev, "Failed to map \ | ||
| 229 | user address\n"); | ||
| 230 | return -EINVAL; | 224 | return -EINVAL; |
| 231 | } | ||
| 232 | |||
| 233 | addr = videobuf_to_dma_contig(vb); | ||
| 234 | 225 | ||
| 226 | addr = vb2_dma_contig_plane_dma_addr(vb, 0); | ||
| 235 | if (q->streaming) { | 227 | if (q->streaming) { |
| 236 | if (!IS_ALIGNED(addr, 8)) { | 228 | if (!IS_ALIGNED(addr, 8)) { |
| 237 | v4l2_err(&vpbe_dev->v4l2_dev, | 229 | v4l2_err(&vpbe_dev->v4l2_dev, |
| @@ -240,7 +232,6 @@ static int vpbe_buffer_prepare(struct videobuf_queue *q, | |||
| 240 | return -EINVAL; | 232 | return -EINVAL; |
| 241 | } | 233 | } |
| 242 | } | 234 | } |
| 243 | vb->state = VIDEOBUF_PREPARED; | ||
| 244 | } | 235 | } |
| 245 | return 0; | 236 | return 0; |
| 246 | } | 237 | } |
| @@ -249,22 +240,26 @@ static int vpbe_buffer_prepare(struct videobuf_queue *q, | |||
| 249 | * vpbe_buffer_setup() | 240 | * vpbe_buffer_setup() |
| 250 | * This function allocates memory for the buffers | 241 | * This function allocates memory for the buffers |
| 251 | */ | 242 | */ |
| 252 | static int vpbe_buffer_setup(struct videobuf_queue *q, | 243 | static int |
| 253 | unsigned int *count, | 244 | vpbe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, |
| 254 | unsigned int *size) | 245 | unsigned int *nbuffers, unsigned int *nplanes, |
| 246 | unsigned int sizes[], void *alloc_ctxs[]) | ||
| 247 | |||
| 255 | { | 248 | { |
| 256 | /* Get the file handle object and layer object */ | 249 | /* Get the file handle object and layer object */ |
| 257 | struct vpbe_fh *fh = q->priv_data; | 250 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); |
| 258 | struct vpbe_layer *layer = fh->layer; | 251 | struct vpbe_layer *layer = fh->layer; |
| 259 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 252 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 260 | 253 | ||
| 261 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_buffer_setup\n"); | 254 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_buffer_setup\n"); |
| 262 | 255 | ||
| 263 | *size = layer->pix_fmt.sizeimage; | ||
| 264 | |||
| 265 | /* Store number of buffers allocated in numbuffer member */ | 256 | /* Store number of buffers allocated in numbuffer member */ |
| 266 | if (*count < VPBE_DEFAULT_NUM_BUFS) | 257 | if (*nbuffers < VPBE_DEFAULT_NUM_BUFS) |
| 267 | *count = layer->numbuffers = VPBE_DEFAULT_NUM_BUFS; | 258 | *nbuffers = layer->numbuffers = VPBE_DEFAULT_NUM_BUFS; |
| 259 | |||
| 260 | *nplanes = 1; | ||
| 261 | sizes[0] = layer->pix_fmt.sizeimage; | ||
| 262 | alloc_ctxs[0] = layer->alloc_ctx; | ||
| 268 | 263 | ||
| 269 | return 0; | 264 | return 0; |
| 270 | } | 265 | } |
| @@ -273,11 +268,12 @@ static int vpbe_buffer_setup(struct videobuf_queue *q, | |||
| 273 | * vpbe_buffer_queue() | 268 | * vpbe_buffer_queue() |
| 274 | * This function adds the buffer to DMA queue | 269 | * This function adds the buffer to DMA queue |
| 275 | */ | 270 | */ |
| 276 | static void vpbe_buffer_queue(struct videobuf_queue *q, | 271 | static void vpbe_buffer_queue(struct vb2_buffer *vb) |
| 277 | struct videobuf_buffer *vb) | ||
| 278 | { | 272 | { |
| 279 | /* Get the file handle object and layer object */ | 273 | /* Get the file handle object and layer object */ |
| 280 | struct vpbe_fh *fh = q->priv_data; | 274 | struct vpbe_fh *fh = vb2_get_drv_priv(vb->vb2_queue); |
| 275 | struct vpbe_disp_buffer *buf = container_of(vb, | ||
| 276 | struct vpbe_disp_buffer, vb); | ||
| 281 | struct vpbe_layer *layer = fh->layer; | 277 | struct vpbe_layer *layer = fh->layer; |
| 282 | struct vpbe_display *disp = fh->disp_dev; | 278 | struct vpbe_display *disp = fh->disp_dev; |
| 283 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 279 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| @@ -288,39 +284,125 @@ static void vpbe_buffer_queue(struct videobuf_queue *q, | |||
| 288 | 284 | ||
| 289 | /* add the buffer to the DMA queue */ | 285 | /* add the buffer to the DMA queue */ |
| 290 | spin_lock_irqsave(&disp->dma_queue_lock, flags); | 286 | spin_lock_irqsave(&disp->dma_queue_lock, flags); |
| 291 | list_add_tail(&vb->queue, &layer->dma_queue); | 287 | list_add_tail(&buf->list, &layer->dma_queue); |
| 292 | spin_unlock_irqrestore(&disp->dma_queue_lock, flags); | 288 | spin_unlock_irqrestore(&disp->dma_queue_lock, flags); |
| 293 | /* Change state of the buffer */ | ||
| 294 | vb->state = VIDEOBUF_QUEUED; | ||
| 295 | } | 289 | } |
| 296 | 290 | ||
| 297 | /* | 291 | /* |
| 298 | * vpbe_buffer_release() | 292 | * vpbe_buf_cleanup() |
| 299 | * This function is called from the videobuf layer to free memory allocated to | 293 | * This function is called from the vb2 layer to free memory allocated to |
| 300 | * the buffers | 294 | * the buffers |
| 301 | */ | 295 | */ |
| 302 | static void vpbe_buffer_release(struct videobuf_queue *q, | 296 | static void vpbe_buf_cleanup(struct vb2_buffer *vb) |
| 303 | struct videobuf_buffer *vb) | ||
| 304 | { | 297 | { |
| 305 | /* Get the file handle object and layer object */ | 298 | /* Get the file handle object and layer object */ |
| 306 | struct vpbe_fh *fh = q->priv_data; | 299 | struct vpbe_fh *fh = vb2_get_drv_priv(vb->vb2_queue); |
| 307 | struct vpbe_layer *layer = fh->layer; | 300 | struct vpbe_layer *layer = fh->layer; |
| 308 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 301 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 302 | struct vpbe_disp_buffer *buf = container_of(vb, | ||
| 303 | struct vpbe_disp_buffer, vb); | ||
| 304 | unsigned long flags; | ||
| 309 | 305 | ||
| 310 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, | 306 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, |
| 311 | "vpbe_buffer_release\n"); | 307 | "vpbe_buf_cleanup\n"); |
| 312 | 308 | ||
| 313 | if (V4L2_MEMORY_USERPTR != layer->memory) | 309 | spin_lock_irqsave(&layer->irqlock, flags); |
| 314 | videobuf_dma_contig_free(q, vb); | 310 | if (vb->state == VB2_BUF_STATE_ACTIVE) |
| 311 | list_del_init(&buf->list); | ||
| 312 | spin_unlock_irqrestore(&layer->irqlock, flags); | ||
| 313 | } | ||
| 315 | 314 | ||
| 316 | vb->state = VIDEOBUF_NEEDS_INIT; | 315 | static void vpbe_wait_prepare(struct vb2_queue *vq) |
| 316 | { | ||
| 317 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); | ||
| 318 | struct vpbe_layer *layer = fh->layer; | ||
| 319 | |||
| 320 | mutex_unlock(&layer->opslock); | ||
| 317 | } | 321 | } |
| 318 | 322 | ||
| 319 | static struct videobuf_queue_ops video_qops = { | 323 | static void vpbe_wait_finish(struct vb2_queue *vq) |
| 320 | .buf_setup = vpbe_buffer_setup, | 324 | { |
| 325 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); | ||
| 326 | struct vpbe_layer *layer = fh->layer; | ||
| 327 | |||
| 328 | mutex_lock(&layer->opslock); | ||
| 329 | } | ||
| 330 | |||
| 331 | static int vpbe_buffer_init(struct vb2_buffer *vb) | ||
| 332 | { | ||
| 333 | struct vpbe_disp_buffer *buf = container_of(vb, | ||
| 334 | struct vpbe_disp_buffer, vb); | ||
| 335 | |||
| 336 | INIT_LIST_HEAD(&buf->list); | ||
| 337 | return 0; | ||
| 338 | } | ||
| 339 | |||
| 340 | static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count) | ||
| 341 | { | ||
| 342 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); | ||
| 343 | struct vpbe_layer *layer = fh->layer; | ||
| 344 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | ||
| 345 | int ret; | ||
| 346 | |||
| 347 | /* If buffer queue is empty, return error */ | ||
| 348 | if (list_empty(&layer->dma_queue)) { | ||
| 349 | v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n"); | ||
| 350 | return -EINVAL; | ||
| 351 | } | ||
| 352 | /* Get the next frame from the buffer queue */ | ||
| 353 | layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next, | ||
| 354 | struct vpbe_disp_buffer, list); | ||
| 355 | /* Remove buffer from the buffer queue */ | ||
| 356 | list_del(&layer->cur_frm->list); | ||
| 357 | /* Mark state of the current frame to active */ | ||
| 358 | layer->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE; | ||
| 359 | /* Initialize field_id and started member */ | ||
| 360 | layer->field_id = 0; | ||
| 361 | |||
| 362 | /* Set parameters in OSD and VENC */ | ||
| 363 | ret = vpbe_set_osd_display_params(fh->disp_dev, layer); | ||
| 364 | if (ret < 0) | ||
| 365 | return ret; | ||
| 366 | |||
| 367 | /* | ||
| 368 | * if request format is yuv420 semiplanar, need to | ||
| 369 | * enable both video windows | ||
| 370 | */ | ||
| 371 | layer->started = 1; | ||
| 372 | layer->layer_first_int = 1; | ||
| 373 | |||
| 374 | return ret; | ||
| 375 | } | ||
| 376 | |||
| 377 | static int vpbe_stop_streaming(struct vb2_queue *vq) | ||
| 378 | { | ||
| 379 | struct vpbe_fh *fh = vb2_get_drv_priv(vq); | ||
| 380 | struct vpbe_layer *layer = fh->layer; | ||
| 381 | |||
| 382 | if (!vb2_is_streaming(vq)) | ||
| 383 | return 0; | ||
| 384 | |||
| 385 | /* release all active buffers */ | ||
| 386 | while (!list_empty(&layer->dma_queue)) { | ||
| 387 | layer->next_frm = list_entry(layer->dma_queue.next, | ||
| 388 | struct vpbe_disp_buffer, list); | ||
| 389 | list_del(&layer->next_frm->list); | ||
| 390 | vb2_buffer_done(&layer->next_frm->vb, VB2_BUF_STATE_ERROR); | ||
| 391 | } | ||
| 392 | |||
| 393 | return 0; | ||
| 394 | } | ||
| 395 | |||
| 396 | static struct vb2_ops video_qops = { | ||
| 397 | .queue_setup = vpbe_buffer_queue_setup, | ||
| 398 | .wait_prepare = vpbe_wait_prepare, | ||
| 399 | .wait_finish = vpbe_wait_finish, | ||
| 400 | .buf_init = vpbe_buffer_init, | ||
| 321 | .buf_prepare = vpbe_buffer_prepare, | 401 | .buf_prepare = vpbe_buffer_prepare, |
| 402 | .start_streaming = vpbe_start_streaming, | ||
| 403 | .stop_streaming = vpbe_stop_streaming, | ||
| 404 | .buf_cleanup = vpbe_buf_cleanup, | ||
| 322 | .buf_queue = vpbe_buffer_queue, | 405 | .buf_queue = vpbe_buffer_queue, |
| 323 | .buf_release = vpbe_buffer_release, | ||
| 324 | }; | 406 | }; |
| 325 | 407 | ||
| 326 | static | 408 | static |
| @@ -345,7 +427,7 @@ static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev, | |||
| 345 | unsigned long addr; | 427 | unsigned long addr; |
| 346 | int ret; | 428 | int ret; |
| 347 | 429 | ||
| 348 | addr = videobuf_to_dma_contig(layer->cur_frm); | 430 | addr = vb2_dma_contig_plane_dma_addr(&layer->cur_frm->vb, 0); |
| 349 | /* Set address in the display registers */ | 431 | /* Set address in the display registers */ |
| 350 | osd_device->ops.start_layer(osd_device, | 432 | osd_device->ops.start_layer(osd_device, |
| 351 | layer->layer_info.id, | 433 | layer->layer_info.id, |
| @@ -620,9 +702,12 @@ static int vpbe_display_querycap(struct file *file, void *priv, | |||
| 620 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 702 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 621 | 703 | ||
| 622 | cap->version = VPBE_DISPLAY_VERSION_CODE; | 704 | cap->version = VPBE_DISPLAY_VERSION_CODE; |
| 623 | cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; | 705 | cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
| 624 | strlcpy(cap->driver, VPBE_DISPLAY_DRIVER, sizeof(cap->driver)); | 706 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
| 625 | strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info)); | 707 | snprintf(cap->driver, sizeof(cap->driver), "%s", |
| 708 | dev_name(vpbe_dev->pdev)); | ||
| 709 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", | ||
| 710 | dev_name(vpbe_dev->pdev)); | ||
| 626 | strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card)); | 711 | strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card)); |
| 627 | 712 | ||
| 628 | return 0; | 713 | return 0; |
| @@ -1161,7 +1246,7 @@ static int vpbe_display_streamoff(struct file *file, void *priv, | |||
| 1161 | osd_device->ops.disable_layer(osd_device, | 1246 | osd_device->ops.disable_layer(osd_device, |
| 1162 | layer->layer_info.id); | 1247 | layer->layer_info.id); |
| 1163 | layer->started = 0; | 1248 | layer->started = 0; |
| 1164 | ret = videobuf_streamoff(&layer->buffer_queue); | 1249 | ret = vb2_streamoff(&layer->buffer_queue, buf_type); |
| 1165 | 1250 | ||
| 1166 | return ret; | 1251 | return ret; |
| 1167 | } | 1252 | } |
| @@ -1199,46 +1284,15 @@ static int vpbe_display_streamon(struct file *file, void *priv, | |||
| 1199 | } | 1284 | } |
| 1200 | 1285 | ||
| 1201 | /* | 1286 | /* |
| 1202 | * Call videobuf_streamon to start streaming | 1287 | * Call vb2_streamon to start streaming |
| 1203 | * in videobuf | 1288 | * in videobuf |
| 1204 | */ | 1289 | */ |
| 1205 | ret = videobuf_streamon(&layer->buffer_queue); | 1290 | ret = vb2_streamon(&layer->buffer_queue, buf_type); |
| 1206 | if (ret) { | 1291 | if (ret) { |
| 1207 | v4l2_err(&vpbe_dev->v4l2_dev, | 1292 | v4l2_err(&vpbe_dev->v4l2_dev, |
| 1208 | "error in videobuf_streamon\n"); | 1293 | "error in vb2_streamon\n"); |
| 1209 | return ret; | 1294 | return ret; |
| 1210 | } | 1295 | } |
| 1211 | /* If buffer queue is empty, return error */ | ||
| 1212 | if (list_empty(&layer->dma_queue)) { | ||
| 1213 | v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n"); | ||
| 1214 | goto streamoff; | ||
| 1215 | } | ||
| 1216 | /* Get the next frame from the buffer queue */ | ||
| 1217 | layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next, | ||
| 1218 | struct videobuf_buffer, queue); | ||
| 1219 | /* Remove buffer from the buffer queue */ | ||
| 1220 | list_del(&layer->cur_frm->queue); | ||
| 1221 | /* Mark state of the current frame to active */ | ||
| 1222 | layer->cur_frm->state = VIDEOBUF_ACTIVE; | ||
| 1223 | /* Initialize field_id and started member */ | ||
| 1224 | layer->field_id = 0; | ||
| 1225 | |||
| 1226 | /* Set parameters in OSD and VENC */ | ||
| 1227 | ret = vpbe_set_osd_display_params(disp_dev, layer); | ||
| 1228 | if (ret < 0) | ||
| 1229 | goto streamoff; | ||
| 1230 | |||
| 1231 | /* | ||
| 1232 | * if request format is yuv420 semiplanar, need to | ||
| 1233 | * enable both video windows | ||
| 1234 | */ | ||
| 1235 | layer->started = 1; | ||
| 1236 | |||
| 1237 | layer->layer_first_int = 1; | ||
| 1238 | |||
| 1239 | return ret; | ||
| 1240 | streamoff: | ||
| 1241 | ret = videobuf_streamoff(&layer->buffer_queue); | ||
| 1242 | return ret; | 1296 | return ret; |
| 1243 | } | 1297 | } |
| 1244 | 1298 | ||
| @@ -1265,10 +1319,10 @@ static int vpbe_display_dqbuf(struct file *file, void *priv, | |||
| 1265 | } | 1319 | } |
| 1266 | if (file->f_flags & O_NONBLOCK) | 1320 | if (file->f_flags & O_NONBLOCK) |
| 1267 | /* Call videobuf_dqbuf for non blocking mode */ | 1321 | /* Call videobuf_dqbuf for non blocking mode */ |
| 1268 | ret = videobuf_dqbuf(&layer->buffer_queue, buf, 1); | 1322 | ret = vb2_dqbuf(&layer->buffer_queue, buf, 1); |
| 1269 | else | 1323 | else |
| 1270 | /* Call videobuf_dqbuf for blocking mode */ | 1324 | /* Call videobuf_dqbuf for blocking mode */ |
| 1271 | ret = videobuf_dqbuf(&layer->buffer_queue, buf, 0); | 1325 | ret = vb2_dqbuf(&layer->buffer_queue, buf, 0); |
| 1272 | 1326 | ||
| 1273 | return ret; | 1327 | return ret; |
| 1274 | } | 1328 | } |
| @@ -1295,7 +1349,7 @@ static int vpbe_display_qbuf(struct file *file, void *priv, | |||
| 1295 | return -EACCES; | 1349 | return -EACCES; |
| 1296 | } | 1350 | } |
| 1297 | 1351 | ||
| 1298 | return videobuf_qbuf(&layer->buffer_queue, p); | 1352 | return vb2_qbuf(&layer->buffer_queue, p); |
| 1299 | } | 1353 | } |
| 1300 | 1354 | ||
| 1301 | static int vpbe_display_querybuf(struct file *file, void *priv, | 1355 | static int vpbe_display_querybuf(struct file *file, void *priv, |
| @@ -1304,7 +1358,6 @@ static int vpbe_display_querybuf(struct file *file, void *priv, | |||
| 1304 | struct vpbe_fh *fh = file->private_data; | 1358 | struct vpbe_fh *fh = file->private_data; |
| 1305 | struct vpbe_layer *layer = fh->layer; | 1359 | struct vpbe_layer *layer = fh->layer; |
| 1306 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 1360 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 1307 | int ret; | ||
| 1308 | 1361 | ||
| 1309 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, | 1362 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, |
| 1310 | "VIDIOC_QUERYBUF, layer id = %d\n", | 1363 | "VIDIOC_QUERYBUF, layer id = %d\n", |
| @@ -1314,11 +1367,8 @@ static int vpbe_display_querybuf(struct file *file, void *priv, | |||
| 1314 | v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); | 1367 | v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buffer type\n"); |
| 1315 | return -EINVAL; | 1368 | return -EINVAL; |
| 1316 | } | 1369 | } |
| 1317 | 1370 | /* Call vb2_querybuf to get information */ | |
| 1318 | /* Call videobuf_querybuf to get information */ | 1371 | return vb2_querybuf(&layer->buffer_queue, buf); |
| 1319 | ret = videobuf_querybuf(&layer->buffer_queue, buf); | ||
| 1320 | |||
| 1321 | return ret; | ||
| 1322 | } | 1372 | } |
| 1323 | 1373 | ||
| 1324 | static int vpbe_display_reqbufs(struct file *file, void *priv, | 1374 | static int vpbe_display_reqbufs(struct file *file, void *priv, |
| @@ -1327,8 +1377,8 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, | |||
| 1327 | struct vpbe_fh *fh = file->private_data; | 1377 | struct vpbe_fh *fh = file->private_data; |
| 1328 | struct vpbe_layer *layer = fh->layer; | 1378 | struct vpbe_layer *layer = fh->layer; |
| 1329 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; | 1379 | struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev; |
| 1380 | struct vb2_queue *q; | ||
| 1330 | int ret; | 1381 | int ret; |
| 1331 | |||
| 1332 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_reqbufs\n"); | 1382 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_reqbufs\n"); |
| 1333 | 1383 | ||
| 1334 | if (V4L2_BUF_TYPE_VIDEO_OUTPUT != req_buf->type) { | 1384 | if (V4L2_BUF_TYPE_VIDEO_OUTPUT != req_buf->type) { |
| @@ -1342,15 +1392,26 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, | |||
| 1342 | return -EBUSY; | 1392 | return -EBUSY; |
| 1343 | } | 1393 | } |
| 1344 | /* Initialize videobuf queue as per the buffer type */ | 1394 | /* Initialize videobuf queue as per the buffer type */ |
| 1345 | videobuf_queue_dma_contig_init(&layer->buffer_queue, | 1395 | layer->alloc_ctx = vb2_dma_contig_init_ctx(vpbe_dev->pdev); |
| 1346 | &video_qops, | 1396 | if (!layer->alloc_ctx) { |
| 1347 | vpbe_dev->pdev, | 1397 | v4l2_err(&vpbe_dev->v4l2_dev, "Failed to get the context\n"); |
| 1348 | &layer->irqlock, | 1398 | return -EINVAL; |
| 1349 | V4L2_BUF_TYPE_VIDEO_OUTPUT, | 1399 | } |
| 1350 | layer->pix_fmt.field, | 1400 | q = &layer->buffer_queue; |
| 1351 | sizeof(struct videobuf_buffer), | 1401 | memset(q, 0, sizeof(*q)); |
| 1352 | fh, NULL); | 1402 | q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
| 1403 | q->io_modes = VB2_MMAP | VB2_USERPTR; | ||
| 1404 | q->drv_priv = fh; | ||
| 1405 | q->ops = &video_qops; | ||
| 1406 | q->mem_ops = &vb2_dma_contig_memops; | ||
| 1407 | q->buf_struct_size = sizeof(struct vpbe_disp_buffer); | ||
| 1353 | 1408 | ||
| 1409 | ret = vb2_queue_init(q); | ||
| 1410 | if (ret) { | ||
| 1411 | v4l2_err(&vpbe_dev->v4l2_dev, "vb2_queue_init() failed\n"); | ||
| 1412 | vb2_dma_contig_cleanup_ctx(layer->alloc_ctx); | ||
| 1413 | return ret; | ||
| 1414 | } | ||
| 1354 | /* Set io allowed member of file handle to TRUE */ | 1415 | /* Set io allowed member of file handle to TRUE */ |
| 1355 | fh->io_allowed = 1; | 1416 | fh->io_allowed = 1; |
| 1356 | /* Increment io usrs member of layer object to 1 */ | 1417 | /* Increment io usrs member of layer object to 1 */ |
| @@ -1360,9 +1421,7 @@ static int vpbe_display_reqbufs(struct file *file, void *priv, | |||
| 1360 | /* Initialize buffer queue */ | 1421 | /* Initialize buffer queue */ |
| 1361 | INIT_LIST_HEAD(&layer->dma_queue); | 1422 | INIT_LIST_HEAD(&layer->dma_queue); |
| 1362 | /* Allocate buffers */ | 1423 | /* Allocate buffers */ |
| 1363 | ret = videobuf_reqbufs(&layer->buffer_queue, req_buf); | 1424 | return vb2_reqbufs(q, req_buf); |
| 1364 | |||
| 1365 | return ret; | ||
| 1366 | } | 1425 | } |
| 1367 | 1426 | ||
| 1368 | /* | 1427 | /* |
| @@ -1381,7 +1440,7 @@ static int vpbe_display_mmap(struct file *filep, struct vm_area_struct *vma) | |||
| 1381 | 1440 | ||
| 1382 | if (mutex_lock_interruptible(&layer->opslock)) | 1441 | if (mutex_lock_interruptible(&layer->opslock)) |
| 1383 | return -ERESTARTSYS; | 1442 | return -ERESTARTSYS; |
| 1384 | ret = videobuf_mmap_mapper(&layer->buffer_queue, vma); | 1443 | ret = vb2_mmap(&layer->buffer_queue, vma); |
| 1385 | mutex_unlock(&layer->opslock); | 1444 | mutex_unlock(&layer->opslock); |
| 1386 | return ret; | 1445 | return ret; |
| 1387 | } | 1446 | } |
| @@ -1398,7 +1457,7 @@ static unsigned int vpbe_display_poll(struct file *filep, poll_table *wait) | |||
| 1398 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_poll\n"); | 1457 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_poll\n"); |
| 1399 | if (layer->started) { | 1458 | if (layer->started) { |
| 1400 | mutex_lock(&layer->opslock); | 1459 | mutex_lock(&layer->opslock); |
| 1401 | err = videobuf_poll_stream(filep, &layer->buffer_queue, wait); | 1460 | err = vb2_poll(&layer->buffer_queue, filep, wait); |
| 1402 | mutex_unlock(&layer->opslock); | 1461 | mutex_unlock(&layer->opslock); |
| 1403 | } | 1462 | } |
| 1404 | return err; | 1463 | return err; |
| @@ -1488,8 +1547,8 @@ static int vpbe_display_release(struct file *file) | |||
| 1488 | layer->layer_info.id); | 1547 | layer->layer_info.id); |
| 1489 | layer->started = 0; | 1548 | layer->started = 0; |
| 1490 | /* Free buffers allocated */ | 1549 | /* Free buffers allocated */ |
| 1491 | videobuf_queue_cancel(&layer->buffer_queue); | 1550 | vb2_queue_release(&layer->buffer_queue); |
| 1492 | videobuf_mmap_free(&layer->buffer_queue); | 1551 | vb2_dma_contig_cleanup_ctx(&layer->buffer_queue); |
| 1493 | } | 1552 | } |
| 1494 | 1553 | ||
| 1495 | /* Decrement layer usrs counter */ | 1554 | /* Decrement layer usrs counter */ |
| @@ -1603,8 +1662,8 @@ static int vpbe_device_get(struct device *dev, void *data) | |||
| 1603 | return 0; | 1662 | return 0; |
| 1604 | } | 1663 | } |
| 1605 | 1664 | ||
| 1606 | static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, | 1665 | static int init_vpbe_layer(int i, struct vpbe_display *disp_dev, |
| 1607 | struct platform_device *pdev) | 1666 | struct platform_device *pdev) |
| 1608 | { | 1667 | { |
| 1609 | struct vpbe_layer *vpbe_display_layer = NULL; | 1668 | struct vpbe_layer *vpbe_display_layer = NULL; |
| 1610 | struct video_device *vbd = NULL; | 1669 | struct video_device *vbd = NULL; |
| @@ -1659,9 +1718,10 @@ static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, | |||
| 1659 | return 0; | 1718 | return 0; |
| 1660 | } | 1719 | } |
| 1661 | 1720 | ||
| 1662 | static __devinit int register_device(struct vpbe_layer *vpbe_display_layer, | 1721 | static int register_device(struct vpbe_layer *vpbe_display_layer, |
| 1663 | struct vpbe_display *disp_dev, | 1722 | struct vpbe_display *disp_dev, |
| 1664 | struct platform_device *pdev) { | 1723 | struct platform_device *pdev) |
| 1724 | { | ||
| 1665 | int err; | 1725 | int err; |
| 1666 | 1726 | ||
| 1667 | v4l2_info(&disp_dev->vpbe_dev->v4l2_dev, | 1727 | v4l2_info(&disp_dev->vpbe_dev->v4l2_dev, |
| @@ -1693,7 +1753,7 @@ static __devinit int register_device(struct vpbe_layer *vpbe_display_layer, | |||
| 1693 | * This function creates device entries by register itself to the V4L2 driver | 1753 | * This function creates device entries by register itself to the V4L2 driver |
| 1694 | * and initializes fields of each layer objects | 1754 | * and initializes fields of each layer objects |
| 1695 | */ | 1755 | */ |
| 1696 | static __devinit int vpbe_display_probe(struct platform_device *pdev) | 1756 | static int vpbe_display_probe(struct platform_device *pdev) |
| 1697 | { | 1757 | { |
| 1698 | struct vpbe_layer *vpbe_display_layer; | 1758 | struct vpbe_layer *vpbe_display_layer; |
| 1699 | struct vpbe_display *disp_dev; | 1759 | struct vpbe_display *disp_dev; |
| @@ -1827,7 +1887,7 @@ static struct platform_driver vpbe_display_driver = { | |||
| 1827 | .bus = &platform_bus_type, | 1887 | .bus = &platform_bus_type, |
| 1828 | }, | 1888 | }, |
| 1829 | .probe = vpbe_display_probe, | 1889 | .probe = vpbe_display_probe, |
| 1830 | .remove = __devexit_p(vpbe_display_remove), | 1890 | .remove = vpbe_display_remove, |
| 1831 | }; | 1891 | }; |
| 1832 | 1892 | ||
| 1833 | module_platform_driver(vpbe_display_driver); | 1893 | module_platform_driver(vpbe_display_driver); |
diff --git a/drivers/media/platform/davinci/vpbe_osd.c b/drivers/media/platform/davinci/vpbe_osd.c index bba299dbf396..707f243f810d 100644 --- a/drivers/media/platform/davinci/vpbe_osd.c +++ b/drivers/media/platform/davinci/vpbe_osd.c | |||
| @@ -62,7 +62,7 @@ static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 offset) | |||
| 62 | { | 62 | { |
| 63 | struct osd_state *osd = sd; | 63 | struct osd_state *osd = sd; |
| 64 | 64 | ||
| 65 | u32 addr = osd->osd_base + offset; | 65 | void __iomem *addr = osd->osd_base + offset; |
| 66 | u32 val = readl(addr) | mask; | 66 | u32 val = readl(addr) | mask; |
| 67 | 67 | ||
| 68 | writel(val, addr); | 68 | writel(val, addr); |
| @@ -74,7 +74,7 @@ static inline u32 osd_clear(struct osd_state *sd, u32 mask, u32 offset) | |||
| 74 | { | 74 | { |
| 75 | struct osd_state *osd = sd; | 75 | struct osd_state *osd = sd; |
| 76 | 76 | ||
| 77 | u32 addr = osd->osd_base + offset; | 77 | void __iomem *addr = osd->osd_base + offset; |
| 78 | u32 val = readl(addr) & ~mask; | 78 | u32 val = readl(addr) & ~mask; |
| 79 | 79 | ||
| 80 | writel(val, addr); | 80 | writel(val, addr); |
| @@ -87,7 +87,7 @@ static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val, | |||
| 87 | { | 87 | { |
| 88 | struct osd_state *osd = sd; | 88 | struct osd_state *osd = sd; |
| 89 | 89 | ||
| 90 | u32 addr = osd->osd_base + offset; | 90 | void __iomem *addr = osd->osd_base + offset; |
| 91 | u32 new_val = (readl(addr) & ~mask) | (val & mask); | 91 | u32 new_val = (readl(addr) & ~mask) | (val & mask); |
| 92 | 92 | ||
| 93 | writel(new_val, addr); | 93 | writel(new_val, addr); |
| @@ -1559,8 +1559,7 @@ static int osd_probe(struct platform_device *pdev) | |||
| 1559 | ret = -ENODEV; | 1559 | ret = -ENODEV; |
| 1560 | goto free_mem; | 1560 | goto free_mem; |
| 1561 | } | 1561 | } |
| 1562 | osd->osd_base = (unsigned long)ioremap_nocache(res->start, | 1562 | osd->osd_base = ioremap_nocache(res->start, osd->osd_size); |
| 1563 | osd->osd_size); | ||
| 1564 | if (!osd->osd_base) { | 1563 | if (!osd->osd_base) { |
| 1565 | dev_err(osd->dev, "Unable to map the OSD region\n"); | 1564 | dev_err(osd->dev, "Unable to map the OSD region\n"); |
| 1566 | ret = -ENODEV; | 1565 | ret = -ENODEV; |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 8be492cd8ed4..be9d3e1b4868 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
| @@ -1831,7 +1831,7 @@ static struct vpfe_device *vpfe_initialize(void) | |||
| 1831 | * itself to the V4L2 driver and initializes fields of each | 1831 | * itself to the V4L2 driver and initializes fields of each |
| 1832 | * device objects | 1832 | * device objects |
| 1833 | */ | 1833 | */ |
| 1834 | static __devinit int vpfe_probe(struct platform_device *pdev) | 1834 | static int vpfe_probe(struct platform_device *pdev) |
| 1835 | { | 1835 | { |
| 1836 | struct vpfe_subdev_info *sdinfo; | 1836 | struct vpfe_subdev_info *sdinfo; |
| 1837 | struct vpfe_config *vpfe_cfg; | 1837 | struct vpfe_config *vpfe_cfg; |
| @@ -2038,7 +2038,7 @@ probe_free_dev_mem: | |||
| 2038 | /* | 2038 | /* |
| 2039 | * vpfe_remove : It un-register device from V4L2 driver | 2039 | * vpfe_remove : It un-register device from V4L2 driver |
| 2040 | */ | 2040 | */ |
| 2041 | static int __devexit vpfe_remove(struct platform_device *pdev) | 2041 | static int vpfe_remove(struct platform_device *pdev) |
| 2042 | { | 2042 | { |
| 2043 | struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev); | 2043 | struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev); |
| 2044 | 2044 | ||
| @@ -2075,7 +2075,7 @@ static struct platform_driver vpfe_driver = { | |||
| 2075 | .pm = &vpfe_dev_pm_ops, | 2075 | .pm = &vpfe_dev_pm_ops, |
| 2076 | }, | 2076 | }, |
| 2077 | .probe = vpfe_probe, | 2077 | .probe = vpfe_probe, |
| 2078 | .remove = __devexit_p(vpfe_remove), | 2078 | .remove = vpfe_remove, |
| 2079 | }; | 2079 | }; |
| 2080 | 2080 | ||
| 2081 | module_platform_driver(vpfe_driver); | 2081 | module_platform_driver(vpfe_driver); |
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index cff3c0ab501f..28638a86f129 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c | |||
| @@ -419,7 +419,7 @@ int vpif_channel_getfid(u8 channel_id) | |||
| 419 | } | 419 | } |
| 420 | EXPORT_SYMBOL(vpif_channel_getfid); | 420 | EXPORT_SYMBOL(vpif_channel_getfid); |
| 421 | 421 | ||
| 422 | static int __devinit vpif_probe(struct platform_device *pdev) | 422 | static int vpif_probe(struct platform_device *pdev) |
| 423 | { | 423 | { |
| 424 | int status = 0; | 424 | int status = 0; |
| 425 | 425 | ||
| @@ -444,7 +444,7 @@ static int __devinit vpif_probe(struct platform_device *pdev) | |||
| 444 | status = PTR_ERR(vpif_clk); | 444 | status = PTR_ERR(vpif_clk); |
| 445 | goto clk_fail; | 445 | goto clk_fail; |
| 446 | } | 446 | } |
| 447 | clk_enable(vpif_clk); | 447 | clk_prepare_enable(vpif_clk); |
| 448 | 448 | ||
| 449 | spin_lock_init(&vpif_lock); | 449 | spin_lock_init(&vpif_lock); |
| 450 | dev_info(&pdev->dev, "vpif probe success\n"); | 450 | dev_info(&pdev->dev, "vpif probe success\n"); |
| @@ -457,10 +457,10 @@ fail: | |||
| 457 | return status; | 457 | return status; |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | static int __devexit vpif_remove(struct platform_device *pdev) | 460 | static int vpif_remove(struct platform_device *pdev) |
| 461 | { | 461 | { |
| 462 | if (vpif_clk) { | 462 | if (vpif_clk) { |
| 463 | clk_disable(vpif_clk); | 463 | clk_disable_unprepare(vpif_clk); |
| 464 | clk_put(vpif_clk); | 464 | clk_put(vpif_clk); |
| 465 | } | 465 | } |
| 466 | 466 | ||
| @@ -472,13 +472,13 @@ static int __devexit vpif_remove(struct platform_device *pdev) | |||
| 472 | #ifdef CONFIG_PM | 472 | #ifdef CONFIG_PM |
| 473 | static int vpif_suspend(struct device *dev) | 473 | static int vpif_suspend(struct device *dev) |
| 474 | { | 474 | { |
| 475 | clk_disable(vpif_clk); | 475 | clk_disable_unprepare(vpif_clk); |
| 476 | return 0; | 476 | return 0; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static int vpif_resume(struct device *dev) | 479 | static int vpif_resume(struct device *dev) |
| 480 | { | 480 | { |
| 481 | clk_enable(vpif_clk); | 481 | clk_prepare_enable(vpif_clk); |
| 482 | return 0; | 482 | return 0; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| @@ -498,7 +498,7 @@ static struct platform_driver vpif_driver = { | |||
| 498 | .owner = THIS_MODULE, | 498 | .owner = THIS_MODULE, |
| 499 | .pm = vpif_pm_ops, | 499 | .pm = vpif_pm_ops, |
| 500 | }, | 500 | }, |
| 501 | .remove = __devexit_p(vpif_remove), | 501 | .remove = vpif_remove, |
| 502 | .probe = vpif_probe, | 502 | .probe = vpif_probe, |
| 503 | }; | 503 | }; |
| 504 | 504 | ||
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index fcabc023885d..a409ccefb380 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
| @@ -201,13 +201,16 @@ static void vpif_buffer_queue(struct vb2_buffer *vb) | |||
| 201 | struct vpif_cap_buffer *buf = container_of(vb, | 201 | struct vpif_cap_buffer *buf = container_of(vb, |
| 202 | struct vpif_cap_buffer, vb); | 202 | struct vpif_cap_buffer, vb); |
| 203 | struct common_obj *common; | 203 | struct common_obj *common; |
| 204 | unsigned long flags; | ||
| 204 | 205 | ||
| 205 | common = &ch->common[VPIF_VIDEO_INDEX]; | 206 | common = &ch->common[VPIF_VIDEO_INDEX]; |
| 206 | 207 | ||
| 207 | vpif_dbg(2, debug, "vpif_buffer_queue\n"); | 208 | vpif_dbg(2, debug, "vpif_buffer_queue\n"); |
| 208 | 209 | ||
| 210 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 209 | /* add the buffer to the DMA queue */ | 211 | /* add the buffer to the DMA queue */ |
| 210 | list_add_tail(&buf->list, &common->dma_queue); | 212 | list_add_tail(&buf->list, &common->dma_queue); |
| 213 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 211 | } | 214 | } |
| 212 | 215 | ||
| 213 | /** | 216 | /** |
| @@ -278,10 +281,13 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
| 278 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 281 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
| 279 | struct vpif_params *vpif = &ch->vpifparams; | 282 | struct vpif_params *vpif = &ch->vpifparams; |
| 280 | unsigned long addr = 0; | 283 | unsigned long addr = 0; |
| 284 | unsigned long flags; | ||
| 281 | int ret; | 285 | int ret; |
| 282 | 286 | ||
| 283 | /* If buffer queue is empty, return error */ | 287 | /* If buffer queue is empty, return error */ |
| 288 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 284 | if (list_empty(&common->dma_queue)) { | 289 | if (list_empty(&common->dma_queue)) { |
| 290 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 285 | vpif_dbg(1, debug, "buffer queue is empty\n"); | 291 | vpif_dbg(1, debug, "buffer queue is empty\n"); |
| 286 | return -EIO; | 292 | return -EIO; |
| 287 | } | 293 | } |
| @@ -291,6 +297,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
| 291 | struct vpif_cap_buffer, list); | 297 | struct vpif_cap_buffer, list); |
| 292 | /* Remove buffer from the buffer queue */ | 298 | /* Remove buffer from the buffer queue */ |
| 293 | list_del(&common->cur_frm->list); | 299 | list_del(&common->cur_frm->list); |
| 300 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 294 | /* Mark state of the current frame to active */ | 301 | /* Mark state of the current frame to active */ |
| 295 | common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE; | 302 | common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE; |
| 296 | /* Initialize field_id and started member */ | 303 | /* Initialize field_id and started member */ |
| @@ -362,6 +369,7 @@ static int vpif_stop_streaming(struct vb2_queue *vq) | |||
| 362 | struct vpif_fh *fh = vb2_get_drv_priv(vq); | 369 | struct vpif_fh *fh = vb2_get_drv_priv(vq); |
| 363 | struct channel_obj *ch = fh->channel; | 370 | struct channel_obj *ch = fh->channel; |
| 364 | struct common_obj *common; | 371 | struct common_obj *common; |
| 372 | unsigned long flags; | ||
| 365 | 373 | ||
| 366 | if (!vb2_is_streaming(vq)) | 374 | if (!vb2_is_streaming(vq)) |
| 367 | return 0; | 375 | return 0; |
| @@ -369,12 +377,14 @@ static int vpif_stop_streaming(struct vb2_queue *vq) | |||
| 369 | common = &ch->common[VPIF_VIDEO_INDEX]; | 377 | common = &ch->common[VPIF_VIDEO_INDEX]; |
| 370 | 378 | ||
| 371 | /* release all active buffers */ | 379 | /* release all active buffers */ |
| 380 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 372 | while (!list_empty(&common->dma_queue)) { | 381 | while (!list_empty(&common->dma_queue)) { |
| 373 | common->next_frm = list_entry(common->dma_queue.next, | 382 | common->next_frm = list_entry(common->dma_queue.next, |
| 374 | struct vpif_cap_buffer, list); | 383 | struct vpif_cap_buffer, list); |
| 375 | list_del(&common->next_frm->list); | 384 | list_del(&common->next_frm->list); |
| 376 | vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); | 385 | vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); |
| 377 | } | 386 | } |
| 387 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 378 | 388 | ||
| 379 | return 0; | 389 | return 0; |
| 380 | } | 390 | } |
| @@ -420,10 +430,12 @@ static void vpif_schedule_next_buffer(struct common_obj *common) | |||
| 420 | { | 430 | { |
| 421 | unsigned long addr = 0; | 431 | unsigned long addr = 0; |
| 422 | 432 | ||
| 433 | spin_lock(&common->irqlock); | ||
| 423 | common->next_frm = list_entry(common->dma_queue.next, | 434 | common->next_frm = list_entry(common->dma_queue.next, |
| 424 | struct vpif_cap_buffer, list); | 435 | struct vpif_cap_buffer, list); |
| 425 | /* Remove that buffer from the buffer queue */ | 436 | /* Remove that buffer from the buffer queue */ |
| 426 | list_del(&common->next_frm->list); | 437 | list_del(&common->next_frm->list); |
| 438 | spin_unlock(&common->irqlock); | ||
| 427 | common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE; | 439 | common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE; |
| 428 | addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0); | 440 | addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0); |
| 429 | 441 | ||
| @@ -468,8 +480,12 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
| 468 | /* Check the field format */ | 480 | /* Check the field format */ |
| 469 | if (1 == ch->vpifparams.std_info.frm_fmt) { | 481 | if (1 == ch->vpifparams.std_info.frm_fmt) { |
| 470 | /* Progressive mode */ | 482 | /* Progressive mode */ |
| 471 | if (list_empty(&common->dma_queue)) | 483 | spin_lock(&common->irqlock); |
| 484 | if (list_empty(&common->dma_queue)) { | ||
| 485 | spin_unlock(&common->irqlock); | ||
| 472 | continue; | 486 | continue; |
| 487 | } | ||
| 488 | spin_unlock(&common->irqlock); | ||
| 473 | 489 | ||
| 474 | if (!channel_first_int[i][channel_id]) | 490 | if (!channel_first_int[i][channel_id]) |
| 475 | vpif_process_buffer_complete(common); | 491 | vpif_process_buffer_complete(common); |
| @@ -513,9 +529,13 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
| 513 | vpif_process_buffer_complete(common); | 529 | vpif_process_buffer_complete(common); |
| 514 | } else if (1 == fid) { | 530 | } else if (1 == fid) { |
| 515 | /* odd field */ | 531 | /* odd field */ |
| 532 | spin_lock(&common->irqlock); | ||
| 516 | if (list_empty(&common->dma_queue) || | 533 | if (list_empty(&common->dma_queue) || |
| 517 | (common->cur_frm != common->next_frm)) | 534 | (common->cur_frm != common->next_frm)) { |
| 535 | spin_unlock(&common->irqlock); | ||
| 518 | continue; | 536 | continue; |
| 537 | } | ||
| 538 | spin_unlock(&common->irqlock); | ||
| 519 | 539 | ||
| 520 | vpif_schedule_next_buffer(common); | 540 | vpif_schedule_next_buffer(common); |
| 521 | } | 541 | } |
| @@ -1004,9 +1024,9 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
| 1004 | 1024 | ||
| 1005 | /* Initialize videobuf2 queue as per the buffer type */ | 1025 | /* Initialize videobuf2 queue as per the buffer type */ |
| 1006 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); | 1026 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); |
| 1007 | if (!common->alloc_ctx) { | 1027 | if (IS_ERR(common->alloc_ctx)) { |
| 1008 | vpif_err("Failed to get the context\n"); | 1028 | vpif_err("Failed to get the context\n"); |
| 1009 | return -EINVAL; | 1029 | return PTR_ERR(common->alloc_ctx); |
| 1010 | } | 1030 | } |
| 1011 | q = &common->buffer_queue; | 1031 | q = &common->buffer_queue; |
| 1012 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1032 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
| @@ -1715,7 +1735,7 @@ vpif_enum_dv_timings(struct file *file, void *priv, | |||
| 1715 | int ret; | 1735 | int ret; |
| 1716 | 1736 | ||
| 1717 | ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); | 1737 | ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); |
| 1718 | if (ret == -ENOIOCTLCMD && ret == -ENODEV) | 1738 | if (ret == -ENOIOCTLCMD || ret == -ENODEV) |
| 1719 | return -EINVAL; | 1739 | return -EINVAL; |
| 1720 | return ret; | 1740 | return ret; |
| 1721 | } | 1741 | } |
| @@ -1735,7 +1755,7 @@ vpif_query_dv_timings(struct file *file, void *priv, | |||
| 1735 | int ret; | 1755 | int ret; |
| 1736 | 1756 | ||
| 1737 | ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings); | 1757 | ret = v4l2_subdev_call(ch->sd, video, query_dv_timings, timings); |
| 1738 | if (ret == -ENOIOCTLCMD && ret == -ENODEV) | 1758 | if (ret == -ENOIOCTLCMD || ret == -ENODEV) |
| 1739 | return -ENODATA; | 1759 | return -ENODATA; |
| 1740 | return ret; | 1760 | return ret; |
| 1741 | } | 1761 | } |
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index b716fbd4241f..9f2b603be9c9 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c | |||
| @@ -177,11 +177,14 @@ static void vpif_buffer_queue(struct vb2_buffer *vb) | |||
| 177 | struct vpif_disp_buffer, vb); | 177 | struct vpif_disp_buffer, vb); |
| 178 | struct channel_obj *ch = fh->channel; | 178 | struct channel_obj *ch = fh->channel; |
| 179 | struct common_obj *common; | 179 | struct common_obj *common; |
| 180 | unsigned long flags; | ||
| 180 | 181 | ||
| 181 | common = &ch->common[VPIF_VIDEO_INDEX]; | 182 | common = &ch->common[VPIF_VIDEO_INDEX]; |
| 182 | 183 | ||
| 183 | /* add the buffer to the DMA queue */ | 184 | /* add the buffer to the DMA queue */ |
| 185 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 184 | list_add_tail(&buf->list, &common->dma_queue); | 186 | list_add_tail(&buf->list, &common->dma_queue); |
| 187 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 185 | } | 188 | } |
| 186 | 189 | ||
| 187 | /* | 190 | /* |
| @@ -246,10 +249,13 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
| 246 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 249 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
| 247 | struct vpif_params *vpif = &ch->vpifparams; | 250 | struct vpif_params *vpif = &ch->vpifparams; |
| 248 | unsigned long addr = 0; | 251 | unsigned long addr = 0; |
| 252 | unsigned long flags; | ||
| 249 | int ret; | 253 | int ret; |
| 250 | 254 | ||
| 251 | /* If buffer queue is empty, return error */ | 255 | /* If buffer queue is empty, return error */ |
| 256 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 252 | if (list_empty(&common->dma_queue)) { | 257 | if (list_empty(&common->dma_queue)) { |
| 258 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 253 | vpif_err("buffer queue is empty\n"); | 259 | vpif_err("buffer queue is empty\n"); |
| 254 | return -EIO; | 260 | return -EIO; |
| 255 | } | 261 | } |
| @@ -260,6 +266,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
| 260 | struct vpif_disp_buffer, list); | 266 | struct vpif_disp_buffer, list); |
| 261 | 267 | ||
| 262 | list_del(&common->cur_frm->list); | 268 | list_del(&common->cur_frm->list); |
| 269 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 263 | /* Mark state of the current frame to active */ | 270 | /* Mark state of the current frame to active */ |
| 264 | common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE; | 271 | common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE; |
| 265 | 272 | ||
| @@ -330,6 +337,7 @@ static int vpif_stop_streaming(struct vb2_queue *vq) | |||
| 330 | struct vpif_fh *fh = vb2_get_drv_priv(vq); | 337 | struct vpif_fh *fh = vb2_get_drv_priv(vq); |
| 331 | struct channel_obj *ch = fh->channel; | 338 | struct channel_obj *ch = fh->channel; |
| 332 | struct common_obj *common; | 339 | struct common_obj *common; |
| 340 | unsigned long flags; | ||
| 333 | 341 | ||
| 334 | if (!vb2_is_streaming(vq)) | 342 | if (!vb2_is_streaming(vq)) |
| 335 | return 0; | 343 | return 0; |
| @@ -337,12 +345,14 @@ static int vpif_stop_streaming(struct vb2_queue *vq) | |||
| 337 | common = &ch->common[VPIF_VIDEO_INDEX]; | 345 | common = &ch->common[VPIF_VIDEO_INDEX]; |
| 338 | 346 | ||
| 339 | /* release all active buffers */ | 347 | /* release all active buffers */ |
| 348 | spin_lock_irqsave(&common->irqlock, flags); | ||
| 340 | while (!list_empty(&common->dma_queue)) { | 349 | while (!list_empty(&common->dma_queue)) { |
| 341 | common->next_frm = list_entry(common->dma_queue.next, | 350 | common->next_frm = list_entry(common->dma_queue.next, |
| 342 | struct vpif_disp_buffer, list); | 351 | struct vpif_disp_buffer, list); |
| 343 | list_del(&common->next_frm->list); | 352 | list_del(&common->next_frm->list); |
| 344 | vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); | 353 | vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR); |
| 345 | } | 354 | } |
| 355 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 346 | 356 | ||
| 347 | return 0; | 357 | return 0; |
| 348 | } | 358 | } |
| @@ -363,11 +373,13 @@ static void process_progressive_mode(struct common_obj *common) | |||
| 363 | { | 373 | { |
| 364 | unsigned long addr = 0; | 374 | unsigned long addr = 0; |
| 365 | 375 | ||
| 376 | spin_lock(&common->irqlock); | ||
| 366 | /* Get the next buffer from buffer queue */ | 377 | /* Get the next buffer from buffer queue */ |
| 367 | common->next_frm = list_entry(common->dma_queue.next, | 378 | common->next_frm = list_entry(common->dma_queue.next, |
| 368 | struct vpif_disp_buffer, list); | 379 | struct vpif_disp_buffer, list); |
| 369 | /* Remove that buffer from the buffer queue */ | 380 | /* Remove that buffer from the buffer queue */ |
| 370 | list_del(&common->next_frm->list); | 381 | list_del(&common->next_frm->list); |
| 382 | spin_unlock(&common->irqlock); | ||
| 371 | /* Mark status of the buffer as active */ | 383 | /* Mark status of the buffer as active */ |
| 372 | common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE; | 384 | common->next_frm->vb.state = VB2_BUF_STATE_ACTIVE; |
| 373 | 385 | ||
| @@ -398,16 +410,18 @@ static void process_interlaced_mode(int fid, struct common_obj *common) | |||
| 398 | common->cur_frm = common->next_frm; | 410 | common->cur_frm = common->next_frm; |
| 399 | 411 | ||
| 400 | } else if (1 == fid) { /* odd field */ | 412 | } else if (1 == fid) { /* odd field */ |
| 413 | spin_lock(&common->irqlock); | ||
| 401 | if (list_empty(&common->dma_queue) | 414 | if (list_empty(&common->dma_queue) |
| 402 | || (common->cur_frm != common->next_frm)) { | 415 | || (common->cur_frm != common->next_frm)) { |
| 416 | spin_unlock(&common->irqlock); | ||
| 403 | return; | 417 | return; |
| 404 | } | 418 | } |
| 419 | spin_unlock(&common->irqlock); | ||
| 405 | /* one field is displayed configure the next | 420 | /* one field is displayed configure the next |
| 406 | * frame if it is available else hold on current | 421 | * frame if it is available else hold on current |
| 407 | * frame */ | 422 | * frame */ |
| 408 | /* Get next from the buffer queue */ | 423 | /* Get next from the buffer queue */ |
| 409 | process_progressive_mode(common); | 424 | process_progressive_mode(common); |
| 410 | |||
| 411 | } | 425 | } |
| 412 | } | 426 | } |
| 413 | 427 | ||
| @@ -437,8 +451,12 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
| 437 | continue; | 451 | continue; |
| 438 | 452 | ||
| 439 | if (1 == ch->vpifparams.std_info.frm_fmt) { | 453 | if (1 == ch->vpifparams.std_info.frm_fmt) { |
| 440 | if (list_empty(&common->dma_queue)) | 454 | spin_lock(&common->irqlock); |
| 455 | if (list_empty(&common->dma_queue)) { | ||
| 456 | spin_unlock(&common->irqlock); | ||
| 441 | continue; | 457 | continue; |
| 458 | } | ||
| 459 | spin_unlock(&common->irqlock); | ||
| 442 | 460 | ||
| 443 | /* Progressive mode */ | 461 | /* Progressive mode */ |
| 444 | if (!channel_first_int[i][channel_id]) { | 462 | if (!channel_first_int[i][channel_id]) { |
| @@ -972,9 +990,9 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
| 972 | } | 990 | } |
| 973 | /* Initialize videobuf2 queue as per the buffer type */ | 991 | /* Initialize videobuf2 queue as per the buffer type */ |
| 974 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); | 992 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); |
| 975 | if (!common->alloc_ctx) { | 993 | if (IS_ERR(common->alloc_ctx)) { |
| 976 | vpif_err("Failed to get the context\n"); | 994 | vpif_err("Failed to get the context\n"); |
| 977 | return -EINVAL; | 995 | return PTR_ERR(common->alloc_ctx); |
| 978 | } | 996 | } |
| 979 | q = &common->buffer_queue; | 997 | q = &common->buffer_queue; |
| 980 | q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; | 998 | q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
| @@ -1380,7 +1398,7 @@ vpif_enum_dv_timings(struct file *file, void *priv, | |||
| 1380 | int ret; | 1398 | int ret; |
| 1381 | 1399 | ||
| 1382 | ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); | 1400 | ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings); |
| 1383 | if (ret == -ENOIOCTLCMD && ret == -ENODEV) | 1401 | if (ret == -ENOIOCTLCMD || ret == -ENODEV) |
| 1384 | return -EINVAL; | 1402 | return -EINVAL; |
| 1385 | return ret; | 1403 | return ret; |
| 1386 | } | 1404 | } |
diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c index 146e4b01ac17..cdbff88e0f1e 100644 --- a/drivers/media/platform/davinci/vpss.c +++ b/drivers/media/platform/davinci/vpss.c | |||
| @@ -357,7 +357,7 @@ void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size) | |||
| 357 | } | 357 | } |
| 358 | EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size); | 358 | EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size); |
| 359 | 359 | ||
| 360 | static int __devinit vpss_probe(struct platform_device *pdev) | 360 | static int vpss_probe(struct platform_device *pdev) |
| 361 | { | 361 | { |
| 362 | struct resource *r1, *r2; | 362 | struct resource *r1, *r2; |
| 363 | char *platform_name; | 363 | char *platform_name; |
| @@ -445,7 +445,7 @@ fail1: | |||
| 445 | return status; | 445 | return status; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | static int __devexit vpss_remove(struct platform_device *pdev) | 448 | static int vpss_remove(struct platform_device *pdev) |
| 449 | { | 449 | { |
| 450 | struct resource *res; | 450 | struct resource *res; |
| 451 | 451 | ||
| @@ -465,7 +465,7 @@ static struct platform_driver vpss_driver = { | |||
| 465 | .name = "vpss", | 465 | .name = "vpss", |
| 466 | .owner = THIS_MODULE, | 466 | .owner = THIS_MODULE, |
| 467 | }, | 467 | }, |
| 468 | .remove = __devexit_p(vpss_remove), | 468 | .remove = vpss_remove, |
| 469 | .probe = vpss_probe, | 469 | .probe = vpss_probe, |
| 470 | }; | 470 | }; |
| 471 | 471 | ||
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index bfec9e65aefb..2b1b9f30e1f9 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c | |||
| @@ -965,8 +965,10 @@ static struct platform_device_id gsc_driver_ids[] = { | |||
| 965 | MODULE_DEVICE_TABLE(platform, gsc_driver_ids); | 965 | MODULE_DEVICE_TABLE(platform, gsc_driver_ids); |
| 966 | 966 | ||
| 967 | static const struct of_device_id exynos_gsc_match[] = { | 967 | static const struct of_device_id exynos_gsc_match[] = { |
| 968 | { .compatible = "samsung,exynos5250-gsc", | 968 | { |
| 969 | .data = &gsc_v_100_drvdata, }, | 969 | .compatible = "samsung,exynos5-gsc", |
| 970 | .data = &gsc_v_100_drvdata, | ||
| 971 | }, | ||
| 970 | {}, | 972 | {}, |
| 971 | }; | 973 | }; |
| 972 | MODULE_DEVICE_TABLE(of, exynos_gsc_match); | 974 | MODULE_DEVICE_TABLE(of, exynos_gsc_match); |
| @@ -980,7 +982,7 @@ static void *gsc_get_drv_data(struct platform_device *pdev) | |||
| 980 | match = of_match_node(of_match_ptr(exynos_gsc_match), | 982 | match = of_match_node(of_match_ptr(exynos_gsc_match), |
| 981 | pdev->dev.of_node); | 983 | pdev->dev.of_node); |
| 982 | if (match) | 984 | if (match) |
| 983 | driver_data = match->data; | 985 | driver_data = (struct gsc_driverdata *)match->data; |
| 984 | } else { | 986 | } else { |
| 985 | driver_data = (struct gsc_driverdata *) | 987 | driver_data = (struct gsc_driverdata *) |
| 986 | platform_get_device_id(pdev)->driver_data; | 988 | platform_get_device_id(pdev)->driver_data; |
| @@ -1149,7 +1151,7 @@ err_clk: | |||
| 1149 | return ret; | 1151 | return ret; |
| 1150 | } | 1152 | } |
| 1151 | 1153 | ||
| 1152 | static int __devexit gsc_remove(struct platform_device *pdev) | 1154 | static int gsc_remove(struct platform_device *pdev) |
| 1153 | { | 1155 | { |
| 1154 | struct gsc_dev *gsc = platform_get_drvdata(pdev); | 1156 | struct gsc_dev *gsc = platform_get_drvdata(pdev); |
| 1155 | 1157 | ||
| @@ -1235,7 +1237,7 @@ static const struct dev_pm_ops gsc_pm_ops = { | |||
| 1235 | 1237 | ||
| 1236 | static struct platform_driver gsc_driver = { | 1238 | static struct platform_driver gsc_driver = { |
| 1237 | .probe = gsc_probe, | 1239 | .probe = gsc_probe, |
| 1238 | .remove = __devexit_p(gsc_remove), | 1240 | .remove = gsc_remove, |
| 1239 | .id_table = gsc_driver_ids, | 1241 | .id_table = gsc_driver_ids, |
| 1240 | .driver = { | 1242 | .driver = { |
| 1241 | .name = GSC_MODULE_NAME, | 1243 | .name = GSC_MODULE_NAME, |
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 3c7f00577bd9..c267c57c76fd 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c | |||
| @@ -122,7 +122,7 @@ static void gsc_m2m_device_run(void *priv) | |||
| 122 | struct gsc_ctx *ctx = priv; | 122 | struct gsc_ctx *ctx = priv; |
| 123 | struct gsc_dev *gsc; | 123 | struct gsc_dev *gsc; |
| 124 | unsigned long flags; | 124 | unsigned long flags; |
| 125 | u32 ret; | 125 | int ret; |
| 126 | bool is_set = false; | 126 | bool is_set = false; |
| 127 | 127 | ||
| 128 | if (WARN(!ctx, "null hardware context\n")) | 128 | if (WARN(!ctx, "null hardware context\n")) |
| @@ -657,8 +657,7 @@ static int gsc_m2m_release(struct file *file) | |||
| 657 | pr_debug("pid: %d, state: 0x%lx, refcnt= %d", | 657 | pr_debug("pid: %d, state: 0x%lx, refcnt= %d", |
| 658 | task_pid_nr(current), gsc->state, gsc->m2m.refcnt); | 658 | task_pid_nr(current), gsc->state, gsc->m2m.refcnt); |
| 659 | 659 | ||
| 660 | if (mutex_lock_interruptible(&gsc->lock)) | 660 | mutex_lock(&gsc->lock); |
| 661 | return -ERESTARTSYS; | ||
| 662 | 661 | ||
| 663 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | 662 | v4l2_m2m_ctx_release(ctx->m2m_ctx); |
| 664 | gsc_ctrls_delete(ctx); | 663 | gsc_ctrls_delete(ctx); |
| @@ -732,6 +731,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc) | |||
| 732 | gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops; | 731 | gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops; |
| 733 | gsc->vdev.release = video_device_release_empty; | 732 | gsc->vdev.release = video_device_release_empty; |
| 734 | gsc->vdev.lock = &gsc->lock; | 733 | gsc->vdev.lock = &gsc->lock; |
| 734 | gsc->vdev.vfl_dir = VFL_DIR_M2M; | ||
| 735 | snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", | 735 | snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", |
| 736 | GSC_MODULE_NAME, gsc->id); | 736 | GSC_MODULE_NAME, gsc->id); |
| 737 | 737 | ||
diff --git a/drivers/media/platform/exynos-gsc/gsc-regs.h b/drivers/media/platform/exynos-gsc/gsc-regs.h index 533e9947a925..4678f9a6a4fd 100644 --- a/drivers/media/platform/exynos-gsc/gsc-regs.h +++ b/drivers/media/platform/exynos-gsc/gsc-regs.h | |||
| @@ -40,10 +40,10 @@ | |||
| 40 | #define GSC_IN_ROT_YFLIP (2 << 16) | 40 | #define GSC_IN_ROT_YFLIP (2 << 16) |
| 41 | #define GSC_IN_ROT_XFLIP (1 << 16) | 41 | #define GSC_IN_ROT_XFLIP (1 << 16) |
| 42 | #define GSC_IN_RGB_TYPE_MASK (3 << 14) | 42 | #define GSC_IN_RGB_TYPE_MASK (3 << 14) |
| 43 | #define GSC_IN_RGB_HD_WIDE (3 << 14) | 43 | #define GSC_IN_RGB_HD_NARROW (3 << 14) |
| 44 | #define GSC_IN_RGB_HD_NARROW (2 << 14) | 44 | #define GSC_IN_RGB_HD_WIDE (2 << 14) |
| 45 | #define GSC_IN_RGB_SD_WIDE (1 << 14) | 45 | #define GSC_IN_RGB_SD_NARROW (1 << 14) |
| 46 | #define GSC_IN_RGB_SD_NARROW (0 << 14) | 46 | #define GSC_IN_RGB_SD_WIDE (0 << 14) |
| 47 | #define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13) | 47 | #define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13) |
| 48 | #define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13) | 48 | #define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13) |
| 49 | #define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13) | 49 | #define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13) |
| @@ -85,10 +85,10 @@ | |||
| 85 | #define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24) | 85 | #define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24) |
| 86 | #define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24) | 86 | #define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24) |
| 87 | #define GSC_OUT_RGB_TYPE_MASK (3 << 10) | 87 | #define GSC_OUT_RGB_TYPE_MASK (3 << 10) |
| 88 | #define GSC_OUT_RGB_HD_NARROW (3 << 10) | 88 | #define GSC_OUT_RGB_HD_WIDE (3 << 10) |
| 89 | #define GSC_OUT_RGB_HD_WIDE (2 << 10) | 89 | #define GSC_OUT_RGB_HD_NARROW (2 << 10) |
| 90 | #define GSC_OUT_RGB_SD_NARROW (1 << 10) | 90 | #define GSC_OUT_RGB_SD_WIDE (1 << 10) |
| 91 | #define GSC_OUT_RGB_SD_WIDE (0 << 10) | 91 | #define GSC_OUT_RGB_SD_NARROW (0 << 10) |
| 92 | #define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9) | 92 | #define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9) |
| 93 | #define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9) | 93 | #define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9) |
| 94 | #define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9) | 94 | #define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9) |
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c index 31ac4dc69247..9115a2c8d075 100644 --- a/drivers/media/platform/fsl-viu.c +++ b/drivers/media/platform/fsl-viu.c | |||
| @@ -352,8 +352,7 @@ static int restart_video_queue(struct viu_dmaqueue *vidq) | |||
| 352 | return 0; | 352 | return 0; |
| 353 | buf = list_entry(vidq->queued.next, struct viu_buf, vb.queue); | 353 | buf = list_entry(vidq->queued.next, struct viu_buf, vb.queue); |
| 354 | if (prev == NULL) { | 354 | if (prev == NULL) { |
| 355 | list_del(&buf->vb.queue); | 355 | list_move_tail(&buf->vb.queue, &vidq->active); |
| 356 | list_add_tail(&buf->vb.queue, &vidq->active); | ||
| 357 | 356 | ||
| 358 | dprintk(1, "Restarting video dma\n"); | 357 | dprintk(1, "Restarting video dma\n"); |
| 359 | viu_stop_dma(vidq->dev); | 358 | viu_stop_dma(vidq->dev); |
| @@ -367,8 +366,7 @@ static int restart_video_queue(struct viu_dmaqueue *vidq) | |||
| 367 | } else if (prev->vb.width == buf->vb.width && | 366 | } else if (prev->vb.width == buf->vb.width && |
| 368 | prev->vb.height == buf->vb.height && | 367 | prev->vb.height == buf->vb.height && |
| 369 | prev->fmt == buf->fmt) { | 368 | prev->fmt == buf->fmt) { |
| 370 | list_del(&buf->vb.queue); | 369 | list_move_tail(&buf->vb.queue, &vidq->active); |
| 371 | list_add_tail(&buf->vb.queue, &vidq->active); | ||
| 372 | buf->vb.state = VIDEOBUF_ACTIVE; | 370 | buf->vb.state = VIDEOBUF_ACTIVE; |
| 373 | dprintk(2, "[%p/%d] restart_queue - move to active\n", | 371 | dprintk(2, "[%p/%d] restart_queue - move to active\n", |
| 374 | buf, buf->vb.i); | 372 | buf, buf->vb.i); |
| @@ -1480,7 +1478,7 @@ static struct video_device viu_template = { | |||
| 1480 | .current_norm = V4L2_STD_NTSC_M, | 1478 | .current_norm = V4L2_STD_NTSC_M, |
| 1481 | }; | 1479 | }; |
| 1482 | 1480 | ||
| 1483 | static int __devinit viu_of_probe(struct platform_device *op) | 1481 | static int viu_of_probe(struct platform_device *op) |
| 1484 | { | 1482 | { |
| 1485 | struct viu_dev *viu_dev; | 1483 | struct viu_dev *viu_dev; |
| 1486 | struct video_device *vdev; | 1484 | struct video_device *vdev; |
| @@ -1617,7 +1615,7 @@ err: | |||
| 1617 | return ret; | 1615 | return ret; |
| 1618 | } | 1616 | } |
| 1619 | 1617 | ||
| 1620 | static int __devexit viu_of_remove(struct platform_device *op) | 1618 | static int viu_of_remove(struct platform_device *op) |
| 1621 | { | 1619 | { |
| 1622 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1620 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
| 1623 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1621 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
| @@ -1670,7 +1668,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_viu_of_match); | |||
| 1670 | 1668 | ||
| 1671 | static struct platform_driver viu_of_platform_driver = { | 1669 | static struct platform_driver viu_of_platform_driver = { |
| 1672 | .probe = viu_of_probe, | 1670 | .probe = viu_of_probe, |
| 1673 | .remove = __devexit_p(viu_of_remove), | 1671 | .remove = viu_of_remove, |
| 1674 | #ifdef CONFIG_PM | 1672 | #ifdef CONFIG_PM |
| 1675 | .suspend = viu_suspend, | 1673 | .suspend = viu_suspend, |
| 1676 | .resume = viu_resume, | 1674 | .resume = viu_resume, |
diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 45164c4f8452..05c560f2ef06 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c | |||
| @@ -218,15 +218,14 @@ static void dma_callback(void *data) | |||
| 218 | static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, | 218 | static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, |
| 219 | int do_callback) | 219 | int do_callback) |
| 220 | { | 220 | { |
| 221 | struct deinterlace_q_data *s_q_data, *d_q_data; | 221 | struct deinterlace_q_data *s_q_data; |
| 222 | struct vb2_buffer *src_buf, *dst_buf; | 222 | struct vb2_buffer *src_buf, *dst_buf; |
| 223 | struct deinterlace_dev *pcdev = ctx->dev; | 223 | struct deinterlace_dev *pcdev = ctx->dev; |
| 224 | struct dma_chan *chan = pcdev->dma_chan; | 224 | struct dma_chan *chan = pcdev->dma_chan; |
| 225 | struct dma_device *dmadev = chan->device; | 225 | struct dma_device *dmadev = chan->device; |
| 226 | struct dma_async_tx_descriptor *tx; | 226 | struct dma_async_tx_descriptor *tx; |
| 227 | unsigned int s_width, s_height; | 227 | unsigned int s_width, s_height; |
| 228 | unsigned int d_width, d_height; | 228 | unsigned int s_size; |
| 229 | unsigned int d_size, s_size; | ||
| 230 | dma_addr_t p_in, p_out; | 229 | dma_addr_t p_in, p_out; |
| 231 | enum dma_ctrl_flags flags; | 230 | enum dma_ctrl_flags flags; |
| 232 | 231 | ||
| @@ -238,11 +237,6 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, | |||
| 238 | s_height = s_q_data->height; | 237 | s_height = s_q_data->height; |
| 239 | s_size = s_width * s_height; | 238 | s_size = s_width * s_height; |
| 240 | 239 | ||
| 241 | d_q_data = get_q_data(V4L2_BUF_TYPE_VIDEO_CAPTURE); | ||
| 242 | d_width = d_q_data->width; | ||
| 243 | d_height = d_q_data->height; | ||
| 244 | d_size = d_width * d_height; | ||
| 245 | |||
| 246 | p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(src_buf, 0); | 240 | p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(src_buf, 0); |
| 247 | p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(dst_buf, 0); | 241 | p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(dst_buf, 0); |
| 248 | if (!p_in || !p_out) { | 242 | if (!p_in || !p_out) { |
| @@ -1108,17 +1102,5 @@ static struct platform_driver deinterlace_pdrv = { | |||
| 1108 | .owner = THIS_MODULE, | 1102 | .owner = THIS_MODULE, |
| 1109 | }, | 1103 | }, |
| 1110 | }; | 1104 | }; |
| 1111 | 1105 | module_platform_driver(deinterlace_pdrv); | |
| 1112 | static void __exit deinterlace_exit(void) | ||
| 1113 | { | ||
| 1114 | platform_driver_unregister(&deinterlace_pdrv); | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | static int __init deinterlace_init(void) | ||
| 1118 | { | ||
| 1119 | return platform_driver_register(&deinterlace_pdrv); | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | module_init(deinterlace_init); | ||
| 1123 | module_exit(deinterlace_exit); | ||
| 1124 | 1106 | ||
diff --git a/drivers/media/platform/mem2mem_testdev.c b/drivers/media/platform/mem2mem_testdev.c index 2e2121e98133..7487d7208dea 100644 --- a/drivers/media/platform/mem2mem_testdev.c +++ b/drivers/media/platform/mem2mem_testdev.c | |||
| @@ -839,7 +839,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds | |||
| 839 | int ret; | 839 | int ret; |
| 840 | 840 | ||
| 841 | src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; | 841 | src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
| 842 | src_vq->io_modes = VB2_MMAP; | 842 | src_vq->io_modes = VB2_MMAP | VB2_DMABUF; |
| 843 | src_vq->drv_priv = ctx; | 843 | src_vq->drv_priv = ctx; |
| 844 | src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); | 844 | src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); |
| 845 | src_vq->ops = &m2mtest_qops; | 845 | src_vq->ops = &m2mtest_qops; |
| @@ -850,7 +850,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds | |||
| 850 | return ret; | 850 | return ret; |
| 851 | 851 | ||
| 852 | dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 852 | dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
| 853 | dst_vq->io_modes = VB2_MMAP; | 853 | dst_vq->io_modes = VB2_MMAP | VB2_DMABUF; |
| 854 | dst_vq->drv_priv = ctx; | 854 | dst_vq->drv_priv = ctx; |
| 855 | dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); | 855 | dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); |
| 856 | dst_vq->ops = &m2mtest_qops; | 856 | dst_vq->ops = &m2mtest_qops; |
diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c index 8f22ce543cf7..6b155d7be8e0 100644 --- a/drivers/media/platform/mx2_emmaprp.c +++ b/drivers/media/platform/mx2_emmaprp.c | |||
| @@ -371,7 +371,7 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data) | |||
| 371 | if (!curr_ctx->aborting) { | 371 | if (!curr_ctx->aborting) { |
| 372 | if ((irqst & PRP_INTR_ST_RDERR) || | 372 | if ((irqst & PRP_INTR_ST_RDERR) || |
| 373 | (irqst & PRP_INTR_ST_CH2WERR)) { | 373 | (irqst & PRP_INTR_ST_CH2WERR)) { |
| 374 | pr_err("PrP bus error ocurred, this transfer is probably corrupted\n"); | 374 | pr_err("PrP bus error occurred, this transfer is probably corrupted\n"); |
| 375 | writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL); | 375 | writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL); |
| 376 | } else if (irqst & PRP_INTR_ST_CH2B1CI) { /* buffer ready */ | 376 | } else if (irqst & PRP_INTR_ST_CH2B1CI) { /* buffer ready */ |
| 377 | src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx); | 377 | src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx); |
| @@ -1013,16 +1013,4 @@ static struct platform_driver emmaprp_pdrv = { | |||
| 1013 | .owner = THIS_MODULE, | 1013 | .owner = THIS_MODULE, |
| 1014 | }, | 1014 | }, |
| 1015 | }; | 1015 | }; |
| 1016 | 1016 | module_platform_driver(emmaprp_pdrv); | |
| 1017 | static void __exit emmaprp_exit(void) | ||
| 1018 | { | ||
| 1019 | platform_driver_unregister(&emmaprp_pdrv); | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | static int __init emmaprp_init(void) | ||
| 1023 | { | ||
| 1024 | return platform_driver_register(&emmaprp_pdrv); | ||
| 1025 | } | ||
| 1026 | |||
| 1027 | module_init(emmaprp_init); | ||
| 1028 | module_exit(emmaprp_exit); | ||
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index a3b1a34c896d..35cc526e6c93 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
| @@ -44,9 +44,7 @@ | |||
| 44 | #include <media/v4l2-device.h> | 44 | #include <media/v4l2-device.h> |
| 45 | #include <media/v4l2-ioctl.h> | 45 | #include <media/v4l2-ioctl.h> |
| 46 | 46 | ||
| 47 | #include <plat/cpu.h> | 47 | #include <video/omapvrfb.h> |
| 48 | #include <plat/dma.h> | ||
| 49 | #include <plat/vrfb.h> | ||
| 50 | #include <video/omapdss.h> | 48 | #include <video/omapdss.h> |
| 51 | 49 | ||
| 52 | #include "omap_voutlib.h" | 50 | #include "omap_voutlib.h" |
| @@ -1174,13 +1172,6 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *fh, | |||
| 1174 | /* set default crop and win */ | 1172 | /* set default crop and win */ |
| 1175 | omap_vout_new_format(&vout->pix, &vout->fbuf, &vout->crop, &vout->win); | 1173 | omap_vout_new_format(&vout->pix, &vout->fbuf, &vout->crop, &vout->win); |
| 1176 | 1174 | ||
| 1177 | /* Save the changes in the overlay strcuture */ | ||
| 1178 | ret = omapvid_init(vout, 0); | ||
| 1179 | if (ret) { | ||
| 1180 | v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n"); | ||
| 1181 | goto s_fmt_vid_out_exit; | ||
| 1182 | } | ||
| 1183 | |||
| 1184 | ret = 0; | 1175 | ret = 0; |
| 1185 | 1176 | ||
| 1186 | s_fmt_vid_out_exit: | 1177 | s_fmt_vid_out_exit: |
| @@ -1684,20 +1675,6 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) | |||
| 1684 | 1675 | ||
| 1685 | omap_dispc_register_isr(omap_vout_isr, vout, mask); | 1676 | omap_dispc_register_isr(omap_vout_isr, vout, mask); |
| 1686 | 1677 | ||
| 1687 | for (j = 0; j < ovid->num_overlays; j++) { | ||
| 1688 | struct omap_overlay *ovl = ovid->overlays[j]; | ||
| 1689 | |||
| 1690 | if (ovl->get_device(ovl)) { | ||
| 1691 | struct omap_overlay_info info; | ||
| 1692 | ovl->get_overlay_info(ovl, &info); | ||
| 1693 | info.paddr = addr; | ||
| 1694 | if (ovl->set_overlay_info(ovl, &info)) { | ||
| 1695 | ret = -EINVAL; | ||
| 1696 | goto streamon_err1; | ||
| 1697 | } | ||
| 1698 | } | ||
| 1699 | } | ||
| 1700 | |||
| 1701 | /* First save the configuration in ovelray structure */ | 1678 | /* First save the configuration in ovelray structure */ |
| 1702 | ret = omapvid_init(vout, addr); | 1679 | ret = omapvid_init(vout, addr); |
| 1703 | if (ret) | 1680 | if (ret) |
| @@ -2064,7 +2041,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev) | |||
| 2064 | vout->vid_info.id = k + 1; | 2041 | vout->vid_info.id = k + 1; |
| 2065 | 2042 | ||
| 2066 | /* Set VRFB as rotation_type for omap2 and omap3 */ | 2043 | /* Set VRFB as rotation_type for omap2 and omap3 */ |
| 2067 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) | 2044 | if (omap_vout_dss_omap24xx() || omap_vout_dss_omap34xx()) |
| 2068 | vout->vid_info.rotation_type = VOUT_ROT_VRFB; | 2045 | vout->vid_info.rotation_type = VOUT_ROT_VRFB; |
| 2069 | 2046 | ||
| 2070 | /* Setup the default configuration for the video devices | 2047 | /* Setup the default configuration for the video devices |
| @@ -2094,11 +2071,12 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev) | |||
| 2094 | } | 2071 | } |
| 2095 | video_set_drvdata(vfd, vout); | 2072 | video_set_drvdata(vfd, vout); |
| 2096 | 2073 | ||
| 2097 | /* Configure the overlay structure */ | 2074 | dev_info(&pdev->dev, ": registered and initialized" |
| 2098 | ret = omapvid_init(vid_dev->vouts[k], 0); | 2075 | " video device %d\n", vfd->minor); |
| 2099 | if (!ret) | 2076 | if (k == (pdev->num_resources - 1)) |
| 2100 | goto success; | 2077 | return 0; |
| 2101 | 2078 | ||
| 2079 | continue; | ||
| 2102 | error2: | 2080 | error2: |
| 2103 | if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) | 2081 | if (vout->vid_info.rotation_type == VOUT_ROT_VRFB) |
| 2104 | omap_vout_release_vrfb(vout); | 2082 | omap_vout_release_vrfb(vout); |
| @@ -2108,12 +2086,6 @@ error1: | |||
| 2108 | error: | 2086 | error: |
| 2109 | kfree(vout); | 2087 | kfree(vout); |
| 2110 | return ret; | 2088 | return ret; |
| 2111 | |||
| 2112 | success: | ||
| 2113 | dev_info(&pdev->dev, ": registered and initialized" | ||
| 2114 | " video device %d\n", vfd->minor); | ||
| 2115 | if (k == (pdev->num_resources - 1)) | ||
| 2116 | return 0; | ||
| 2117 | } | 2089 | } |
| 2118 | 2090 | ||
| 2119 | return -ENODEV; | 2091 | return -ENODEV; |
| @@ -2186,14 +2158,23 @@ static int __init omap_vout_probe(struct platform_device *pdev) | |||
| 2186 | struct omap_dss_device *def_display; | 2158 | struct omap_dss_device *def_display; |
| 2187 | struct omap2video_device *vid_dev = NULL; | 2159 | struct omap2video_device *vid_dev = NULL; |
| 2188 | 2160 | ||
| 2161 | ret = omapdss_compat_init(); | ||
| 2162 | if (ret) { | ||
| 2163 | dev_err(&pdev->dev, "failed to init dss\n"); | ||
| 2164 | return ret; | ||
| 2165 | } | ||
| 2166 | |||
| 2189 | if (pdev->num_resources == 0) { | 2167 | if (pdev->num_resources == 0) { |
| 2190 | dev_err(&pdev->dev, "probed for an unknown device\n"); | 2168 | dev_err(&pdev->dev, "probed for an unknown device\n"); |
| 2191 | return -ENODEV; | 2169 | ret = -ENODEV; |
| 2170 | goto err_dss_init; | ||
| 2192 | } | 2171 | } |
| 2193 | 2172 | ||
| 2194 | vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL); | 2173 | vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL); |
| 2195 | if (vid_dev == NULL) | 2174 | if (vid_dev == NULL) { |
| 2196 | return -ENOMEM; | 2175 | ret = -ENOMEM; |
| 2176 | goto err_dss_init; | ||
| 2177 | } | ||
| 2197 | 2178 | ||
| 2198 | vid_dev->num_displays = 0; | 2179 | vid_dev->num_displays = 0; |
| 2199 | for_each_dss_dev(dssdev) { | 2180 | for_each_dss_dev(dssdev) { |
| @@ -2288,6 +2269,8 @@ probe_err1: | |||
| 2288 | } | 2269 | } |
| 2289 | probe_err0: | 2270 | probe_err0: |
| 2290 | kfree(vid_dev); | 2271 | kfree(vid_dev); |
| 2272 | err_dss_init: | ||
| 2273 | omapdss_compat_uninit(); | ||
| 2291 | return ret; | 2274 | return ret; |
| 2292 | } | 2275 | } |
| 2293 | 2276 | ||
diff --git a/drivers/media/platform/omap/omap_vout_vrfb.c b/drivers/media/platform/omap/omap_vout_vrfb.c index 4be26abf6cea..cf1c437a8687 100644 --- a/drivers/media/platform/omap/omap_vout_vrfb.c +++ b/drivers/media/platform/omap/omap_vout_vrfb.c | |||
| @@ -16,12 +16,14 @@ | |||
| 16 | #include <media/videobuf-dma-contig.h> | 16 | #include <media/videobuf-dma-contig.h> |
| 17 | #include <media/v4l2-device.h> | 17 | #include <media/v4l2-device.h> |
| 18 | 18 | ||
| 19 | #include <plat/dma.h> | 19 | #include <linux/omap-dma.h> |
| 20 | #include <plat/vrfb.h> | 20 | #include <video/omapvrfb.h> |
| 21 | 21 | ||
| 22 | #include "omap_voutdef.h" | 22 | #include "omap_voutdef.h" |
| 23 | #include "omap_voutlib.h" | 23 | #include "omap_voutlib.h" |
| 24 | 24 | ||
| 25 | #define OMAP_DMA_NO_DEVICE 0 | ||
| 26 | |||
| 25 | /* | 27 | /* |
| 26 | * Function for allocating video buffers | 28 | * Function for allocating video buffers |
| 27 | */ | 29 | */ |
diff --git a/drivers/media/platform/omap/omap_voutdef.h b/drivers/media/platform/omap/omap_voutdef.h index 27a95d23b913..9ccfe1f475a4 100644 --- a/drivers/media/platform/omap/omap_voutdef.h +++ b/drivers/media/platform/omap/omap_voutdef.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #define OMAP_VOUTDEF_H | 12 | #define OMAP_VOUTDEF_H |
| 13 | 13 | ||
| 14 | #include <video/omapdss.h> | 14 | #include <video/omapdss.h> |
| 15 | #include <plat/vrfb.h> | 15 | #include <video/omapvrfb.h> |
| 16 | 16 | ||
| 17 | #define YUYV_BPP 2 | 17 | #define YUYV_BPP 2 |
| 18 | #define RGB565_BPP 2 | 18 | #define RGB565_BPP 2 |
diff --git a/drivers/media/platform/omap/omap_voutlib.c b/drivers/media/platform/omap/omap_voutlib.c index 115408b9274f..80b0d88f125c 100644 --- a/drivers/media/platform/omap/omap_voutlib.c +++ b/drivers/media/platform/omap/omap_voutlib.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
| 28 | 28 | ||
| 29 | #include <plat/cpu.h> | 29 | #include <video/omapdss.h> |
| 30 | 30 | ||
| 31 | #include "omap_voutlib.h" | 31 | #include "omap_voutlib.h" |
| 32 | 32 | ||
| @@ -124,7 +124,7 @@ int omap_vout_new_window(struct v4l2_rect *crop, | |||
| 124 | win->chromakey = new_win->chromakey; | 124 | win->chromakey = new_win->chromakey; |
| 125 | 125 | ||
| 126 | /* Adjust the cropping window to allow for resizing limitation */ | 126 | /* Adjust the cropping window to allow for resizing limitation */ |
| 127 | if (cpu_is_omap24xx()) { | 127 | if (omap_vout_dss_omap24xx()) { |
| 128 | /* For 24xx limit is 8x to 1/2x scaling. */ | 128 | /* For 24xx limit is 8x to 1/2x scaling. */ |
| 129 | if ((crop->height/win->w.height) >= 2) | 129 | if ((crop->height/win->w.height) >= 2) |
| 130 | crop->height = win->w.height * 2; | 130 | crop->height = win->w.height * 2; |
| @@ -140,7 +140,7 @@ int omap_vout_new_window(struct v4l2_rect *crop, | |||
| 140 | if (crop->height != win->w.height) | 140 | if (crop->height != win->w.height) |
| 141 | crop->width = 768; | 141 | crop->width = 768; |
| 142 | } | 142 | } |
| 143 | } else if (cpu_is_omap34xx()) { | 143 | } else if (omap_vout_dss_omap34xx()) { |
| 144 | /* For 34xx limit is 8x to 1/4x scaling. */ | 144 | /* For 34xx limit is 8x to 1/4x scaling. */ |
| 145 | if ((crop->height/win->w.height) >= 4) | 145 | if ((crop->height/win->w.height) >= 4) |
| 146 | crop->height = win->w.height * 4; | 146 | crop->height = win->w.height * 4; |
| @@ -196,7 +196,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix, | |||
| 196 | if (try_crop.width <= 0 || try_crop.height <= 0) | 196 | if (try_crop.width <= 0 || try_crop.height <= 0) |
| 197 | return -EINVAL; | 197 | return -EINVAL; |
| 198 | 198 | ||
| 199 | if (cpu_is_omap24xx()) { | 199 | if (omap_vout_dss_omap24xx()) { |
| 200 | if (try_crop.height != win->w.height) { | 200 | if (try_crop.height != win->w.height) { |
| 201 | /* If we're resizing vertically, we can't support a | 201 | /* If we're resizing vertically, we can't support a |
| 202 | * crop width wider than 768 pixels. | 202 | * crop width wider than 768 pixels. |
| @@ -207,9 +207,9 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix, | |||
| 207 | } | 207 | } |
| 208 | /* vertical resizing */ | 208 | /* vertical resizing */ |
| 209 | vresize = (1024 * try_crop.height) / win->w.height; | 209 | vresize = (1024 * try_crop.height) / win->w.height; |
| 210 | if (cpu_is_omap24xx() && (vresize > 2048)) | 210 | if (omap_vout_dss_omap24xx() && (vresize > 2048)) |
| 211 | vresize = 2048; | 211 | vresize = 2048; |
| 212 | else if (cpu_is_omap34xx() && (vresize > 4096)) | 212 | else if (omap_vout_dss_omap34xx() && (vresize > 4096)) |
| 213 | vresize = 4096; | 213 | vresize = 4096; |
| 214 | 214 | ||
| 215 | win->w.height = ((1024 * try_crop.height) / vresize) & ~1; | 215 | win->w.height = ((1024 * try_crop.height) / vresize) & ~1; |
| @@ -226,9 +226,9 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix, | |||
| 226 | } | 226 | } |
| 227 | /* horizontal resizing */ | 227 | /* horizontal resizing */ |
| 228 | hresize = (1024 * try_crop.width) / win->w.width; | 228 | hresize = (1024 * try_crop.width) / win->w.width; |
| 229 | if (cpu_is_omap24xx() && (hresize > 2048)) | 229 | if (omap_vout_dss_omap24xx() && (hresize > 2048)) |
| 230 | hresize = 2048; | 230 | hresize = 2048; |
| 231 | else if (cpu_is_omap34xx() && (hresize > 4096)) | 231 | else if (omap_vout_dss_omap34xx() && (hresize > 4096)) |
| 232 | hresize = 4096; | 232 | hresize = 4096; |
| 233 | 233 | ||
| 234 | win->w.width = ((1024 * try_crop.width) / hresize) & ~1; | 234 | win->w.width = ((1024 * try_crop.width) / hresize) & ~1; |
| @@ -243,7 +243,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix, | |||
| 243 | if (try_crop.width == 0) | 243 | if (try_crop.width == 0) |
| 244 | try_crop.width = 2; | 244 | try_crop.width = 2; |
| 245 | } | 245 | } |
| 246 | if (cpu_is_omap24xx()) { | 246 | if (omap_vout_dss_omap24xx()) { |
| 247 | if ((try_crop.height/win->w.height) >= 2) | 247 | if ((try_crop.height/win->w.height) >= 2) |
| 248 | try_crop.height = win->w.height * 2; | 248 | try_crop.height = win->w.height * 2; |
| 249 | 249 | ||
| @@ -258,7 +258,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix, | |||
| 258 | if (try_crop.height != win->w.height) | 258 | if (try_crop.height != win->w.height) |
| 259 | try_crop.width = 768; | 259 | try_crop.width = 768; |
| 260 | } | 260 | } |
| 261 | } else if (cpu_is_omap34xx()) { | 261 | } else if (omap_vout_dss_omap34xx()) { |
| 262 | if ((try_crop.height/win->w.height) >= 4) | 262 | if ((try_crop.height/win->w.height) >= 4) |
| 263 | try_crop.height = win->w.height * 4; | 263 | try_crop.height = win->w.height * 4; |
| 264 | 264 | ||
| @@ -337,3 +337,21 @@ void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size) | |||
| 337 | } | 337 | } |
| 338 | free_pages((unsigned long) virtaddr, order); | 338 | free_pages((unsigned long) virtaddr, order); |
| 339 | } | 339 | } |
| 340 | |||
| 341 | bool omap_vout_dss_omap24xx(void) | ||
| 342 | { | ||
| 343 | return omapdss_get_version() == OMAPDSS_VER_OMAP24xx; | ||
| 344 | } | ||
| 345 | |||
| 346 | bool omap_vout_dss_omap34xx(void) | ||
| 347 | { | ||
| 348 | switch (omapdss_get_version()) { | ||
| 349 | case OMAPDSS_VER_OMAP34xx_ES1: | ||
| 350 | case OMAPDSS_VER_OMAP34xx_ES3: | ||
| 351 | case OMAPDSS_VER_OMAP3630: | ||
| 352 | case OMAPDSS_VER_AM35xx: | ||
| 353 | return true; | ||
| 354 | default: | ||
| 355 | return false; | ||
| 356 | } | ||
| 357 | } | ||
diff --git a/drivers/media/platform/omap/omap_voutlib.h b/drivers/media/platform/omap/omap_voutlib.h index e51750a597e3..f9d1c0779f33 100644 --- a/drivers/media/platform/omap/omap_voutlib.h +++ b/drivers/media/platform/omap/omap_voutlib.h | |||
| @@ -32,5 +32,8 @@ void omap_vout_new_format(struct v4l2_pix_format *pix, | |||
| 32 | struct v4l2_window *win); | 32 | struct v4l2_window *win); |
| 33 | unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr); | 33 | unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr); |
| 34 | void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size); | 34 | void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size); |
| 35 | |||
| 36 | bool omap_vout_dss_omap24xx(void); | ||
| 37 | bool omap_vout_dss_omap34xx(void); | ||
| 35 | #endif /* #ifndef OMAP_VOUTLIB_H */ | 38 | #endif /* #ifndef OMAP_VOUTLIB_H */ |
| 36 | 39 | ||
diff --git a/drivers/media/platform/omap24xxcam.c b/drivers/media/platform/omap24xxcam.c index 70f45c381318..8b7ccea982e7 100644 --- a/drivers/media/platform/omap24xxcam.c +++ b/drivers/media/platform/omap24xxcam.c | |||
| @@ -1736,7 +1736,7 @@ static struct v4l2_int_device omap24xxcam = { | |||
| 1736 | * | 1736 | * |
| 1737 | */ | 1737 | */ |
| 1738 | 1738 | ||
| 1739 | static int __devinit omap24xxcam_probe(struct platform_device *pdev) | 1739 | static int omap24xxcam_probe(struct platform_device *pdev) |
| 1740 | { | 1740 | { |
| 1741 | struct omap24xxcam_device *cam; | 1741 | struct omap24xxcam_device *cam; |
| 1742 | struct resource *mem; | 1742 | struct resource *mem; |
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 99640d8c1db0..e4aaee91201d 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c | |||
| @@ -61,6 +61,7 @@ | |||
| 61 | #include <linux/i2c.h> | 61 | #include <linux/i2c.h> |
| 62 | #include <linux/interrupt.h> | 62 | #include <linux/interrupt.h> |
| 63 | #include <linux/module.h> | 63 | #include <linux/module.h> |
| 64 | #include <linux/omap-iommu.h> | ||
| 64 | #include <linux/platform_device.h> | 65 | #include <linux/platform_device.h> |
| 65 | #include <linux/regulator/consumer.h> | 66 | #include <linux/regulator/consumer.h> |
| 66 | #include <linux/slab.h> | 67 | #include <linux/slab.h> |
| @@ -70,8 +71,6 @@ | |||
| 70 | #include <media/v4l2-common.h> | 71 | #include <media/v4l2-common.h> |
| 71 | #include <media/v4l2-device.h> | 72 | #include <media/v4l2-device.h> |
| 72 | 73 | ||
| 73 | #include <plat/cpu.h> | ||
| 74 | |||
| 75 | #include "isp.h" | 74 | #include "isp.h" |
| 76 | #include "ispreg.h" | 75 | #include "ispreg.h" |
| 77 | #include "ispccdc.h" | 76 | #include "ispccdc.h" |
| @@ -102,7 +101,8 @@ static const struct isp_res_mapping isp_res_maps[] = { | |||
| 102 | 1 << OMAP3_ISP_IOMEM_RESZ | | 101 | 1 << OMAP3_ISP_IOMEM_RESZ | |
| 103 | 1 << OMAP3_ISP_IOMEM_SBL | | 102 | 1 << OMAP3_ISP_IOMEM_SBL | |
| 104 | 1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 | | 103 | 1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 | |
| 105 | 1 << OMAP3_ISP_IOMEM_CSIPHY2, | 104 | 1 << OMAP3_ISP_IOMEM_CSIPHY2 | |
| 105 | 1 << OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, | ||
| 106 | }, | 106 | }, |
| 107 | { | 107 | { |
| 108 | .isp_rev = ISP_REVISION_15_0, | 108 | .isp_rev = ISP_REVISION_15_0, |
| @@ -119,7 +119,8 @@ static const struct isp_res_mapping isp_res_maps[] = { | |||
| 119 | 1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 | | 119 | 1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 | |
| 120 | 1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 | | 120 | 1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 | |
| 121 | 1 << OMAP3_ISP_IOMEM_CSIPHY1 | | 121 | 1 << OMAP3_ISP_IOMEM_CSIPHY1 | |
| 122 | 1 << OMAP3_ISP_IOMEM_CSI2C_REGS2, | 122 | 1 << OMAP3_ISP_IOMEM_CSI2C_REGS2 | |
| 123 | 1 << OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, | ||
| 123 | }, | 124 | }, |
| 124 | }; | 125 | }; |
| 125 | 126 | ||
| @@ -1330,7 +1331,8 @@ void omap3isp_subclk_disable(struct isp_device *isp, | |||
| 1330 | * isp_enable_clocks - Enable ISP clocks | 1331 | * isp_enable_clocks - Enable ISP clocks |
| 1331 | * @isp: OMAP3 ISP device | 1332 | * @isp: OMAP3 ISP device |
| 1332 | * | 1333 | * |
| 1333 | * Return 0 if successful, or clk_enable return value if any of tthem fails. | 1334 | * Return 0 if successful, or clk_prepare_enable return value if any of them |
| 1335 | * fails. | ||
| 1334 | */ | 1336 | */ |
| 1335 | static int isp_enable_clocks(struct isp_device *isp) | 1337 | static int isp_enable_clocks(struct isp_device *isp) |
| 1336 | { | 1338 | { |
| @@ -1347,14 +1349,11 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
| 1347 | * has to be twice of what is set on OMAP3430 to get | 1349 | * has to be twice of what is set on OMAP3430 to get |
| 1348 | * the required value for cam_mclk | 1350 | * the required value for cam_mclk |
| 1349 | */ | 1351 | */ |
| 1350 | if (cpu_is_omap3630()) | 1352 | divisor = isp->revision == ISP_REVISION_15_0 ? 1 : 2; |
| 1351 | divisor = 1; | ||
| 1352 | else | ||
| 1353 | divisor = 2; | ||
| 1354 | 1353 | ||
| 1355 | r = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); | 1354 | r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_ICK]); |
| 1356 | if (r) { | 1355 | if (r) { |
| 1357 | dev_err(isp->dev, "clk_enable cam_ick failed\n"); | 1356 | dev_err(isp->dev, "failed to enable cam_ick clock\n"); |
| 1358 | goto out_clk_enable_ick; | 1357 | goto out_clk_enable_ick; |
| 1359 | } | 1358 | } |
| 1360 | r = clk_set_rate(isp->clock[ISP_CLK_DPLL4_M5_CK], | 1359 | r = clk_set_rate(isp->clock[ISP_CLK_DPLL4_M5_CK], |
| @@ -1363,9 +1362,9 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
| 1363 | dev_err(isp->dev, "clk_set_rate for dpll4_m5_ck failed\n"); | 1362 | dev_err(isp->dev, "clk_set_rate for dpll4_m5_ck failed\n"); |
| 1364 | goto out_clk_enable_mclk; | 1363 | goto out_clk_enable_mclk; |
| 1365 | } | 1364 | } |
| 1366 | r = clk_enable(isp->clock[ISP_CLK_CAM_MCLK]); | 1365 | r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_MCLK]); |
| 1367 | if (r) { | 1366 | if (r) { |
| 1368 | dev_err(isp->dev, "clk_enable cam_mclk failed\n"); | 1367 | dev_err(isp->dev, "failed to enable cam_mclk clock\n"); |
| 1369 | goto out_clk_enable_mclk; | 1368 | goto out_clk_enable_mclk; |
| 1370 | } | 1369 | } |
| 1371 | rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); | 1370 | rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); |
| @@ -1373,17 +1372,17 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
| 1373 | dev_warn(isp->dev, "unexpected cam_mclk rate:\n" | 1372 | dev_warn(isp->dev, "unexpected cam_mclk rate:\n" |
| 1374 | " expected : %d\n" | 1373 | " expected : %d\n" |
| 1375 | " actual : %ld\n", CM_CAM_MCLK_HZ, rate); | 1374 | " actual : %ld\n", CM_CAM_MCLK_HZ, rate); |
| 1376 | r = clk_enable(isp->clock[ISP_CLK_CSI2_FCK]); | 1375 | r = clk_prepare_enable(isp->clock[ISP_CLK_CSI2_FCK]); |
| 1377 | if (r) { | 1376 | if (r) { |
| 1378 | dev_err(isp->dev, "clk_enable csi2_fck failed\n"); | 1377 | dev_err(isp->dev, "failed to enable csi2_fck clock\n"); |
| 1379 | goto out_clk_enable_csi2_fclk; | 1378 | goto out_clk_enable_csi2_fclk; |
| 1380 | } | 1379 | } |
| 1381 | return 0; | 1380 | return 0; |
| 1382 | 1381 | ||
| 1383 | out_clk_enable_csi2_fclk: | 1382 | out_clk_enable_csi2_fclk: |
| 1384 | clk_disable(isp->clock[ISP_CLK_CAM_MCLK]); | 1383 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); |
| 1385 | out_clk_enable_mclk: | 1384 | out_clk_enable_mclk: |
| 1386 | clk_disable(isp->clock[ISP_CLK_CAM_ICK]); | 1385 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); |
| 1387 | out_clk_enable_ick: | 1386 | out_clk_enable_ick: |
| 1388 | return r; | 1387 | return r; |
| 1389 | } | 1388 | } |
| @@ -1394,9 +1393,9 @@ out_clk_enable_ick: | |||
| 1394 | */ | 1393 | */ |
| 1395 | static void isp_disable_clocks(struct isp_device *isp) | 1394 | static void isp_disable_clocks(struct isp_device *isp) |
| 1396 | { | 1395 | { |
| 1397 | clk_disable(isp->clock[ISP_CLK_CAM_ICK]); | 1396 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); |
| 1398 | clk_disable(isp->clock[ISP_CLK_CAM_MCLK]); | 1397 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); |
| 1399 | clk_disable(isp->clock[ISP_CLK_CSI2_FCK]); | 1398 | clk_disable_unprepare(isp->clock[ISP_CLK_CSI2_FCK]); |
| 1400 | } | 1399 | } |
| 1401 | 1400 | ||
| 1402 | static const char *isp_clocks[] = { | 1401 | static const char *isp_clocks[] = { |
| @@ -1677,7 +1676,7 @@ isp_register_subdev_group(struct isp_device *isp, | |||
| 1677 | 1676 | ||
| 1678 | adapter = i2c_get_adapter(board_info->i2c_adapter_id); | 1677 | adapter = i2c_get_adapter(board_info->i2c_adapter_id); |
| 1679 | if (adapter == NULL) { | 1678 | if (adapter == NULL) { |
| 1680 | printk(KERN_ERR "%s: Unable to get I2C adapter %d for " | 1679 | dev_err(isp->dev, "%s: Unable to get I2C adapter %d for " |
| 1681 | "device %s\n", __func__, | 1680 | "device %s\n", __func__, |
| 1682 | board_info->i2c_adapter_id, | 1681 | board_info->i2c_adapter_id, |
| 1683 | board_info->board_info->type); | 1682 | board_info->board_info->type); |
| @@ -1687,7 +1686,7 @@ isp_register_subdev_group(struct isp_device *isp, | |||
| 1687 | subdev = v4l2_i2c_new_subdev_board(&isp->v4l2_dev, adapter, | 1686 | subdev = v4l2_i2c_new_subdev_board(&isp->v4l2_dev, adapter, |
| 1688 | board_info->board_info, NULL); | 1687 | board_info->board_info, NULL); |
| 1689 | if (subdev == NULL) { | 1688 | if (subdev == NULL) { |
| 1690 | printk(KERN_ERR "%s: Unable to register subdev %s\n", | 1689 | dev_err(isp->dev, "%s: Unable to register subdev %s\n", |
| 1691 | __func__, board_info->board_info->type); | 1690 | __func__, board_info->board_info->type); |
| 1692 | continue; | 1691 | continue; |
| 1693 | } | 1692 | } |
| @@ -1712,7 +1711,7 @@ static int isp_register_entities(struct isp_device *isp) | |||
| 1712 | isp->media_dev.link_notify = isp_pipeline_link_notify; | 1711 | isp->media_dev.link_notify = isp_pipeline_link_notify; |
| 1713 | ret = media_device_register(&isp->media_dev); | 1712 | ret = media_device_register(&isp->media_dev); |
| 1714 | if (ret < 0) { | 1713 | if (ret < 0) { |
| 1715 | printk(KERN_ERR "%s: Media device registration failed (%d)\n", | 1714 | dev_err(isp->dev, "%s: Media device registration failed (%d)\n", |
| 1716 | __func__, ret); | 1715 | __func__, ret); |
| 1717 | return ret; | 1716 | return ret; |
| 1718 | } | 1717 | } |
| @@ -1720,7 +1719,7 @@ static int isp_register_entities(struct isp_device *isp) | |||
| 1720 | isp->v4l2_dev.mdev = &isp->media_dev; | 1719 | isp->v4l2_dev.mdev = &isp->media_dev; |
| 1721 | ret = v4l2_device_register(isp->dev, &isp->v4l2_dev); | 1720 | ret = v4l2_device_register(isp->dev, &isp->v4l2_dev); |
| 1722 | if (ret < 0) { | 1721 | if (ret < 0) { |
| 1723 | printk(KERN_ERR "%s: V4L2 device registration failed (%d)\n", | 1722 | dev_err(isp->dev, "%s: V4L2 device registration failed (%d)\n", |
| 1724 | __func__, ret); | 1723 | __func__, ret); |
| 1725 | goto done; | 1724 | goto done; |
| 1726 | } | 1725 | } |
| @@ -1765,6 +1764,7 @@ static int isp_register_entities(struct isp_device *isp) | |||
| 1765 | struct media_entity *input; | 1764 | struct media_entity *input; |
| 1766 | unsigned int flags; | 1765 | unsigned int flags; |
| 1767 | unsigned int pad; | 1766 | unsigned int pad; |
| 1767 | unsigned int i; | ||
| 1768 | 1768 | ||
| 1769 | sensor = isp_register_subdev_group(isp, subdevs->subdevs); | 1769 | sensor = isp_register_subdev_group(isp, subdevs->subdevs); |
| 1770 | if (sensor == NULL) | 1770 | if (sensor == NULL) |
| @@ -1806,13 +1806,25 @@ static int isp_register_entities(struct isp_device *isp) | |||
| 1806 | break; | 1806 | break; |
| 1807 | 1807 | ||
| 1808 | default: | 1808 | default: |
| 1809 | printk(KERN_ERR "%s: invalid interface type %u\n", | 1809 | dev_err(isp->dev, "%s: invalid interface type %u\n", |
| 1810 | __func__, subdevs->interface); | 1810 | __func__, subdevs->interface); |
| 1811 | ret = -EINVAL; | 1811 | ret = -EINVAL; |
| 1812 | goto done; | 1812 | goto done; |
| 1813 | } | 1813 | } |
| 1814 | 1814 | ||
| 1815 | ret = media_entity_create_link(&sensor->entity, 0, input, pad, | 1815 | for (i = 0; i < sensor->entity.num_pads; i++) { |
| 1816 | if (sensor->entity.pads[i].flags & MEDIA_PAD_FL_SOURCE) | ||
| 1817 | break; | ||
| 1818 | } | ||
| 1819 | if (i == sensor->entity.num_pads) { | ||
| 1820 | dev_err(isp->dev, | ||
| 1821 | "%s: no source pad in external entity\n", | ||
| 1822 | __func__); | ||
| 1823 | ret = -EINVAL; | ||
| 1824 | goto done; | ||
| 1825 | } | ||
| 1826 | |||
| 1827 | ret = media_entity_create_link(&sensor->entity, i, input, pad, | ||
| 1816 | flags); | 1828 | flags); |
| 1817 | if (ret < 0) | 1829 | if (ret < 0) |
| 1818 | goto done; | 1830 | goto done; |
| @@ -1978,7 +1990,7 @@ error_csiphy: | |||
| 1978 | * | 1990 | * |
| 1979 | * Always returns 0. | 1991 | * Always returns 0. |
| 1980 | */ | 1992 | */ |
| 1981 | static int __devexit isp_remove(struct platform_device *pdev) | 1993 | static int isp_remove(struct platform_device *pdev) |
| 1982 | { | 1994 | { |
| 1983 | struct isp_device *isp = platform_get_drvdata(pdev); | 1995 | struct isp_device *isp = platform_get_drvdata(pdev); |
| 1984 | int i; | 1996 | int i; |
| @@ -2059,7 +2071,7 @@ static int isp_map_mem_resource(struct platform_device *pdev, | |||
| 2059 | * -EINVAL if couldn't install ISR, | 2071 | * -EINVAL if couldn't install ISR, |
| 2060 | * or clk_get return error value. | 2072 | * or clk_get return error value. |
| 2061 | */ | 2073 | */ |
| 2062 | static int __devinit isp_probe(struct platform_device *pdev) | 2074 | static int isp_probe(struct platform_device *pdev) |
| 2063 | { | 2075 | { |
| 2064 | struct isp_platform_data *pdata = pdev->dev.platform_data; | 2076 | struct isp_platform_data *pdata = pdev->dev.platform_data; |
| 2065 | struct isp_device *isp; | 2077 | struct isp_device *isp; |
| @@ -2095,7 +2107,11 @@ static int __devinit isp_probe(struct platform_device *pdev) | |||
| 2095 | isp->isp_csiphy1.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY1"); | 2107 | isp->isp_csiphy1.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY1"); |
| 2096 | isp->isp_csiphy2.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY2"); | 2108 | isp->isp_csiphy2.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY2"); |
| 2097 | 2109 | ||
| 2098 | /* Clocks */ | 2110 | /* Clocks |
| 2111 | * | ||
| 2112 | * The ISP clock tree is revision-dependent. We thus need to enable ICLK | ||
| 2113 | * manually to read the revision before calling __omap3isp_get(). | ||
| 2114 | */ | ||
| 2099 | ret = isp_map_mem_resource(pdev, isp, OMAP3_ISP_IOMEM_MAIN); | 2115 | ret = isp_map_mem_resource(pdev, isp, OMAP3_ISP_IOMEM_MAIN); |
| 2100 | if (ret < 0) | 2116 | if (ret < 0) |
| 2101 | goto error; | 2117 | goto error; |
| @@ -2104,6 +2120,16 @@ static int __devinit isp_probe(struct platform_device *pdev) | |||
| 2104 | if (ret < 0) | 2120 | if (ret < 0) |
| 2105 | goto error; | 2121 | goto error; |
| 2106 | 2122 | ||
| 2123 | ret = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); | ||
| 2124 | if (ret < 0) | ||
| 2125 | goto error; | ||
| 2126 | |||
| 2127 | isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); | ||
| 2128 | dev_info(isp->dev, "Revision %d.%d found\n", | ||
| 2129 | (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); | ||
| 2130 | |||
| 2131 | clk_disable(isp->clock[ISP_CLK_CAM_ICK]); | ||
| 2132 | |||
| 2107 | if (__omap3isp_get(isp, false) == NULL) { | 2133 | if (__omap3isp_get(isp, false) == NULL) { |
| 2108 | ret = -ENODEV; | 2134 | ret = -ENODEV; |
| 2109 | goto error; | 2135 | goto error; |
| @@ -2114,10 +2140,6 @@ static int __devinit isp_probe(struct platform_device *pdev) | |||
| 2114 | goto error_isp; | 2140 | goto error_isp; |
| 2115 | 2141 | ||
| 2116 | /* Memory resources */ | 2142 | /* Memory resources */ |
| 2117 | isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); | ||
| 2118 | dev_info(isp->dev, "Revision %d.%d found\n", | ||
| 2119 | (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); | ||
| 2120 | |||
| 2121 | for (m = 0; m < ARRAY_SIZE(isp_res_maps); m++) | 2143 | for (m = 0; m < ARRAY_SIZE(isp_res_maps); m++) |
| 2122 | if (isp->revision == isp_res_maps[m].isp_rev) | 2144 | if (isp->revision == isp_res_maps[m].isp_rev) |
| 2123 | break; | 2145 | break; |
| @@ -2228,7 +2250,7 @@ MODULE_DEVICE_TABLE(platform, omap3isp_id_table); | |||
| 2228 | 2250 | ||
| 2229 | static struct platform_driver omap3isp_driver = { | 2251 | static struct platform_driver omap3isp_driver = { |
| 2230 | .probe = isp_probe, | 2252 | .probe = isp_probe, |
| 2231 | .remove = __devexit_p(isp_remove), | 2253 | .remove = isp_remove, |
| 2232 | .id_table = omap3isp_id_table, | 2254 | .id_table = omap3isp_id_table, |
| 2233 | .driver = { | 2255 | .driver = { |
| 2234 | .owner = THIS_MODULE, | 2256 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/omap3isp/isp.h b/drivers/media/platform/omap3isp/isp.h index 8be7487c326f..517d348ce32b 100644 --- a/drivers/media/platform/omap3isp/isp.h +++ b/drivers/media/platform/omap3isp/isp.h | |||
| @@ -31,11 +31,9 @@ | |||
| 31 | #include <media/v4l2-device.h> | 31 | #include <media/v4l2-device.h> |
| 32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
| 33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
| 34 | #include <linux/iommu.h> | ||
| 34 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
| 35 | #include <linux/wait.h> | 36 | #include <linux/wait.h> |
| 36 | #include <linux/iommu.h> | ||
| 37 | #include <plat/iommu.h> | ||
| 38 | #include <plat/iovmm.h> | ||
| 39 | 37 | ||
| 40 | #include "ispstat.h" | 38 | #include "ispstat.h" |
| 41 | #include "ispccdc.h" | 39 | #include "ispccdc.h" |
| @@ -72,6 +70,8 @@ enum isp_mem_resources { | |||
| 72 | OMAP3_ISP_IOMEM_CSI2C_REGS1, | 70 | OMAP3_ISP_IOMEM_CSI2C_REGS1, |
| 73 | OMAP3_ISP_IOMEM_CSIPHY1, | 71 | OMAP3_ISP_IOMEM_CSIPHY1, |
| 74 | OMAP3_ISP_IOMEM_CSI2C_REGS2, | 72 | OMAP3_ISP_IOMEM_CSI2C_REGS2, |
| 73 | OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, | ||
| 74 | OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, | ||
| 75 | OMAP3_ISP_IOMEM_LAST | 75 | OMAP3_ISP_IOMEM_LAST |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| @@ -127,9 +127,6 @@ struct isp_reg { | |||
| 127 | 127 | ||
| 128 | struct isp_platform_callback { | 128 | struct isp_platform_callback { |
| 129 | u32 (*set_xclk)(struct isp_device *isp, u32 xclk, u8 xclksel); | 129 | u32 (*set_xclk)(struct isp_device *isp, u32 xclk, u8 xclksel); |
| 130 | int (*csiphy_config)(struct isp_csiphy *phy, | ||
| 131 | struct isp_csiphy_dphy_cfg *dphy, | ||
| 132 | struct isp_csiphy_lanes_cfg *lanes); | ||
| 133 | }; | 130 | }; |
| 134 | 131 | ||
| 135 | /* | 132 | /* |
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index 60181ab96063..60e60aa64fb4 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
| 31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
| 33 | #include <linux/omap-iommu.h> | ||
| 33 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
| 34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 35 | #include <media/v4l2-event.h> | 36 | #include <media/v4l2-event.h> |
| @@ -1706,7 +1707,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) | |||
| 1706 | } | 1707 | } |
| 1707 | 1708 | ||
| 1708 | static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | 1709 | static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, |
| 1709 | const struct v4l2_event_subscription *sub) | 1710 | struct v4l2_event_subscription *sub) |
| 1710 | { | 1711 | { |
| 1711 | if (sub->type != V4L2_EVENT_FRAME_SYNC) | 1712 | if (sub->type != V4L2_EVENT_FRAME_SYNC) |
| 1712 | return -EINVAL; | 1713 | return -EINVAL; |
| @@ -1719,7 +1720,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | |||
| 1719 | } | 1720 | } |
| 1720 | 1721 | ||
| 1721 | static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, | 1722 | static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, |
| 1722 | const struct v4l2_event_subscription *sub) | 1723 | struct v4l2_event_subscription *sub) |
| 1723 | { | 1724 | { |
| 1724 | return v4l2_event_unsubscribe(fh, sub); | 1725 | return v4l2_event_unsubscribe(fh, sub); |
| 1725 | } | 1726 | } |
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c index 6a3ff792af7d..783f4b05b153 100644 --- a/drivers/media/platform/omap3isp/ispcsi2.c +++ b/drivers/media/platform/omap3isp/ispcsi2.c | |||
| @@ -517,7 +517,7 @@ int omap3isp_csi2_reset(struct isp_csi2_device *csi2) | |||
| 517 | } while (soft_reset_retries < 5); | 517 | } while (soft_reset_retries < 5); |
| 518 | 518 | ||
| 519 | if (soft_reset_retries == 5) { | 519 | if (soft_reset_retries == 5) { |
| 520 | printk(KERN_ERR "CSI2: Soft reset try count exceeded!\n"); | 520 | dev_err(isp->dev, "CSI2: Soft reset try count exceeded!\n"); |
| 521 | return -EBUSY; | 521 | return -EBUSY; |
| 522 | } | 522 | } |
| 523 | 523 | ||
| @@ -535,8 +535,8 @@ int omap3isp_csi2_reset(struct isp_csi2_device *csi2) | |||
| 535 | } while (--i > 0); | 535 | } while (--i > 0); |
| 536 | 536 | ||
| 537 | if (i == 0) { | 537 | if (i == 0) { |
| 538 | printk(KERN_ERR | 538 | dev_err(isp->dev, |
| 539 | "CSI2: Reset for CSI2_96M_FCLK domain Failed!\n"); | 539 | "CSI2: Reset for CSI2_96M_FCLK domain Failed!\n"); |
| 540 | return -EBUSY; | 540 | return -EBUSY; |
| 541 | } | 541 | } |
| 542 | 542 | ||
diff --git a/drivers/media/platform/omap3isp/ispcsiphy.c b/drivers/media/platform/omap3isp/ispcsiphy.c index 348f67ebbbc9..3d56b33f85e8 100644 --- a/drivers/media/platform/omap3isp/ispcsiphy.c +++ b/drivers/media/platform/omap3isp/ispcsiphy.c | |||
| @@ -32,34 +32,92 @@ | |||
| 32 | #include "ispreg.h" | 32 | #include "ispreg.h" |
| 33 | #include "ispcsiphy.h" | 33 | #include "ispcsiphy.h" |
| 34 | 34 | ||
| 35 | /* | 35 | static void csiphy_routing_cfg_3630(struct isp_csiphy *phy, u32 iface, |
| 36 | * csiphy_lanes_config - Configuration of CSIPHY lanes. | 36 | bool ccp2_strobe) |
| 37 | * | ||
| 38 | * Updates HW configuration. | ||
| 39 | * Called with phy->mutex taken. | ||
| 40 | */ | ||
| 41 | static void csiphy_lanes_config(struct isp_csiphy *phy) | ||
| 42 | { | 37 | { |
| 43 | unsigned int i; | 38 | u32 reg = isp_reg_readl( |
| 44 | u32 reg; | 39 | phy->isp, OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0); |
| 40 | u32 shift, mode; | ||
| 41 | |||
| 42 | switch (iface) { | ||
| 43 | case ISP_INTERFACE_CCP2B_PHY1: | ||
| 44 | reg &= ~OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2; | ||
| 45 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT; | ||
| 46 | break; | ||
| 47 | case ISP_INTERFACE_CSI2C_PHY1: | ||
| 48 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT; | ||
| 49 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY; | ||
| 50 | break; | ||
| 51 | case ISP_INTERFACE_CCP2B_PHY2: | ||
| 52 | reg |= OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2; | ||
| 53 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT; | ||
| 54 | break; | ||
| 55 | case ISP_INTERFACE_CSI2A_PHY2: | ||
| 56 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT; | ||
| 57 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY; | ||
| 58 | break; | ||
| 59 | } | ||
| 45 | 60 | ||
| 46 | reg = isp_reg_readl(phy->isp, phy->cfg_regs, ISPCSI2_PHY_CFG); | 61 | /* Select data/clock or data/strobe mode for CCP2 */ |
| 62 | switch (iface) { | ||
| 63 | case ISP_INTERFACE_CCP2B_PHY1: | ||
| 64 | case ISP_INTERFACE_CCP2B_PHY2: | ||
| 65 | if (ccp2_strobe) | ||
| 66 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_STROBE; | ||
| 67 | else | ||
| 68 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_CLOCK; | ||
| 69 | } | ||
| 47 | 70 | ||
| 48 | for (i = 0; i < phy->num_data_lanes; i++) { | 71 | reg &= ~(OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK << shift); |
| 49 | reg &= ~(ISPCSI2_PHY_CFG_DATA_POL_MASK(i + 1) | | 72 | reg |= mode << shift; |
| 50 | ISPCSI2_PHY_CFG_DATA_POSITION_MASK(i + 1)); | 73 | |
| 51 | reg |= (phy->lanes.data[i].pol << | 74 | isp_reg_writel(phy->isp, reg, |
| 52 | ISPCSI2_PHY_CFG_DATA_POL_SHIFT(i + 1)); | 75 | OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0); |
| 53 | reg |= (phy->lanes.data[i].pos << | 76 | } |
| 54 | ISPCSI2_PHY_CFG_DATA_POSITION_SHIFT(i + 1)); | 77 | |
| 78 | static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on, | ||
| 79 | bool ccp2_strobe) | ||
| 80 | { | ||
| 81 | u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ | ||
| 82 | | OMAP343X_CONTROL_CSIRXFE_RESET; | ||
| 83 | |||
| 84 | /* Only the CCP2B on PHY1 is configurable. */ | ||
| 85 | if (iface != ISP_INTERFACE_CCP2B_PHY1) | ||
| 86 | return; | ||
| 87 | |||
| 88 | if (!on) { | ||
| 89 | isp_reg_writel(phy->isp, 0, | ||
| 90 | OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0); | ||
| 91 | return; | ||
| 55 | } | 92 | } |
| 56 | 93 | ||
| 57 | reg &= ~(ISPCSI2_PHY_CFG_CLOCK_POL_MASK | | 94 | if (ccp2_strobe) |
| 58 | ISPCSI2_PHY_CFG_CLOCK_POSITION_MASK); | 95 | csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM; |
| 59 | reg |= phy->lanes.clk.pol << ISPCSI2_PHY_CFG_CLOCK_POL_SHIFT; | ||
| 60 | reg |= phy->lanes.clk.pos << ISPCSI2_PHY_CFG_CLOCK_POSITION_SHIFT; | ||
| 61 | 96 | ||
| 62 | isp_reg_writel(phy->isp, reg, phy->cfg_regs, ISPCSI2_PHY_CFG); | 97 | isp_reg_writel(phy->isp, csirxfe, |
| 98 | OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0); | ||
| 99 | } | ||
| 100 | |||
| 101 | /* | ||
| 102 | * Configure OMAP 3 CSI PHY routing. | ||
| 103 | * @phy: relevant phy device | ||
| 104 | * @iface: ISP_INTERFACE_* | ||
| 105 | * @on: power on or off | ||
| 106 | * @ccp2_strobe: false: data/clock, true: data/strobe | ||
| 107 | * | ||
| 108 | * Note that the underlying routing configuration registers are part of the | ||
| 109 | * control (SCM) register space and part of the CORE power domain on both 3430 | ||
| 110 | * and 3630, so they will not hold their contents in off-mode. This isn't an | ||
| 111 | * issue since the MPU power domain is forced on whilst the ISP is in use. | ||
| 112 | */ | ||
| 113 | static void csiphy_routing_cfg(struct isp_csiphy *phy, u32 iface, bool on, | ||
| 114 | bool ccp2_strobe) | ||
| 115 | { | ||
| 116 | if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL] | ||
| 117 | && on) | ||
| 118 | return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe); | ||
| 119 | if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE]) | ||
| 120 | return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe); | ||
| 63 | } | 121 | } |
| 64 | 122 | ||
| 65 | /* | 123 | /* |
| @@ -99,7 +157,7 @@ static int csiphy_set_power(struct isp_csiphy *phy, u32 power) | |||
| 99 | } while ((reg != power >> 2) && (retry_count < 100)); | 157 | } while ((reg != power >> 2) && (retry_count < 100)); |
| 100 | 158 | ||
| 101 | if (retry_count == 100) { | 159 | if (retry_count == 100) { |
| 102 | printk(KERN_ERR "CSI2 CIO set power failed!\n"); | 160 | dev_err(phy->isp->dev, "CSI2 CIO set power failed!\n"); |
| 103 | return -EBUSY; | 161 | return -EBUSY; |
| 104 | } | 162 | } |
| 105 | 163 | ||
| @@ -107,43 +165,28 @@ static int csiphy_set_power(struct isp_csiphy *phy, u32 power) | |||
| 107 | } | 165 | } |
| 108 | 166 | ||
| 109 | /* | 167 | /* |
| 110 | * csiphy_dphy_config - Configure CSI2 D-PHY parameters. | 168 | * TCLK values are OK at their reset values |
| 111 | * | ||
| 112 | * Called with phy->mutex taken. | ||
| 113 | */ | 169 | */ |
| 114 | static void csiphy_dphy_config(struct isp_csiphy *phy) | 170 | #define TCLK_TERM 0 |
| 115 | { | 171 | #define TCLK_MISS 1 |
| 116 | u32 reg; | 172 | #define TCLK_SETTLE 14 |
| 117 | |||
| 118 | /* Set up ISPCSIPHY_REG0 */ | ||
| 119 | reg = isp_reg_readl(phy->isp, phy->phy_regs, ISPCSIPHY_REG0); | ||
| 120 | |||
| 121 | reg &= ~(ISPCSIPHY_REG0_THS_TERM_MASK | | ||
| 122 | ISPCSIPHY_REG0_THS_SETTLE_MASK); | ||
| 123 | reg |= phy->dphy.ths_term << ISPCSIPHY_REG0_THS_TERM_SHIFT; | ||
| 124 | reg |= phy->dphy.ths_settle << ISPCSIPHY_REG0_THS_SETTLE_SHIFT; | ||
| 125 | |||
| 126 | isp_reg_writel(phy->isp, reg, phy->phy_regs, ISPCSIPHY_REG0); | ||
| 127 | |||
| 128 | /* Set up ISPCSIPHY_REG1 */ | ||
| 129 | reg = isp_reg_readl(phy->isp, phy->phy_regs, ISPCSIPHY_REG1); | ||
| 130 | |||
| 131 | reg &= ~(ISPCSIPHY_REG1_TCLK_TERM_MASK | | ||
| 132 | ISPCSIPHY_REG1_TCLK_MISS_MASK | | ||
| 133 | ISPCSIPHY_REG1_TCLK_SETTLE_MASK); | ||
| 134 | reg |= phy->dphy.tclk_term << ISPCSIPHY_REG1_TCLK_TERM_SHIFT; | ||
| 135 | reg |= phy->dphy.tclk_miss << ISPCSIPHY_REG1_TCLK_MISS_SHIFT; | ||
| 136 | reg |= phy->dphy.tclk_settle << ISPCSIPHY_REG1_TCLK_SETTLE_SHIFT; | ||
| 137 | |||
| 138 | isp_reg_writel(phy->isp, reg, phy->phy_regs, ISPCSIPHY_REG1); | ||
| 139 | } | ||
| 140 | 173 | ||
| 141 | static int csiphy_config(struct isp_csiphy *phy, | 174 | static int omap3isp_csiphy_config(struct isp_csiphy *phy) |
| 142 | struct isp_csiphy_dphy_cfg *dphy, | ||
| 143 | struct isp_csiphy_lanes_cfg *lanes) | ||
| 144 | { | 175 | { |
| 176 | struct isp_csi2_device *csi2 = phy->csi2; | ||
| 177 | struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity); | ||
| 178 | struct isp_v4l2_subdevs_group *subdevs = pipe->external->host_priv; | ||
| 179 | struct isp_csiphy_lanes_cfg *lanes; | ||
| 180 | int csi2_ddrclk_khz; | ||
| 145 | unsigned int used_lanes = 0; | 181 | unsigned int used_lanes = 0; |
| 146 | unsigned int i; | 182 | unsigned int i; |
| 183 | u32 reg; | ||
| 184 | |||
| 185 | if (subdevs->interface == ISP_INTERFACE_CCP2B_PHY1 | ||
| 186 | || subdevs->interface == ISP_INTERFACE_CCP2B_PHY2) | ||
| 187 | lanes = &subdevs->bus.ccp2.lanecfg; | ||
| 188 | else | ||
| 189 | lanes = &subdevs->bus.csi2.lanecfg; | ||
| 147 | 190 | ||
| 148 | /* Clock and data lanes verification */ | 191 | /* Clock and data lanes verification */ |
| 149 | for (i = 0; i < phy->num_data_lanes; i++) { | 192 | for (i = 0; i < phy->num_data_lanes; i++) { |
| @@ -162,10 +205,61 @@ static int csiphy_config(struct isp_csiphy *phy, | |||
| 162 | if (lanes->clk.pos == 0 || used_lanes & (1 << lanes->clk.pos)) | 205 | if (lanes->clk.pos == 0 || used_lanes & (1 << lanes->clk.pos)) |
| 163 | return -EINVAL; | 206 | return -EINVAL; |
| 164 | 207 | ||
| 165 | mutex_lock(&phy->mutex); | 208 | /* |
| 166 | phy->dphy = *dphy; | 209 | * The PHY configuration is lost in off mode, that's not an |
| 167 | phy->lanes = *lanes; | 210 | * issue since the MPU power domain is forced on whilst the |
| 168 | mutex_unlock(&phy->mutex); | 211 | * ISP is in use. |
| 212 | */ | ||
| 213 | csiphy_routing_cfg(phy, subdevs->interface, true, | ||
| 214 | subdevs->bus.ccp2.phy_layer); | ||
| 215 | |||
| 216 | /* DPHY timing configuration */ | ||
| 217 | /* CSI-2 is DDR and we only count used lanes. */ | ||
| 218 | csi2_ddrclk_khz = pipe->external_rate / 1000 | ||
| 219 | / (2 * hweight32(used_lanes)) * pipe->external_width; | ||
| 220 | |||
| 221 | reg = isp_reg_readl(csi2->isp, phy->phy_regs, ISPCSIPHY_REG0); | ||
| 222 | |||
| 223 | reg &= ~(ISPCSIPHY_REG0_THS_TERM_MASK | | ||
| 224 | ISPCSIPHY_REG0_THS_SETTLE_MASK); | ||
| 225 | /* THS_TERM: Programmed value = ceil(12.5 ns/DDRClk period) - 1. */ | ||
| 226 | reg |= (DIV_ROUND_UP(25 * csi2_ddrclk_khz, 2000000) - 1) | ||
| 227 | << ISPCSIPHY_REG0_THS_TERM_SHIFT; | ||
| 228 | /* THS_SETTLE: Programmed value = ceil(90 ns/DDRClk period) + 3. */ | ||
| 229 | reg |= (DIV_ROUND_UP(90 * csi2_ddrclk_khz, 1000000) + 3) | ||
| 230 | << ISPCSIPHY_REG0_THS_SETTLE_SHIFT; | ||
| 231 | |||
| 232 | isp_reg_writel(csi2->isp, reg, phy->phy_regs, ISPCSIPHY_REG0); | ||
| 233 | |||
| 234 | reg = isp_reg_readl(csi2->isp, phy->phy_regs, ISPCSIPHY_REG1); | ||
| 235 | |||
| 236 | reg &= ~(ISPCSIPHY_REG1_TCLK_TERM_MASK | | ||
| 237 | ISPCSIPHY_REG1_TCLK_MISS_MASK | | ||
| 238 | ISPCSIPHY_REG1_TCLK_SETTLE_MASK); | ||
| 239 | reg |= TCLK_TERM << ISPCSIPHY_REG1_TCLK_TERM_SHIFT; | ||
| 240 | reg |= TCLK_MISS << ISPCSIPHY_REG1_TCLK_MISS_SHIFT; | ||
| 241 | reg |= TCLK_SETTLE << ISPCSIPHY_REG1_TCLK_SETTLE_SHIFT; | ||
| 242 | |||
| 243 | isp_reg_writel(csi2->isp, reg, phy->phy_regs, ISPCSIPHY_REG1); | ||
| 244 | |||
| 245 | /* DPHY lane configuration */ | ||
| 246 | reg = isp_reg_readl(csi2->isp, phy->cfg_regs, ISPCSI2_PHY_CFG); | ||
| 247 | |||
| 248 | for (i = 0; i < phy->num_data_lanes; i++) { | ||
| 249 | reg &= ~(ISPCSI2_PHY_CFG_DATA_POL_MASK(i + 1) | | ||
| 250 | ISPCSI2_PHY_CFG_DATA_POSITION_MASK(i + 1)); | ||
| 251 | reg |= (lanes->data[i].pol << | ||
| 252 | ISPCSI2_PHY_CFG_DATA_POL_SHIFT(i + 1)); | ||
| 253 | reg |= (lanes->data[i].pos << | ||
| 254 | ISPCSI2_PHY_CFG_DATA_POSITION_SHIFT(i + 1)); | ||
| 255 | } | ||
| 256 | |||
| 257 | reg &= ~(ISPCSI2_PHY_CFG_CLOCK_POL_MASK | | ||
| 258 | ISPCSI2_PHY_CFG_CLOCK_POSITION_MASK); | ||
| 259 | reg |= lanes->clk.pol << ISPCSI2_PHY_CFG_CLOCK_POL_SHIFT; | ||
| 260 | reg |= lanes->clk.pos << ISPCSI2_PHY_CFG_CLOCK_POSITION_SHIFT; | ||
| 261 | |||
| 262 | isp_reg_writel(csi2->isp, reg, phy->cfg_regs, ISPCSI2_PHY_CFG); | ||
| 169 | 263 | ||
| 170 | return 0; | 264 | return 0; |
| 171 | } | 265 | } |
| @@ -190,8 +284,9 @@ int omap3isp_csiphy_acquire(struct isp_csiphy *phy) | |||
| 190 | if (rval < 0) | 284 | if (rval < 0) |
| 191 | goto done; | 285 | goto done; |
| 192 | 286 | ||
| 193 | csiphy_dphy_config(phy); | 287 | rval = omap3isp_csiphy_config(phy); |
| 194 | csiphy_lanes_config(phy); | 288 | if (rval < 0) |
| 289 | goto done; | ||
| 195 | 290 | ||
| 196 | rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON); | 291 | rval = csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_ON); |
| 197 | if (rval) { | 292 | if (rval) { |
| @@ -211,6 +306,14 @@ void omap3isp_csiphy_release(struct isp_csiphy *phy) | |||
| 211 | { | 306 | { |
| 212 | mutex_lock(&phy->mutex); | 307 | mutex_lock(&phy->mutex); |
| 213 | if (phy->phy_in_use) { | 308 | if (phy->phy_in_use) { |
| 309 | struct isp_csi2_device *csi2 = phy->csi2; | ||
| 310 | struct isp_pipeline *pipe = | ||
| 311 | to_isp_pipeline(&csi2->subdev.entity); | ||
| 312 | struct isp_v4l2_subdevs_group *subdevs = | ||
| 313 | pipe->external->host_priv; | ||
| 314 | |||
| 315 | csiphy_routing_cfg(phy, subdevs->interface, false, | ||
| 316 | subdevs->bus.ccp2.phy_layer); | ||
| 214 | csiphy_power_autoswitch_enable(phy, false); | 317 | csiphy_power_autoswitch_enable(phy, false); |
| 215 | csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_OFF); | 318 | csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_OFF); |
| 216 | regulator_disable(phy->vdd); | 319 | regulator_disable(phy->vdd); |
| @@ -227,8 +330,6 @@ int omap3isp_csiphy_init(struct isp_device *isp) | |||
| 227 | struct isp_csiphy *phy1 = &isp->isp_csiphy1; | 330 | struct isp_csiphy *phy1 = &isp->isp_csiphy1; |
| 228 | struct isp_csiphy *phy2 = &isp->isp_csiphy2; | 331 | struct isp_csiphy *phy2 = &isp->isp_csiphy2; |
| 229 | 332 | ||
| 230 | isp->platform_cb.csiphy_config = csiphy_config; | ||
| 231 | |||
| 232 | phy2->isp = isp; | 333 | phy2->isp = isp; |
| 233 | phy2->csi2 = &isp->isp_csi2a; | 334 | phy2->csi2 = &isp->isp_csi2a; |
| 234 | phy2->num_data_lanes = ISP_CSIPHY2_NUM_DATA_LANES; | 335 | phy2->num_data_lanes = ISP_CSIPHY2_NUM_DATA_LANES; |
diff --git a/drivers/media/platform/omap3isp/ispcsiphy.h b/drivers/media/platform/omap3isp/ispcsiphy.h index e93a661e65d9..14551fd77697 100644 --- a/drivers/media/platform/omap3isp/ispcsiphy.h +++ b/drivers/media/platform/omap3isp/ispcsiphy.h | |||
| @@ -32,14 +32,6 @@ | |||
| 32 | struct isp_csi2_device; | 32 | struct isp_csi2_device; |
| 33 | struct regulator; | 33 | struct regulator; |
| 34 | 34 | ||
| 35 | struct isp_csiphy_dphy_cfg { | ||
| 36 | u8 ths_term; | ||
| 37 | u8 ths_settle; | ||
| 38 | u8 tclk_term; | ||
| 39 | unsigned tclk_miss:1; | ||
| 40 | u8 tclk_settle; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct isp_csiphy { | 35 | struct isp_csiphy { |
| 44 | struct isp_device *isp; | 36 | struct isp_device *isp; |
| 45 | struct mutex mutex; /* serialize csiphy configuration */ | 37 | struct mutex mutex; /* serialize csiphy configuration */ |
| @@ -52,8 +44,6 @@ struct isp_csiphy { | |||
| 52 | unsigned int phy_regs; | 44 | unsigned int phy_regs; |
| 53 | 45 | ||
| 54 | u8 num_data_lanes; /* number of CSI2 Data Lanes supported */ | 46 | u8 num_data_lanes; /* number of CSI2 Data Lanes supported */ |
| 55 | struct isp_csiphy_lanes_cfg lanes; | ||
| 56 | struct isp_csiphy_dphy_cfg dphy; | ||
| 57 | }; | 47 | }; |
| 58 | 48 | ||
| 59 | int omap3isp_csiphy_acquire(struct isp_csiphy *phy); | 49 | int omap3isp_csiphy_acquire(struct isp_csiphy *phy); |
diff --git a/drivers/media/platform/omap3isp/isphist.c b/drivers/media/platform/omap3isp/isphist.c index d1a8dee5e1ca..2d759c56f37c 100644 --- a/drivers/media/platform/omap3isp/isphist.c +++ b/drivers/media/platform/omap3isp/isphist.c | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | #include "ispreg.h" | 34 | #include "ispreg.h" |
| 35 | #include "isphist.h" | 35 | #include "isphist.h" |
| 36 | 36 | ||
| 37 | #define OMAP24XX_DMA_NO_DEVICE 0 | ||
| 38 | |||
| 37 | #define HIST_CONFIG_DMA 1 | 39 | #define HIST_CONFIG_DMA 1 |
| 38 | 40 | ||
| 39 | #define HIST_USING_DMA(hist) ((hist)->dma_ch >= 0) | 41 | #define HIST_USING_DMA(hist) ((hist)->dma_ch >= 0) |
| @@ -72,11 +74,14 @@ static void hist_reset_mem(struct ispstat *hist) | |||
| 72 | 74 | ||
| 73 | static void hist_dma_config(struct ispstat *hist) | 75 | static void hist_dma_config(struct ispstat *hist) |
| 74 | { | 76 | { |
| 77 | struct isp_device *isp = hist->isp; | ||
| 78 | |||
| 75 | hist->dma_config.data_type = OMAP_DMA_DATA_TYPE_S32; | 79 | hist->dma_config.data_type = OMAP_DMA_DATA_TYPE_S32; |
| 76 | hist->dma_config.sync_mode = OMAP_DMA_SYNC_ELEMENT; | 80 | hist->dma_config.sync_mode = OMAP_DMA_SYNC_ELEMENT; |
| 77 | hist->dma_config.frame_count = 1; | 81 | hist->dma_config.frame_count = 1; |
| 78 | hist->dma_config.src_amode = OMAP_DMA_AMODE_CONSTANT; | 82 | hist->dma_config.src_amode = OMAP_DMA_AMODE_CONSTANT; |
| 79 | hist->dma_config.src_start = OMAP3ISP_HIST_REG_BASE + ISPHIST_DATA; | 83 | hist->dma_config.src_start = isp->mmio_base_phys[OMAP3_ISP_IOMEM_HIST] |
| 84 | + ISPHIST_DATA; | ||
| 80 | hist->dma_config.dst_amode = OMAP_DMA_AMODE_POST_INC; | 85 | hist->dma_config.dst_amode = OMAP_DMA_AMODE_POST_INC; |
| 81 | hist->dma_config.src_or_dst_synch = OMAP_DMA_SRC_SYNC; | 86 | hist->dma_config.src_or_dst_synch = OMAP_DMA_SRC_SYNC; |
| 82 | } | 87 | } |
| @@ -477,6 +482,8 @@ int omap3isp_hist_init(struct isp_device *isp) | |||
| 477 | return -ENOMEM; | 482 | return -ENOMEM; |
| 478 | 483 | ||
| 479 | memset(hist, 0, sizeof(*hist)); | 484 | memset(hist, 0, sizeof(*hist)); |
| 485 | hist->isp = isp; | ||
| 486 | |||
| 480 | if (HIST_CONFIG_DMA) | 487 | if (HIST_CONFIG_DMA) |
| 481 | ret = omap_request_dma(OMAP24XX_DMA_NO_DEVICE, "DMA_ISP_HIST", | 488 | ret = omap_request_dma(OMAP24XX_DMA_NO_DEVICE, "DMA_ISP_HIST", |
| 482 | hist_dma_cb, hist, &hist->dma_ch); | 489 | hist_dma_cb, hist, &hist->dma_ch); |
| @@ -494,7 +501,6 @@ int omap3isp_hist_init(struct isp_device *isp) | |||
| 494 | hist->ops = &hist_ops; | 501 | hist->ops = &hist_ops; |
| 495 | hist->priv = hist_cfg; | 502 | hist->priv = hist_cfg; |
| 496 | hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; | 503 | hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; |
| 497 | hist->isp = isp; | ||
| 498 | 504 | ||
| 499 | ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); | 505 | ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); |
| 500 | if (ret) { | 506 | if (ret) { |
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c index 1ae1c0909ed1..691b92a3c3e7 100644 --- a/drivers/media/platform/omap3isp/isppreview.c +++ b/drivers/media/platform/omap3isp/isppreview.c | |||
| @@ -200,10 +200,10 @@ static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable) | |||
| 200 | 200 | ||
| 201 | if (enable) | 201 | if (enable) |
| 202 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | 202 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
| 203 | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW); | 203 | ISPPRV_PCR_INVALAW); |
| 204 | else | 204 | else |
| 205 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | 205 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
| 206 | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW); | 206 | ISPPRV_PCR_INVALAW); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | /* | 209 | /* |
| @@ -1014,7 +1014,7 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
| 1014 | /* | 1014 | /* |
| 1015 | * preview_config_input_format - Configure the input format | 1015 | * preview_config_input_format - Configure the input format |
| 1016 | * @prev: The preview engine | 1016 | * @prev: The preview engine |
| 1017 | * @format: Format on the preview engine sink pad | 1017 | * @info: Sink pad format information |
| 1018 | * | 1018 | * |
| 1019 | * Enable and configure CFA interpolation for Bayer formats and disable it for | 1019 | * Enable and configure CFA interpolation for Bayer formats and disable it for |
| 1020 | * greyscale formats. | 1020 | * greyscale formats. |
| @@ -1025,22 +1025,29 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
| 1025 | * reordered to support non-GRBG Bayer patterns. | 1025 | * reordered to support non-GRBG Bayer patterns. |
| 1026 | */ | 1026 | */ |
| 1027 | static void preview_config_input_format(struct isp_prev_device *prev, | 1027 | static void preview_config_input_format(struct isp_prev_device *prev, |
| 1028 | const struct v4l2_mbus_framefmt *format) | 1028 | const struct isp_format_info *info) |
| 1029 | { | 1029 | { |
| 1030 | struct isp_device *isp = to_isp_device(prev); | 1030 | struct isp_device *isp = to_isp_device(prev); |
| 1031 | struct prev_params *params; | 1031 | struct prev_params *params; |
| 1032 | 1032 | ||
| 1033 | switch (format->code) { | 1033 | if (info->width == 8) |
| 1034 | case V4L2_MBUS_FMT_SGRBG10_1X10: | 1034 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
| 1035 | ISPPRV_PCR_WIDTH); | ||
| 1036 | else | ||
| 1037 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
| 1038 | ISPPRV_PCR_WIDTH); | ||
| 1039 | |||
| 1040 | switch (info->flavor) { | ||
| 1041 | case V4L2_MBUS_FMT_SGRBG8_1X8: | ||
| 1035 | prev->params.cfa_order = 0; | 1042 | prev->params.cfa_order = 0; |
| 1036 | break; | 1043 | break; |
| 1037 | case V4L2_MBUS_FMT_SRGGB10_1X10: | 1044 | case V4L2_MBUS_FMT_SRGGB8_1X8: |
| 1038 | prev->params.cfa_order = 1; | 1045 | prev->params.cfa_order = 1; |
| 1039 | break; | 1046 | break; |
| 1040 | case V4L2_MBUS_FMT_SBGGR10_1X10: | 1047 | case V4L2_MBUS_FMT_SBGGR8_1X8: |
| 1041 | prev->params.cfa_order = 2; | 1048 | prev->params.cfa_order = 2; |
| 1042 | break; | 1049 | break; |
| 1043 | case V4L2_MBUS_FMT_SGBRG10_1X10: | 1050 | case V4L2_MBUS_FMT_SGBRG8_1X8: |
| 1044 | prev->params.cfa_order = 3; | 1051 | prev->params.cfa_order = 3; |
| 1045 | break; | 1052 | break; |
| 1046 | default: | 1053 | default: |
| @@ -1081,7 +1088,8 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
| 1081 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1088 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
| 1082 | u32 features; | 1089 | u32 features; |
| 1083 | 1090 | ||
| 1084 | if (format->code != V4L2_MBUS_FMT_Y10_1X10) { | 1091 | if (format->code != V4L2_MBUS_FMT_Y8_1X8 && |
| 1092 | format->code != V4L2_MBUS_FMT_Y10_1X10) { | ||
| 1085 | sph -= 2; | 1093 | sph -= 2; |
| 1086 | eph += 2; | 1094 | eph += 2; |
| 1087 | slv -= 2; | 1095 | slv -= 2; |
| @@ -1389,6 +1397,7 @@ static unsigned int preview_max_out_width(struct isp_prev_device *prev) | |||
| 1389 | static void preview_configure(struct isp_prev_device *prev) | 1397 | static void preview_configure(struct isp_prev_device *prev) |
| 1390 | { | 1398 | { |
| 1391 | struct isp_device *isp = to_isp_device(prev); | 1399 | struct isp_device *isp = to_isp_device(prev); |
| 1400 | const struct isp_format_info *info; | ||
| 1392 | struct v4l2_mbus_framefmt *format; | 1401 | struct v4l2_mbus_framefmt *format; |
| 1393 | unsigned long flags; | 1402 | unsigned long flags; |
| 1394 | u32 update; | 1403 | u32 update; |
| @@ -1402,17 +1411,18 @@ static void preview_configure(struct isp_prev_device *prev) | |||
| 1402 | 1411 | ||
| 1403 | /* PREV_PAD_SINK */ | 1412 | /* PREV_PAD_SINK */ |
| 1404 | format = &prev->formats[PREV_PAD_SINK]; | 1413 | format = &prev->formats[PREV_PAD_SINK]; |
| 1414 | info = omap3isp_video_format_info(format->code); | ||
| 1405 | 1415 | ||
| 1406 | preview_adjust_bandwidth(prev); | 1416 | preview_adjust_bandwidth(prev); |
| 1407 | 1417 | ||
| 1408 | preview_config_input_format(prev, format); | 1418 | preview_config_input_format(prev, info); |
| 1409 | preview_config_input_size(prev, active); | 1419 | preview_config_input_size(prev, active); |
| 1410 | 1420 | ||
| 1411 | if (prev->input == PREVIEW_INPUT_CCDC) | 1421 | if (prev->input == PREVIEW_INPUT_CCDC) |
| 1412 | preview_config_inlineoffset(prev, 0); | 1422 | preview_config_inlineoffset(prev, 0); |
| 1413 | else | 1423 | else |
| 1414 | preview_config_inlineoffset(prev, | 1424 | preview_config_inlineoffset(prev, ALIGN(format->width, 0x20) * |
| 1415 | ALIGN(format->width, 0x20) * 2); | 1425 | info->bpp); |
| 1416 | 1426 | ||
| 1417 | preview_setup_hw(prev, update, active); | 1427 | preview_setup_hw(prev, update, active); |
| 1418 | 1428 | ||
| @@ -1709,6 +1719,11 @@ __preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_fh *fh, | |||
| 1709 | 1719 | ||
| 1710 | /* previewer format descriptions */ | 1720 | /* previewer format descriptions */ |
| 1711 | static const unsigned int preview_input_fmts[] = { | 1721 | static const unsigned int preview_input_fmts[] = { |
| 1722 | V4L2_MBUS_FMT_Y8_1X8, | ||
| 1723 | V4L2_MBUS_FMT_SGRBG8_1X8, | ||
| 1724 | V4L2_MBUS_FMT_SRGGB8_1X8, | ||
| 1725 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
| 1726 | V4L2_MBUS_FMT_SGBRG8_1X8, | ||
| 1712 | V4L2_MBUS_FMT_Y10_1X10, | 1727 | V4L2_MBUS_FMT_Y10_1X10, |
| 1713 | V4L2_MBUS_FMT_SGRBG10_1X10, | 1728 | V4L2_MBUS_FMT_SGRBG10_1X10, |
| 1714 | V4L2_MBUS_FMT_SRGGB10_1X10, | 1729 | V4L2_MBUS_FMT_SRGGB10_1X10, |
diff --git a/drivers/media/platform/omap3isp/ispreg.h b/drivers/media/platform/omap3isp/ispreg.h index e2c57f334c5d..b7d90e6fb01d 100644 --- a/drivers/media/platform/omap3isp/ispreg.h +++ b/drivers/media/platform/omap3isp/ispreg.h | |||
| @@ -29,83 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #define CM_CAM_MCLK_HZ 172800000 /* Hz */ | 30 | #define CM_CAM_MCLK_HZ 172800000 /* Hz */ |
| 31 | 31 | ||
| 32 | /* ISP Submodules offset */ | ||
| 33 | |||
| 34 | #define L4_34XX_BASE 0x48000000 | ||
| 35 | #define OMAP3430_ISP_BASE (L4_34XX_BASE + 0xBC000) | ||
| 36 | |||
| 37 | #define OMAP3ISP_REG_BASE OMAP3430_ISP_BASE | ||
| 38 | #define OMAP3ISP_REG(offset) (OMAP3ISP_REG_BASE + (offset)) | ||
| 39 | |||
| 40 | #define OMAP3ISP_CCP2_REG_OFFSET 0x0400 | ||
| 41 | #define OMAP3ISP_CCP2_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 42 | OMAP3ISP_CCP2_REG_OFFSET) | ||
| 43 | #define OMAP3ISP_CCP2_REG(offset) (OMAP3ISP_CCP2_REG_BASE + (offset)) | ||
| 44 | |||
| 45 | #define OMAP3ISP_CCDC_REG_OFFSET 0x0600 | ||
| 46 | #define OMAP3ISP_CCDC_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 47 | OMAP3ISP_CCDC_REG_OFFSET) | ||
| 48 | #define OMAP3ISP_CCDC_REG(offset) (OMAP3ISP_CCDC_REG_BASE + (offset)) | ||
| 49 | |||
| 50 | #define OMAP3ISP_HIST_REG_OFFSET 0x0A00 | ||
| 51 | #define OMAP3ISP_HIST_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 52 | OMAP3ISP_HIST_REG_OFFSET) | ||
| 53 | #define OMAP3ISP_HIST_REG(offset) (OMAP3ISP_HIST_REG_BASE + (offset)) | ||
| 54 | |||
| 55 | #define OMAP3ISP_H3A_REG_OFFSET 0x0C00 | ||
| 56 | #define OMAP3ISP_H3A_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 57 | OMAP3ISP_H3A_REG_OFFSET) | ||
| 58 | #define OMAP3ISP_H3A_REG(offset) (OMAP3ISP_H3A_REG_BASE + (offset)) | ||
| 59 | |||
| 60 | #define OMAP3ISP_PREV_REG_OFFSET 0x0E00 | ||
| 61 | #define OMAP3ISP_PREV_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 62 | OMAP3ISP_PREV_REG_OFFSET) | ||
| 63 | #define OMAP3ISP_PREV_REG(offset) (OMAP3ISP_PREV_REG_BASE + (offset)) | ||
| 64 | |||
| 65 | #define OMAP3ISP_RESZ_REG_OFFSET 0x1000 | ||
| 66 | #define OMAP3ISP_RESZ_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 67 | OMAP3ISP_RESZ_REG_OFFSET) | ||
| 68 | #define OMAP3ISP_RESZ_REG(offset) (OMAP3ISP_RESZ_REG_BASE + (offset)) | ||
| 69 | |||
| 70 | #define OMAP3ISP_SBL_REG_OFFSET 0x1200 | ||
| 71 | #define OMAP3ISP_SBL_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 72 | OMAP3ISP_SBL_REG_OFFSET) | ||
| 73 | #define OMAP3ISP_SBL_REG(offset) (OMAP3ISP_SBL_REG_BASE + (offset)) | ||
| 74 | |||
| 75 | #define OMAP3ISP_CSI2A_REGS1_REG_OFFSET 0x1800 | ||
| 76 | #define OMAP3ISP_CSI2A_REGS1_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 77 | OMAP3ISP_CSI2A_REGS1_REG_OFFSET) | ||
| 78 | #define OMAP3ISP_CSI2A_REGS1_REG(offset) \ | ||
| 79 | (OMAP3ISP_CSI2A_REGS1_REG_BASE + (offset)) | ||
| 80 | |||
| 81 | #define OMAP3ISP_CSIPHY2_REG_OFFSET 0x1970 | ||
| 82 | #define OMAP3ISP_CSIPHY2_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 83 | OMAP3ISP_CSIPHY2_REG_OFFSET) | ||
| 84 | #define OMAP3ISP_CSIPHY2_REG(offset) (OMAP3ISP_CSIPHY2_REG_BASE + (offset)) | ||
| 85 | |||
| 86 | #define OMAP3ISP_CSI2A_REGS2_REG_OFFSET 0x19C0 | ||
| 87 | #define OMAP3ISP_CSI2A_REGS2_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 88 | OMAP3ISP_CSI2A_REGS2_REG_OFFSET) | ||
| 89 | #define OMAP3ISP_CSI2A_REGS2_REG(offset) \ | ||
| 90 | (OMAP3ISP_CSI2A_REGS2_REG_BASE + (offset)) | ||
| 91 | |||
| 92 | #define OMAP3ISP_CSI2C_REGS1_REG_OFFSET 0x1C00 | ||
| 93 | #define OMAP3ISP_CSI2C_REGS1_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 94 | OMAP3ISP_CSI2C_REGS1_REG_OFFSET) | ||
| 95 | #define OMAP3ISP_CSI2C_REGS1_REG(offset) \ | ||
| 96 | (OMAP3ISP_CSI2C_REGS1_REG_BASE + (offset)) | ||
| 97 | |||
| 98 | #define OMAP3ISP_CSIPHY1_REG_OFFSET 0x1D70 | ||
| 99 | #define OMAP3ISP_CSIPHY1_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 100 | OMAP3ISP_CSIPHY1_REG_OFFSET) | ||
| 101 | #define OMAP3ISP_CSIPHY1_REG(offset) (OMAP3ISP_CSIPHY1_REG_BASE + (offset)) | ||
| 102 | |||
| 103 | #define OMAP3ISP_CSI2C_REGS2_REG_OFFSET 0x1DC0 | ||
| 104 | #define OMAP3ISP_CSI2C_REGS2_REG_BASE (OMAP3ISP_REG_BASE + \ | ||
| 105 | OMAP3ISP_CSI2C_REGS2_REG_OFFSET) | ||
| 106 | #define OMAP3ISP_CSI2C_REGS2_REG(offset) \ | ||
| 107 | (OMAP3ISP_CSI2C_REGS2_REG_BASE + (offset)) | ||
| 108 | |||
| 109 | /* ISP module register offset */ | 32 | /* ISP module register offset */ |
| 110 | 33 | ||
| 111 | #define ISP_REVISION (0x000) | 34 | #define ISP_REVISION (0x000) |
| @@ -1583,4 +1506,26 @@ | |||
| 1583 | #define ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_MASK \ | 1506 | #define ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_MASK \ |
| 1584 | (0x7fffff << ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_SHIFT) | 1507 | (0x7fffff << ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_SHIFT) |
| 1585 | 1508 | ||
| 1509 | /* ----------------------------------------------------------------------------- | ||
| 1510 | * CONTROL registers for CSI-2 phy routing | ||
| 1511 | */ | ||
| 1512 | |||
| 1513 | /* OMAP343X_CONTROL_CSIRXFE */ | ||
| 1514 | #define OMAP343X_CONTROL_CSIRXFE_CSIB_INV (1 << 7) | ||
| 1515 | #define OMAP343X_CONTROL_CSIRXFE_RESENABLE (1 << 8) | ||
| 1516 | #define OMAP343X_CONTROL_CSIRXFE_SELFORM (1 << 10) | ||
| 1517 | #define OMAP343X_CONTROL_CSIRXFE_PWRDNZ (1 << 12) | ||
| 1518 | #define OMAP343X_CONTROL_CSIRXFE_RESET (1 << 13) | ||
| 1519 | |||
| 1520 | /* OMAP3630_CONTROL_CAMERA_PHY_CTRL */ | ||
| 1521 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT 2 | ||
| 1522 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT 0 | ||
| 1523 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY 0x0 | ||
| 1524 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_STROBE 0x1 | ||
| 1525 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_CLOCK 0x2 | ||
| 1526 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_GPI 0x3 | ||
| 1527 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK 0x3 | ||
| 1528 | /* CCP2B: set to receive data from PHY2 instead of PHY1 */ | ||
| 1529 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2 (1 << 4) | ||
| 1530 | |||
| 1586 | #endif /* OMAP3_ISP_REG_H */ | 1531 | #endif /* OMAP3_ISP_REG_H */ |
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c index d7ac76b5c2ae..61e17f9bd8b9 100644 --- a/drivers/media/platform/omap3isp/ispstat.c +++ b/drivers/media/platform/omap3isp/ispstat.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
| 29 | #include <linux/omap-iommu.h> | ||
| 29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 30 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
| 31 | 32 | ||
| @@ -256,7 +257,7 @@ static int isp_stat_buf_queue(struct ispstat *stat) | |||
| 256 | if (!stat->active_buf) | 257 | if (!stat->active_buf) |
| 257 | return STAT_NO_BUF; | 258 | return STAT_NO_BUF; |
| 258 | 259 | ||
| 259 | do_gettimeofday(&stat->active_buf->ts); | 260 | ktime_get_ts(&stat->active_buf->ts); |
| 260 | 261 | ||
| 261 | stat->active_buf->buf_size = stat->buf_size; | 262 | stat->active_buf->buf_size = stat->buf_size; |
| 262 | if (isp_stat_buf_check_magic(stat, stat->active_buf)) { | 263 | if (isp_stat_buf_check_magic(stat, stat->active_buf)) { |
| @@ -536,7 +537,8 @@ int omap3isp_stat_request_statistics(struct ispstat *stat, | |||
| 536 | return PTR_ERR(buf); | 537 | return PTR_ERR(buf); |
| 537 | } | 538 | } |
| 538 | 539 | ||
| 539 | data->ts = buf->ts; | 540 | data->ts.tv_sec = buf->ts.tv_sec; |
| 541 | data->ts.tv_usec = buf->ts.tv_nsec / NSEC_PER_USEC; | ||
| 540 | data->config_counter = buf->config_counter; | 542 | data->config_counter = buf->config_counter; |
| 541 | data->frame_number = buf->frame_number; | 543 | data->frame_number = buf->frame_number; |
| 542 | data->buf_size = buf->buf_size; | 544 | data->buf_size = buf->buf_size; |
| @@ -1025,7 +1027,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat) | |||
| 1025 | 1027 | ||
| 1026 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | 1028 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, |
| 1027 | struct v4l2_fh *fh, | 1029 | struct v4l2_fh *fh, |
| 1028 | const struct v4l2_event_subscription *sub) | 1030 | struct v4l2_event_subscription *sub) |
| 1029 | { | 1031 | { |
| 1030 | struct ispstat *stat = v4l2_get_subdevdata(subdev); | 1032 | struct ispstat *stat = v4l2_get_subdevdata(subdev); |
| 1031 | 1033 | ||
| @@ -1037,7 +1039,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | |||
| 1037 | 1039 | ||
| 1038 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, | 1040 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, |
| 1039 | struct v4l2_fh *fh, | 1041 | struct v4l2_fh *fh, |
| 1040 | const struct v4l2_event_subscription *sub) | 1042 | struct v4l2_event_subscription *sub) |
| 1041 | { | 1043 | { |
| 1042 | return v4l2_event_unsubscribe(fh, sub); | 1044 | return v4l2_event_unsubscribe(fh, sub); |
| 1043 | } | 1045 | } |
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h index a6fe653eb237..9a047c929b9f 100644 --- a/drivers/media/platform/omap3isp/ispstat.h +++ b/drivers/media/platform/omap3isp/ispstat.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
| 32 | #include <linux/omap3isp.h> | 32 | #include <linux/omap3isp.h> |
| 33 | #include <plat/dma.h> | 33 | #include <linux/omap-dma.h> |
| 34 | #include <media/v4l2-event.h> | 34 | #include <media/v4l2-event.h> |
| 35 | 35 | ||
| 36 | #include "isp.h" | 36 | #include "isp.h" |
| @@ -50,7 +50,7 @@ struct ispstat_buffer { | |||
| 50 | struct iovm_struct *iovm; | 50 | struct iovm_struct *iovm; |
| 51 | void *virt_addr; | 51 | void *virt_addr; |
| 52 | dma_addr_t dma_addr; | 52 | dma_addr_t dma_addr; |
| 53 | struct timeval ts; | 53 | struct timespec ts; |
| 54 | u32 buf_size; | 54 | u32 buf_size; |
| 55 | u32 frame_number; | 55 | u32 frame_number; |
| 56 | u16 config_counter; | 56 | u16 config_counter; |
| @@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name, | |||
| 147 | void omap3isp_stat_cleanup(struct ispstat *stat); | 147 | void omap3isp_stat_cleanup(struct ispstat *stat); |
| 148 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, | 148 | int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, |
| 149 | struct v4l2_fh *fh, | 149 | struct v4l2_fh *fh, |
| 150 | const struct v4l2_event_subscription *sub); | 150 | struct v4l2_event_subscription *sub); |
| 151 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, | 151 | int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, |
| 152 | struct v4l2_fh *fh, | 152 | struct v4l2_fh *fh, |
| 153 | const struct v4l2_event_subscription *sub); | 153 | struct v4l2_event_subscription *sub); |
| 154 | int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); | 154 | int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); |
| 155 | 155 | ||
| 156 | int omap3isp_stat_busy(struct ispstat *stat); | 156 | int omap3isp_stat_busy(struct ispstat *stat); |
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index a0b737fecf13..e0d73a642186 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
| 28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/omap-iommu.h> | ||
| 30 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
| 31 | #include <linux/scatterlist.h> | 32 | #include <linux/scatterlist.h> |
| 32 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
| @@ -792,7 +793,7 @@ isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
| 792 | } | 793 | } |
| 793 | 794 | ||
| 794 | static int | 795 | static int |
| 795 | isp_video_set_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 796 | isp_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop) |
| 796 | { | 797 | { |
| 797 | struct isp_video *video = video_drvdata(file); | 798 | struct isp_video *video = video_drvdata(file); |
| 798 | struct v4l2_subdev *subdev; | 799 | struct v4l2_subdev *subdev; |
| @@ -1391,7 +1392,8 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) | |||
| 1391 | 1392 | ||
| 1392 | ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); | 1393 | ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); |
| 1393 | if (ret < 0) | 1394 | if (ret < 0) |
| 1394 | printk(KERN_ERR "%s: could not register video device (%d)\n", | 1395 | dev_err(video->isp->dev, |
| 1396 | "%s: could not register video device (%d)\n", | ||
| 1395 | __func__, ret); | 1397 | __func__, ret); |
| 1396 | 1398 | ||
| 1397 | return ret; | 1399 | return ret; |
diff --git a/drivers/media/platform/s3c-camif/Makefile b/drivers/media/platform/s3c-camif/Makefile new file mode 100644 index 000000000000..50bf8c59b99c --- /dev/null +++ b/drivers/media/platform/s3c-camif/Makefile | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # Makefile for s3c244x/s3c64xx CAMIF driver | ||
| 2 | |||
| 3 | s3c-camif-objs := camif-core.o camif-capture.o camif-regs.o | ||
| 4 | |||
| 5 | obj-$(CONFIG_VIDEO_S3C_CAMIF) += s3c-camif.o | ||
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c new file mode 100644 index 000000000000..a55793c3d811 --- /dev/null +++ b/drivers/media/platform/s3c-camif/camif-capture.c | |||
| @@ -0,0 +1,1672 @@ | |||
| 1 | /* | ||
| 2 | * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
| 5 | * Copyright (C) 2012 Tomasz Figa <tomasz.figa@gmail.com> | ||
| 6 | * | ||
| 7 | * Based on drivers/media/platform/s5p-fimc, | ||
| 8 | * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd. | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__ | ||
| 15 | |||
| 16 | #include <linux/bug.h> | ||
| 17 | #include <linux/clk.h> | ||
| 18 | #include <linux/device.h> | ||
| 19 | #include <linux/errno.h> | ||
| 20 | #include <linux/i2c.h> | ||
| 21 | #include <linux/interrupt.h> | ||
| 22 | #include <linux/io.h> | ||
| 23 | #include <linux/kernel.h> | ||
| 24 | #include <linux/list.h> | ||
| 25 | #include <linux/module.h> | ||
| 26 | #include <linux/platform_device.h> | ||
| 27 | #include <linux/pm_runtime.h> | ||
| 28 | #include <linux/ratelimit.h> | ||
| 29 | #include <linux/slab.h> | ||
| 30 | #include <linux/types.h> | ||
| 31 | #include <linux/videodev2.h> | ||
| 32 | |||
| 33 | #include <media/media-device.h> | ||
| 34 | #include <media/v4l2-ctrls.h> | ||
| 35 | #include <media/v4l2-event.h> | ||
| 36 | #include <media/v4l2-ioctl.h> | ||
| 37 | #include <media/videobuf2-core.h> | ||
| 38 | #include <media/videobuf2-dma-contig.h> | ||
| 39 | |||
| 40 | #include "camif-core.h" | ||
| 41 | #include "camif-regs.h" | ||
| 42 | |||
| 43 | static int debug; | ||
| 44 | module_param(debug, int, 0644); | ||
| 45 | |||
| 46 | /* Locking: called with vp->camif->slock spinlock held */ | ||
| 47 | static void camif_cfg_video_path(struct camif_vp *vp) | ||
| 48 | { | ||
| 49 | WARN_ON(s3c_camif_get_scaler_config(vp, &vp->scaler)); | ||
| 50 | camif_hw_set_scaler(vp); | ||
| 51 | camif_hw_set_flip(vp); | ||
| 52 | camif_hw_set_target_format(vp); | ||
| 53 | camif_hw_set_output_dma(vp); | ||
| 54 | } | ||
| 55 | |||
| 56 | static void camif_prepare_dma_offset(struct camif_vp *vp) | ||
| 57 | { | ||
| 58 | struct camif_frame *f = &vp->out_frame; | ||
| 59 | |||
| 60 | f->dma_offset.initial = f->rect.top * f->f_width + f->rect.left; | ||
| 61 | f->dma_offset.line = f->f_width - (f->rect.left + f->rect.width); | ||
| 62 | |||
| 63 | pr_debug("dma_offset: initial: %d, line: %d\n", | ||
| 64 | f->dma_offset.initial, f->dma_offset.line); | ||
| 65 | } | ||
| 66 | |||
| 67 | /* Locking: called with camif->slock spinlock held */ | ||
| 68 | static int s3c_camif_hw_init(struct camif_dev *camif, struct camif_vp *vp) | ||
| 69 | { | ||
| 70 | const struct s3c_camif_variant *variant = camif->variant; | ||
| 71 | |||
| 72 | if (camif->sensor.sd == NULL || vp->out_fmt == NULL) | ||
| 73 | return -EINVAL; | ||
| 74 | |||
| 75 | if (variant->ip_revision == S3C244X_CAMIF_IP_REV) | ||
| 76 | camif_hw_clear_fifo_overflow(vp); | ||
| 77 | camif_hw_set_camera_bus(camif); | ||
| 78 | camif_hw_set_source_format(camif); | ||
| 79 | camif_hw_set_camera_crop(camif); | ||
| 80 | camif_hw_set_test_pattern(camif, camif->test_pattern); | ||
| 81 | if (variant->has_img_effect) | ||
| 82 | camif_hw_set_effect(camif, camif->colorfx, | ||
| 83 | camif->colorfx_cb, camif->colorfx_cr); | ||
| 84 | if (variant->ip_revision == S3C6410_CAMIF_IP_REV) | ||
| 85 | camif_hw_set_input_path(vp); | ||
| 86 | camif_cfg_video_path(vp); | ||
| 87 | vp->state &= ~ST_VP_CONFIG; | ||
| 88 | |||
| 89 | return 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | /* | ||
| 93 | * Initialize the video path, only up from the scaler stage. The camera | ||
| 94 | * input interface set up is skipped. This is useful to enable one of the | ||
| 95 | * video paths when the other is already running. | ||
| 96 | * Locking: called with camif->slock spinlock held. | ||
| 97 | */ | ||
| 98 | static int s3c_camif_hw_vp_init(struct camif_dev *camif, struct camif_vp *vp) | ||
| 99 | { | ||
| 100 | unsigned int ip_rev = camif->variant->ip_revision; | ||
| 101 | |||
| 102 | if (vp->out_fmt == NULL) | ||
| 103 | return -EINVAL; | ||
| 104 | |||
| 105 | camif_prepare_dma_offset(vp); | ||
| 106 | if (ip_rev == S3C244X_CAMIF_IP_REV) | ||
| 107 | camif_hw_clear_fifo_overflow(vp); | ||
| 108 | camif_cfg_video_path(vp); | ||
| 109 | vp->state &= ~ST_VP_CONFIG; | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static int sensor_set_power(struct camif_dev *camif, int on) | ||
| 114 | { | ||
| 115 | struct cam_sensor *sensor = &camif->sensor; | ||
| 116 | int err = 0; | ||
| 117 | |||
| 118 | if (!on == camif->sensor.power_count) | ||
| 119 | err = v4l2_subdev_call(sensor->sd, core, s_power, on); | ||
| 120 | if (!err) | ||
| 121 | sensor->power_count += on ? 1 : -1; | ||
| 122 | |||
| 123 | pr_debug("on: %d, power_count: %d, err: %d\n", | ||
| 124 | on, sensor->power_count, err); | ||
| 125 | |||
| 126 | return err; | ||
| 127 | } | ||
| 128 | |||
| 129 | static int sensor_set_streaming(struct camif_dev *camif, int on) | ||
| 130 | { | ||
| 131 | struct cam_sensor *sensor = &camif->sensor; | ||
| 132 | int err = 0; | ||
| 133 | |||
| 134 | if (!on == camif->sensor.stream_count) | ||
| 135 | err = v4l2_subdev_call(sensor->sd, video, s_stream, on); | ||
| 136 | if (!err) | ||
| 137 | sensor->stream_count += on ? 1 : -1; | ||
| 138 | |||
| 139 | pr_debug("on: %d, stream_count: %d, err: %d\n", | ||
| 140 | on, sensor->stream_count, err); | ||
| 141 | |||
| 142 | return err; | ||
| 143 | } | ||
| 144 | |||
| 145 | /* | ||
| 146 | * Reinitialize the driver so it is ready to start streaming again. | ||
| 147 | * Return any buffers to vb2, perform CAMIF software reset and | ||
| 148 | * turn off streaming at the data pipeline (sensor) if required. | ||
| 149 | */ | ||
| 150 | static int camif_reinitialize(struct camif_vp *vp) | ||
| 151 | { | ||
| 152 | struct camif_dev *camif = vp->camif; | ||
| 153 | struct camif_buffer *buf; | ||
| 154 | unsigned long flags; | ||
| 155 | bool streaming; | ||
| 156 | |||
| 157 | spin_lock_irqsave(&camif->slock, flags); | ||
| 158 | streaming = vp->state & ST_VP_SENSOR_STREAMING; | ||
| 159 | |||
| 160 | vp->state &= ~(ST_VP_PENDING | ST_VP_RUNNING | ST_VP_OFF | | ||
| 161 | ST_VP_ABORTING | ST_VP_STREAMING | | ||
| 162 | ST_VP_SENSOR_STREAMING | ST_VP_LASTIRQ); | ||
| 163 | |||
| 164 | /* Release unused buffers */ | ||
| 165 | while (!list_empty(&vp->pending_buf_q)) { | ||
| 166 | buf = camif_pending_queue_pop(vp); | ||
| 167 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); | ||
| 168 | } | ||
| 169 | |||
| 170 | while (!list_empty(&vp->active_buf_q)) { | ||
| 171 | buf = camif_active_queue_pop(vp); | ||
| 172 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); | ||
| 173 | } | ||
| 174 | |||
| 175 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 176 | |||
| 177 | if (!streaming) | ||
| 178 | return 0; | ||
| 179 | |||
| 180 | return sensor_set_streaming(camif, 0); | ||
| 181 | } | ||
| 182 | |||
| 183 | static bool s3c_vp_active(struct camif_vp *vp) | ||
| 184 | { | ||
| 185 | struct camif_dev *camif = vp->camif; | ||
| 186 | unsigned long flags; | ||
| 187 | bool ret; | ||
| 188 | |||
| 189 | spin_lock_irqsave(&camif->slock, flags); | ||
| 190 | ret = (vp->state & ST_VP_RUNNING) || (vp->state & ST_VP_PENDING); | ||
| 191 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 192 | |||
| 193 | return ret; | ||
| 194 | } | ||
| 195 | |||
| 196 | static bool camif_is_streaming(struct camif_dev *camif) | ||
| 197 | { | ||
| 198 | unsigned long flags; | ||
| 199 | bool status; | ||
| 200 | |||
| 201 | spin_lock_irqsave(&camif->slock, flags); | ||
| 202 | status = camif->stream_count > 0; | ||
| 203 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 204 | |||
| 205 | return status; | ||
| 206 | } | ||
| 207 | |||
| 208 | static int camif_stop_capture(struct camif_vp *vp) | ||
| 209 | { | ||
| 210 | struct camif_dev *camif = vp->camif; | ||
| 211 | unsigned long flags; | ||
| 212 | int ret; | ||
| 213 | |||
| 214 | if (!s3c_vp_active(vp)) | ||
| 215 | return 0; | ||
| 216 | |||
| 217 | spin_lock_irqsave(&camif->slock, flags); | ||
| 218 | vp->state &= ~(ST_VP_OFF | ST_VP_LASTIRQ); | ||
| 219 | vp->state |= ST_VP_ABORTING; | ||
| 220 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 221 | |||
| 222 | ret = wait_event_timeout(vp->irq_queue, | ||
| 223 | !(vp->state & ST_VP_ABORTING), | ||
| 224 | msecs_to_jiffies(CAMIF_STOP_TIMEOUT)); | ||
| 225 | |||
| 226 | spin_lock_irqsave(&camif->slock, flags); | ||
| 227 | |||
| 228 | if (ret == 0 && !(vp->state & ST_VP_OFF)) { | ||
| 229 | /* Timed out, forcibly stop capture */ | ||
| 230 | vp->state &= ~(ST_VP_OFF | ST_VP_ABORTING | | ||
| 231 | ST_VP_LASTIRQ); | ||
| 232 | |||
| 233 | camif_hw_disable_capture(vp); | ||
| 234 | camif_hw_enable_scaler(vp, false); | ||
| 235 | } | ||
| 236 | |||
| 237 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 238 | |||
| 239 | return camif_reinitialize(vp); | ||
| 240 | } | ||
| 241 | |||
| 242 | static int camif_prepare_addr(struct camif_vp *vp, struct vb2_buffer *vb, | ||
| 243 | struct camif_addr *paddr) | ||
| 244 | { | ||
| 245 | struct camif_frame *frame = &vp->out_frame; | ||
| 246 | u32 pix_size; | ||
| 247 | |||
| 248 | if (vb == NULL || frame == NULL) | ||
| 249 | return -EINVAL; | ||
| 250 | |||
| 251 | pix_size = frame->rect.width * frame->rect.height; | ||
| 252 | |||
| 253 | pr_debug("colplanes: %d, pix_size: %u\n", | ||
| 254 | vp->out_fmt->colplanes, pix_size); | ||
| 255 | |||
| 256 | paddr->y = vb2_dma_contig_plane_dma_addr(vb, 0); | ||
| 257 | |||
| 258 | switch (vp->out_fmt->colplanes) { | ||
| 259 | case 1: | ||
| 260 | paddr->cb = 0; | ||
| 261 | paddr->cr = 0; | ||
| 262 | break; | ||
| 263 | case 2: | ||
| 264 | /* decompose Y into Y/Cb */ | ||
| 265 | paddr->cb = (u32)(paddr->y + pix_size); | ||
| 266 | paddr->cr = 0; | ||
| 267 | break; | ||
| 268 | case 3: | ||
| 269 | paddr->cb = (u32)(paddr->y + pix_size); | ||
| 270 | /* decompose Y into Y/Cb/Cr */ | ||
| 271 | if (vp->out_fmt->color == IMG_FMT_YCBCR422P) | ||
| 272 | paddr->cr = (u32)(paddr->cb + (pix_size >> 1)); | ||
| 273 | else /* 420 */ | ||
| 274 | paddr->cr = (u32)(paddr->cb + (pix_size >> 2)); | ||
| 275 | |||
| 276 | if (vp->out_fmt->color == IMG_FMT_YCRCB420) | ||
| 277 | swap(paddr->cb, paddr->cr); | ||
| 278 | break; | ||
| 279 | default: | ||
| 280 | return -EINVAL; | ||
| 281 | } | ||
| 282 | |||
| 283 | pr_debug("DMA address: y: %#x cb: %#x cr: %#x\n", | ||
| 284 | paddr->y, paddr->cb, paddr->cr); | ||
| 285 | |||
| 286 | return 0; | ||
| 287 | } | ||
| 288 | |||
| 289 | irqreturn_t s3c_camif_irq_handler(int irq, void *priv) | ||
| 290 | { | ||
| 291 | struct camif_vp *vp = priv; | ||
| 292 | struct camif_dev *camif = vp->camif; | ||
| 293 | unsigned int ip_rev = camif->variant->ip_revision; | ||
| 294 | unsigned int status; | ||
| 295 | |||
| 296 | spin_lock(&camif->slock); | ||
| 297 | |||
| 298 | if (ip_rev == S3C6410_CAMIF_IP_REV) | ||
| 299 | camif_hw_clear_pending_irq(vp); | ||
| 300 | |||
| 301 | status = camif_hw_get_status(vp); | ||
| 302 | |||
| 303 | if (ip_rev == S3C244X_CAMIF_IP_REV && (status & CISTATUS_OVF_MASK)) { | ||
| 304 | camif_hw_clear_fifo_overflow(vp); | ||
| 305 | goto unlock; | ||
| 306 | } | ||
| 307 | |||
| 308 | if (vp->state & ST_VP_ABORTING) { | ||
| 309 | if (vp->state & ST_VP_OFF) { | ||
| 310 | /* Last IRQ */ | ||
| 311 | vp->state &= ~(ST_VP_OFF | ST_VP_ABORTING | | ||
| 312 | ST_VP_LASTIRQ); | ||
| 313 | wake_up(&vp->irq_queue); | ||
| 314 | goto unlock; | ||
| 315 | } else if (vp->state & ST_VP_LASTIRQ) { | ||
| 316 | camif_hw_disable_capture(vp); | ||
| 317 | camif_hw_enable_scaler(vp, false); | ||
| 318 | camif_hw_set_lastirq(vp, false); | ||
| 319 | vp->state |= ST_VP_OFF; | ||
| 320 | } else { | ||
| 321 | /* Disable capture, enable last IRQ */ | ||
| 322 | camif_hw_set_lastirq(vp, true); | ||
| 323 | vp->state |= ST_VP_LASTIRQ; | ||
| 324 | } | ||
| 325 | } | ||
| 326 | |||
| 327 | if (!list_empty(&vp->pending_buf_q) && (vp->state & ST_VP_RUNNING) && | ||
| 328 | !list_empty(&vp->active_buf_q)) { | ||
| 329 | unsigned int index; | ||
| 330 | struct camif_buffer *vbuf; | ||
| 331 | struct timeval *tv; | ||
| 332 | struct timespec ts; | ||
| 333 | /* | ||
| 334 | * Get previous DMA write buffer index: | ||
| 335 | * 0 => DMA buffer 0, 2; | ||
| 336 | * 1 => DMA buffer 1, 3. | ||
| 337 | */ | ||
| 338 | index = (CISTATUS_FRAMECNT(status) + 2) & 1; | ||
| 339 | |||
| 340 | ktime_get_ts(&ts); | ||
| 341 | vbuf = camif_active_queue_peek(vp, index); | ||
| 342 | |||
| 343 | if (!WARN_ON(vbuf == NULL)) { | ||
| 344 | /* Dequeue a filled buffer */ | ||
| 345 | tv = &vbuf->vb.v4l2_buf.timestamp; | ||
| 346 | tv->tv_sec = ts.tv_sec; | ||
| 347 | tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; | ||
| 348 | vbuf->vb.v4l2_buf.sequence = vp->frame_sequence++; | ||
| 349 | vb2_buffer_done(&vbuf->vb, VB2_BUF_STATE_DONE); | ||
| 350 | |||
| 351 | /* Set up an empty buffer at the DMA engine */ | ||
| 352 | vbuf = camif_pending_queue_pop(vp); | ||
| 353 | vbuf->index = index; | ||
| 354 | camif_hw_set_output_addr(vp, &vbuf->paddr, index); | ||
| 355 | camif_hw_set_output_addr(vp, &vbuf->paddr, index + 2); | ||
| 356 | |||
| 357 | /* Scheduled in H/W, add to the queue */ | ||
| 358 | camif_active_queue_add(vp, vbuf); | ||
| 359 | } | ||
| 360 | } else if (!(vp->state & ST_VP_ABORTING) && | ||
| 361 | (vp->state & ST_VP_PENDING)) { | ||
| 362 | vp->state |= ST_VP_RUNNING; | ||
| 363 | } | ||
| 364 | |||
| 365 | if (vp->state & ST_VP_CONFIG) { | ||
| 366 | camif_prepare_dma_offset(vp); | ||
| 367 | camif_hw_set_camera_crop(camif); | ||
| 368 | camif_hw_set_scaler(vp); | ||
| 369 | camif_hw_set_flip(vp); | ||
| 370 | camif_hw_set_test_pattern(camif, camif->test_pattern); | ||
| 371 | if (camif->variant->has_img_effect) | ||
| 372 | camif_hw_set_effect(camif, camif->colorfx, | ||
| 373 | camif->colorfx_cb, camif->colorfx_cr); | ||
| 374 | vp->state &= ~ST_VP_CONFIG; | ||
| 375 | } | ||
| 376 | unlock: | ||
| 377 | spin_unlock(&camif->slock); | ||
| 378 | return IRQ_HANDLED; | ||
| 379 | } | ||
| 380 | |||
| 381 | static int start_streaming(struct vb2_queue *vq, unsigned int count) | ||
| 382 | { | ||
| 383 | struct camif_vp *vp = vb2_get_drv_priv(vq); | ||
| 384 | struct camif_dev *camif = vp->camif; | ||
| 385 | unsigned long flags; | ||
| 386 | int ret; | ||
| 387 | |||
| 388 | /* | ||
| 389 | * We assume the codec capture path is always activated | ||
| 390 | * first, before the preview path starts streaming. | ||
| 391 | * This is required to avoid internal FIFO overflow and | ||
| 392 | * a need for CAMIF software reset. | ||
| 393 | */ | ||
| 394 | spin_lock_irqsave(&camif->slock, flags); | ||
| 395 | |||
| 396 | if (camif->stream_count == 0) { | ||
| 397 | camif_hw_reset(camif); | ||
| 398 | ret = s3c_camif_hw_init(camif, vp); | ||
| 399 | } else { | ||
| 400 | ret = s3c_camif_hw_vp_init(camif, vp); | ||
| 401 | } | ||
| 402 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 403 | |||
| 404 | if (ret < 0) { | ||
| 405 | camif_reinitialize(vp); | ||
| 406 | return ret; | ||
| 407 | } | ||
| 408 | |||
| 409 | spin_lock_irqsave(&camif->slock, flags); | ||
| 410 | vp->frame_sequence = 0; | ||
| 411 | vp->state |= ST_VP_PENDING; | ||
| 412 | |||
| 413 | if (!list_empty(&vp->pending_buf_q) && | ||
| 414 | (!(vp->state & ST_VP_STREAMING) || | ||
| 415 | !(vp->state & ST_VP_SENSOR_STREAMING))) { | ||
| 416 | |||
| 417 | camif_hw_enable_scaler(vp, vp->scaler.enable); | ||
| 418 | camif_hw_enable_capture(vp); | ||
| 419 | vp->state |= ST_VP_STREAMING; | ||
| 420 | |||
| 421 | if (!(vp->state & ST_VP_SENSOR_STREAMING)) { | ||
| 422 | vp->state |= ST_VP_SENSOR_STREAMING; | ||
| 423 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 424 | ret = sensor_set_streaming(camif, 1); | ||
| 425 | if (ret) | ||
| 426 | v4l2_err(&vp->vdev, "Sensor s_stream failed\n"); | ||
| 427 | if (debug) | ||
| 428 | camif_hw_dump_regs(camif, __func__); | ||
| 429 | |||
| 430 | return ret; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | |||
| 434 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | |||
| 438 | static int stop_streaming(struct vb2_queue *vq) | ||
| 439 | { | ||
| 440 | struct camif_vp *vp = vb2_get_drv_priv(vq); | ||
| 441 | return camif_stop_capture(vp); | ||
| 442 | } | ||
| 443 | |||
| 444 | static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | ||
| 445 | unsigned int *num_buffers, unsigned int *num_planes, | ||
| 446 | unsigned int sizes[], void *allocators[]) | ||
| 447 | { | ||
| 448 | const struct v4l2_pix_format *pix = NULL; | ||
| 449 | struct camif_vp *vp = vb2_get_drv_priv(vq); | ||
| 450 | struct camif_dev *camif = vp->camif; | ||
| 451 | struct camif_frame *frame = &vp->out_frame; | ||
| 452 | const struct camif_fmt *fmt = vp->out_fmt; | ||
| 453 | unsigned int size; | ||
| 454 | |||
| 455 | if (pfmt) { | ||
| 456 | pix = &pfmt->fmt.pix; | ||
| 457 | fmt = s3c_camif_find_format(vp, &pix->pixelformat, -1); | ||
| 458 | size = (pix->width * pix->height * fmt->depth) / 8; | ||
| 459 | } else { | ||
| 460 | size = (frame->f_width * frame->f_height * fmt->depth) / 8; | ||
| 461 | } | ||
| 462 | |||
| 463 | if (fmt == NULL) | ||
| 464 | return -EINVAL; | ||
| 465 | *num_planes = 1; | ||
| 466 | |||
| 467 | if (pix) | ||
| 468 | sizes[0] = max(size, pix->sizeimage); | ||
| 469 | else | ||
| 470 | sizes[0] = size; | ||
| 471 | allocators[0] = camif->alloc_ctx; | ||
| 472 | |||
| 473 | pr_debug("size: %u\n", sizes[0]); | ||
| 474 | return 0; | ||
| 475 | } | ||
| 476 | |||
| 477 | static int buffer_prepare(struct vb2_buffer *vb) | ||
| 478 | { | ||
| 479 | struct camif_vp *vp = vb2_get_drv_priv(vb->vb2_queue); | ||
| 480 | |||
| 481 | if (vp->out_fmt == NULL) | ||
| 482 | return -EINVAL; | ||
| 483 | |||
| 484 | if (vb2_plane_size(vb, 0) < vp->payload) { | ||
| 485 | v4l2_err(&vp->vdev, "buffer too small: %lu, required: %u\n", | ||
| 486 | vb2_plane_size(vb, 0), vp->payload); | ||
| 487 | return -EINVAL; | ||
| 488 | } | ||
| 489 | vb2_set_plane_payload(vb, 0, vp->payload); | ||
| 490 | |||
| 491 | return 0; | ||
| 492 | } | ||
| 493 | |||
| 494 | static void buffer_queue(struct vb2_buffer *vb) | ||
| 495 | { | ||
| 496 | struct camif_buffer *buf = container_of(vb, struct camif_buffer, vb); | ||
| 497 | struct camif_vp *vp = vb2_get_drv_priv(vb->vb2_queue); | ||
| 498 | struct camif_dev *camif = vp->camif; | ||
| 499 | unsigned long flags; | ||
| 500 | |||
| 501 | spin_lock_irqsave(&camif->slock, flags); | ||
| 502 | WARN_ON(camif_prepare_addr(vp, &buf->vb, &buf->paddr)); | ||
| 503 | |||
| 504 | if (!(vp->state & ST_VP_STREAMING) && vp->active_buffers < 2) { | ||
| 505 | /* Schedule an empty buffer in H/W */ | ||
| 506 | buf->index = vp->buf_index; | ||
| 507 | |||
| 508 | camif_hw_set_output_addr(vp, &buf->paddr, buf->index); | ||
| 509 | camif_hw_set_output_addr(vp, &buf->paddr, buf->index + 2); | ||
| 510 | |||
| 511 | camif_active_queue_add(vp, buf); | ||
| 512 | vp->buf_index = !vp->buf_index; | ||
| 513 | } else { | ||
| 514 | camif_pending_queue_add(vp, buf); | ||
| 515 | } | ||
| 516 | |||
| 517 | if (vb2_is_streaming(&vp->vb_queue) && !list_empty(&vp->pending_buf_q) | ||
| 518 | && !(vp->state & ST_VP_STREAMING)) { | ||
| 519 | |||
| 520 | vp->state |= ST_VP_STREAMING; | ||
| 521 | camif_hw_enable_scaler(vp, vp->scaler.enable); | ||
| 522 | camif_hw_enable_capture(vp); | ||
| 523 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 524 | |||
| 525 | if (!(vp->state & ST_VP_SENSOR_STREAMING)) { | ||
| 526 | if (sensor_set_streaming(camif, 1) == 0) | ||
| 527 | vp->state |= ST_VP_SENSOR_STREAMING; | ||
| 528 | else | ||
| 529 | v4l2_err(&vp->vdev, "Sensor s_stream failed\n"); | ||
| 530 | |||
| 531 | if (debug) | ||
| 532 | camif_hw_dump_regs(camif, __func__); | ||
| 533 | } | ||
| 534 | return; | ||
| 535 | } | ||
| 536 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 537 | } | ||
| 538 | |||
| 539 | static void camif_lock(struct vb2_queue *vq) | ||
| 540 | { | ||
| 541 | struct camif_vp *vp = vb2_get_drv_priv(vq); | ||
| 542 | mutex_lock(&vp->camif->lock); | ||
| 543 | } | ||
| 544 | |||
| 545 | static void camif_unlock(struct vb2_queue *vq) | ||
| 546 | { | ||
| 547 | struct camif_vp *vp = vb2_get_drv_priv(vq); | ||
| 548 | mutex_unlock(&vp->camif->lock); | ||
| 549 | } | ||
| 550 | |||
| 551 | static const struct vb2_ops s3c_camif_qops = { | ||
| 552 | .queue_setup = queue_setup, | ||
| 553 | .buf_prepare = buffer_prepare, | ||
| 554 | .buf_queue = buffer_queue, | ||
| 555 | .wait_prepare = camif_unlock, | ||
| 556 | .wait_finish = camif_lock, | ||
| 557 | .start_streaming = start_streaming, | ||
| 558 | .stop_streaming = stop_streaming, | ||
| 559 | }; | ||
| 560 | |||
| 561 | static int s3c_camif_open(struct file *file) | ||
| 562 | { | ||
| 563 | struct camif_vp *vp = video_drvdata(file); | ||
| 564 | struct camif_dev *camif = vp->camif; | ||
| 565 | int ret; | ||
| 566 | |||
| 567 | pr_debug("[vp%d] state: %#x, owner: %p, pid: %d\n", vp->id, | ||
| 568 | vp->state, vp->owner, task_pid_nr(current)); | ||
| 569 | |||
| 570 | if (mutex_lock_interruptible(&camif->lock)) | ||
| 571 | return -ERESTARTSYS; | ||
| 572 | |||
| 573 | ret = v4l2_fh_open(file); | ||
| 574 | if (ret < 0) | ||
| 575 | goto unlock; | ||
| 576 | |||
| 577 | ret = pm_runtime_get_sync(camif->dev); | ||
| 578 | if (ret < 0) | ||
| 579 | goto err_pm; | ||
| 580 | |||
| 581 | ret = sensor_set_power(camif, 1); | ||
| 582 | if (!ret) | ||
| 583 | goto unlock; | ||
| 584 | |||
| 585 | pm_runtime_put(camif->dev); | ||
| 586 | err_pm: | ||
| 587 | v4l2_fh_release(file); | ||
| 588 | unlock: | ||
| 589 | mutex_unlock(&camif->lock); | ||
| 590 | return ret; | ||
| 591 | } | ||
| 592 | |||
| 593 | static int s3c_camif_close(struct file *file) | ||
| 594 | { | ||
| 595 | struct camif_vp *vp = video_drvdata(file); | ||
| 596 | struct camif_dev *camif = vp->camif; | ||
| 597 | int ret; | ||
| 598 | |||
| 599 | pr_debug("[vp%d] state: %#x, owner: %p, pid: %d\n", vp->id, | ||
| 600 | vp->state, vp->owner, task_pid_nr(current)); | ||
| 601 | |||
| 602 | mutex_lock(&camif->lock); | ||
| 603 | |||
| 604 | if (vp->owner == file->private_data) { | ||
| 605 | camif_stop_capture(vp); | ||
| 606 | vb2_queue_release(&vp->vb_queue); | ||
| 607 | vp->owner = NULL; | ||
| 608 | } | ||
| 609 | |||
| 610 | sensor_set_power(camif, 0); | ||
| 611 | |||
| 612 | pm_runtime_put(camif->dev); | ||
| 613 | ret = v4l2_fh_release(file); | ||
| 614 | |||
| 615 | mutex_unlock(&camif->lock); | ||
| 616 | return ret; | ||
| 617 | } | ||
| 618 | |||
| 619 | static unsigned int s3c_camif_poll(struct file *file, | ||
| 620 | struct poll_table_struct *wait) | ||
| 621 | { | ||
| 622 | struct camif_vp *vp = video_drvdata(file); | ||
| 623 | struct camif_dev *camif = vp->camif; | ||
| 624 | int ret; | ||
| 625 | |||
| 626 | mutex_lock(&camif->lock); | ||
| 627 | if (vp->owner && vp->owner != file->private_data) | ||
| 628 | ret = -EBUSY; | ||
| 629 | else | ||
| 630 | ret = vb2_poll(&vp->vb_queue, file, wait); | ||
| 631 | |||
| 632 | mutex_unlock(&camif->lock); | ||
| 633 | return ret; | ||
| 634 | } | ||
| 635 | |||
| 636 | static int s3c_camif_mmap(struct file *file, struct vm_area_struct *vma) | ||
| 637 | { | ||
| 638 | struct camif_vp *vp = video_drvdata(file); | ||
| 639 | int ret; | ||
| 640 | |||
| 641 | if (vp->owner && vp->owner != file->private_data) | ||
| 642 | ret = -EBUSY; | ||
| 643 | else | ||
| 644 | ret = vb2_mmap(&vp->vb_queue, vma); | ||
| 645 | |||
| 646 | return ret; | ||
| 647 | } | ||
| 648 | |||
| 649 | static const struct v4l2_file_operations s3c_camif_fops = { | ||
| 650 | .owner = THIS_MODULE, | ||
| 651 | .open = s3c_camif_open, | ||
| 652 | .release = s3c_camif_close, | ||
| 653 | .poll = s3c_camif_poll, | ||
| 654 | .unlocked_ioctl = video_ioctl2, | ||
| 655 | .mmap = s3c_camif_mmap, | ||
| 656 | }; | ||
| 657 | |||
| 658 | /* | ||
| 659 | * Video node IOCTLs | ||
| 660 | */ | ||
| 661 | |||
| 662 | static int s3c_camif_vidioc_querycap(struct file *file, void *priv, | ||
| 663 | struct v4l2_capability *cap) | ||
| 664 | { | ||
| 665 | struct camif_vp *vp = video_drvdata(file); | ||
| 666 | |||
| 667 | strlcpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver)); | ||
| 668 | strlcpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card)); | ||
| 669 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s.%d", | ||
| 670 | dev_name(vp->camif->dev), vp->id); | ||
| 671 | |||
| 672 | cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; | ||
| 673 | cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
| 674 | |||
| 675 | return 0; | ||
| 676 | } | ||
| 677 | |||
| 678 | static int s3c_camif_vidioc_enum_input(struct file *file, void *priv, | ||
| 679 | struct v4l2_input *input) | ||
| 680 | { | ||
| 681 | struct camif_vp *vp = video_drvdata(file); | ||
| 682 | struct v4l2_subdev *sensor = vp->camif->sensor.sd; | ||
| 683 | |||
| 684 | if (input->index || sensor == NULL) | ||
| 685 | return -EINVAL; | ||
| 686 | |||
| 687 | input->type = V4L2_INPUT_TYPE_CAMERA; | ||
| 688 | strlcpy(input->name, sensor->name, sizeof(input->name)); | ||
| 689 | return 0; | ||
| 690 | } | ||
| 691 | |||
| 692 | static int s3c_camif_vidioc_s_input(struct file *file, void *priv, | ||
| 693 | unsigned int i) | ||
| 694 | { | ||
| 695 | return i == 0 ? 0 : -EINVAL; | ||
| 696 | } | ||
| 697 | |||
| 698 | static int s3c_camif_vidioc_g_input(struct file *file, void *priv, | ||
| 699 | unsigned int *i) | ||
| 700 | { | ||
| 701 | *i = 0; | ||
| 702 | return 0; | ||
| 703 | } | ||
| 704 | |||
| 705 | static int s3c_camif_vidioc_enum_fmt(struct file *file, void *priv, | ||
| 706 | struct v4l2_fmtdesc *f) | ||
| 707 | { | ||
| 708 | struct camif_vp *vp = video_drvdata(file); | ||
| 709 | const struct camif_fmt *fmt; | ||
| 710 | |||
| 711 | fmt = s3c_camif_find_format(vp, NULL, f->index); | ||
| 712 | if (!fmt) | ||
| 713 | return -EINVAL; | ||
| 714 | |||
| 715 | strlcpy(f->description, fmt->name, sizeof(f->description)); | ||
| 716 | f->pixelformat = fmt->fourcc; | ||
| 717 | |||
| 718 | pr_debug("fmt(%d): %s\n", f->index, f->description); | ||
| 719 | return 0; | ||
| 720 | } | ||
| 721 | |||
| 722 | static int s3c_camif_vidioc_g_fmt(struct file *file, void *priv, | ||
| 723 | struct v4l2_format *f) | ||
| 724 | { | ||
| 725 | struct camif_vp *vp = video_drvdata(file); | ||
| 726 | struct v4l2_pix_format *pix = &f->fmt.pix; | ||
| 727 | struct camif_frame *frame = &vp->out_frame; | ||
| 728 | const struct camif_fmt *fmt = vp->out_fmt; | ||
| 729 | |||
| 730 | pix->bytesperline = frame->f_width * fmt->ybpp; | ||
| 731 | pix->sizeimage = vp->payload; | ||
| 732 | |||
| 733 | pix->pixelformat = fmt->fourcc; | ||
| 734 | pix->width = frame->f_width; | ||
| 735 | pix->height = frame->f_height; | ||
| 736 | pix->field = V4L2_FIELD_NONE; | ||
| 737 | pix->colorspace = V4L2_COLORSPACE_JPEG; | ||
| 738 | |||
| 739 | return 0; | ||
| 740 | } | ||
| 741 | |||
| 742 | static int __camif_video_try_format(struct camif_vp *vp, | ||
| 743 | struct v4l2_pix_format *pix, | ||
| 744 | const struct camif_fmt **ffmt) | ||
| 745 | { | ||
| 746 | struct camif_dev *camif = vp->camif; | ||
| 747 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 748 | unsigned int wmin, hmin, sc_hrmax, sc_vrmax; | ||
| 749 | const struct vp_pix_limits *pix_lim; | ||
| 750 | const struct camif_fmt *fmt; | ||
| 751 | |||
| 752 | fmt = s3c_camif_find_format(vp, &pix->pixelformat, 0); | ||
| 753 | |||
| 754 | if (WARN_ON(fmt == NULL)) | ||
| 755 | return -EINVAL; | ||
| 756 | |||
| 757 | if (ffmt) | ||
| 758 | *ffmt = fmt; | ||
| 759 | |||
| 760 | pix_lim = &camif->variant->vp_pix_limits[vp->id]; | ||
| 761 | |||
| 762 | pr_debug("fmt: %ux%u, crop: %ux%u, bytesperline: %u\n", | ||
| 763 | pix->width, pix->height, crop->width, crop->height, | ||
| 764 | pix->bytesperline); | ||
| 765 | /* | ||
| 766 | * Calculate minimum width and height according to the configured | ||
| 767 | * camera input interface crop rectangle and the resizer's capabilities. | ||
| 768 | */ | ||
| 769 | sc_hrmax = min(SCALER_MAX_RATIO, 1 << (ffs(crop->width) - 3)); | ||
| 770 | sc_vrmax = min(SCALER_MAX_RATIO, 1 << (ffs(crop->height) - 1)); | ||
| 771 | |||
| 772 | wmin = max_t(u32, pix_lim->min_out_width, crop->width / sc_hrmax); | ||
| 773 | wmin = round_up(wmin, pix_lim->out_width_align); | ||
| 774 | hmin = max_t(u32, 8, crop->height / sc_vrmax); | ||
| 775 | hmin = round_up(hmin, 8); | ||
| 776 | |||
| 777 | v4l_bound_align_image(&pix->width, wmin, pix_lim->max_sc_out_width, | ||
| 778 | ffs(pix_lim->out_width_align) - 1, | ||
| 779 | &pix->height, hmin, pix_lim->max_height, 0, 0); | ||
| 780 | |||
| 781 | pix->bytesperline = pix->width * fmt->ybpp; | ||
| 782 | pix->sizeimage = (pix->width * pix->height * fmt->depth) / 8; | ||
| 783 | pix->pixelformat = fmt->fourcc; | ||
| 784 | pix->colorspace = V4L2_COLORSPACE_JPEG; | ||
| 785 | pix->field = V4L2_FIELD_NONE; | ||
| 786 | |||
| 787 | pr_debug("%ux%u, wmin: %d, hmin: %d, sc_hrmax: %d, sc_vrmax: %d\n", | ||
| 788 | pix->width, pix->height, wmin, hmin, sc_hrmax, sc_vrmax); | ||
| 789 | |||
| 790 | return 0; | ||
| 791 | } | ||
| 792 | |||
| 793 | static int s3c_camif_vidioc_try_fmt(struct file *file, void *priv, | ||
| 794 | struct v4l2_format *f) | ||
| 795 | { | ||
| 796 | struct camif_vp *vp = video_drvdata(file); | ||
| 797 | return __camif_video_try_format(vp, &f->fmt.pix, NULL); | ||
| 798 | } | ||
| 799 | |||
| 800 | static int s3c_camif_vidioc_s_fmt(struct file *file, void *priv, | ||
| 801 | struct v4l2_format *f) | ||
| 802 | { | ||
| 803 | struct v4l2_pix_format *pix = &f->fmt.pix; | ||
| 804 | struct camif_vp *vp = video_drvdata(file); | ||
| 805 | struct camif_frame *out_frame = &vp->out_frame; | ||
| 806 | const struct camif_fmt *fmt = NULL; | ||
| 807 | int ret; | ||
| 808 | |||
| 809 | pr_debug("[vp%d]\n", vp->id); | ||
| 810 | |||
| 811 | if (vb2_is_busy(&vp->vb_queue)) | ||
| 812 | return -EBUSY; | ||
| 813 | |||
| 814 | ret = __camif_video_try_format(vp, &f->fmt.pix, &fmt); | ||
| 815 | if (ret < 0) | ||
| 816 | return ret; | ||
| 817 | |||
| 818 | vp->out_fmt = fmt; | ||
| 819 | vp->payload = pix->sizeimage; | ||
| 820 | out_frame->f_width = pix->width; | ||
| 821 | out_frame->f_height = pix->height; | ||
| 822 | |||
| 823 | /* Reset composition rectangle */ | ||
| 824 | out_frame->rect.width = pix->width; | ||
| 825 | out_frame->rect.height = pix->height; | ||
| 826 | out_frame->rect.left = 0; | ||
| 827 | out_frame->rect.top = 0; | ||
| 828 | |||
| 829 | if (vp->owner == NULL) | ||
| 830 | vp->owner = priv; | ||
| 831 | |||
| 832 | pr_debug("%ux%u. payload: %u. fmt: %s. %d %d. sizeimage: %d. bpl: %d\n", | ||
| 833 | out_frame->f_width, out_frame->f_height, vp->payload, fmt->name, | ||
| 834 | pix->width * pix->height * fmt->depth, fmt->depth, | ||
| 835 | pix->sizeimage, pix->bytesperline); | ||
| 836 | |||
| 837 | return 0; | ||
| 838 | } | ||
| 839 | |||
| 840 | /* Only check pixel formats at the sensor and the camif subdev pads */ | ||
| 841 | static int camif_pipeline_validate(struct camif_dev *camif) | ||
| 842 | { | ||
| 843 | struct v4l2_subdev_format src_fmt; | ||
| 844 | struct media_pad *pad; | ||
| 845 | int ret; | ||
| 846 | |||
| 847 | /* Retrieve format at the sensor subdev source pad */ | ||
| 848 | pad = media_entity_remote_source(&camif->pads[0]); | ||
| 849 | if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV) | ||
| 850 | return -EPIPE; | ||
| 851 | |||
| 852 | src_fmt.pad = pad->index; | ||
| 853 | src_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; | ||
| 854 | ret = v4l2_subdev_call(camif->sensor.sd, pad, get_fmt, NULL, &src_fmt); | ||
| 855 | if (ret < 0 && ret != -ENOIOCTLCMD) | ||
| 856 | return -EPIPE; | ||
| 857 | |||
| 858 | if (src_fmt.format.width != camif->mbus_fmt.width || | ||
| 859 | src_fmt.format.height != camif->mbus_fmt.height || | ||
| 860 | src_fmt.format.code != camif->mbus_fmt.code) | ||
| 861 | return -EPIPE; | ||
| 862 | |||
| 863 | return 0; | ||
| 864 | } | ||
| 865 | |||
| 866 | static int s3c_camif_streamon(struct file *file, void *priv, | ||
| 867 | enum v4l2_buf_type type) | ||
| 868 | { | ||
| 869 | struct camif_vp *vp = video_drvdata(file); | ||
| 870 | struct camif_dev *camif = vp->camif; | ||
| 871 | struct media_entity *sensor = &camif->sensor.sd->entity; | ||
| 872 | int ret; | ||
| 873 | |||
| 874 | pr_debug("[vp%d]\n", vp->id); | ||
| 875 | |||
| 876 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
| 877 | return -EINVAL; | ||
| 878 | |||
| 879 | if (vp->owner && vp->owner != priv) | ||
| 880 | return -EBUSY; | ||
| 881 | |||
| 882 | if (s3c_vp_active(vp)) | ||
| 883 | return 0; | ||
| 884 | |||
| 885 | ret = media_entity_pipeline_start(sensor, camif->m_pipeline); | ||
| 886 | if (ret < 0) | ||
| 887 | return ret; | ||
| 888 | |||
| 889 | ret = camif_pipeline_validate(camif); | ||
| 890 | if (ret < 0) { | ||
| 891 | media_entity_pipeline_stop(sensor); | ||
| 892 | return ret; | ||
| 893 | } | ||
| 894 | |||
| 895 | return vb2_streamon(&vp->vb_queue, type); | ||
| 896 | } | ||
| 897 | |||
| 898 | static int s3c_camif_streamoff(struct file *file, void *priv, | ||
| 899 | enum v4l2_buf_type type) | ||
| 900 | { | ||
| 901 | struct camif_vp *vp = video_drvdata(file); | ||
| 902 | struct camif_dev *camif = vp->camif; | ||
| 903 | int ret; | ||
| 904 | |||
| 905 | pr_debug("[vp%d]\n", vp->id); | ||
| 906 | |||
| 907 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
| 908 | return -EINVAL; | ||
| 909 | |||
| 910 | if (vp->owner && vp->owner != priv) | ||
| 911 | return -EBUSY; | ||
| 912 | |||
| 913 | ret = vb2_streamoff(&vp->vb_queue, type); | ||
| 914 | if (ret == 0) | ||
| 915 | media_entity_pipeline_stop(&camif->sensor.sd->entity); | ||
| 916 | return ret; | ||
| 917 | } | ||
| 918 | |||
| 919 | static int s3c_camif_reqbufs(struct file *file, void *priv, | ||
| 920 | struct v4l2_requestbuffers *rb) | ||
| 921 | { | ||
| 922 | struct camif_vp *vp = video_drvdata(file); | ||
| 923 | int ret; | ||
| 924 | |||
| 925 | pr_debug("[vp%d] rb count: %d, owner: %p, priv: %p\n", | ||
| 926 | vp->id, rb->count, vp->owner, priv); | ||
| 927 | |||
| 928 | if (vp->owner && vp->owner != priv) | ||
| 929 | return -EBUSY; | ||
| 930 | |||
| 931 | if (rb->count) | ||
| 932 | rb->count = max_t(u32, CAMIF_REQ_BUFS_MIN, rb->count); | ||
| 933 | else | ||
| 934 | vp->owner = NULL; | ||
| 935 | |||
| 936 | ret = vb2_reqbufs(&vp->vb_queue, rb); | ||
| 937 | if (!ret) { | ||
| 938 | vp->reqbufs_count = rb->count; | ||
| 939 | if (vp->owner == NULL && rb->count > 0) | ||
| 940 | vp->owner = priv; | ||
| 941 | } | ||
| 942 | |||
| 943 | return ret; | ||
| 944 | } | ||
| 945 | |||
| 946 | static int s3c_camif_querybuf(struct file *file, void *priv, | ||
| 947 | struct v4l2_buffer *buf) | ||
| 948 | { | ||
| 949 | struct camif_vp *vp = video_drvdata(file); | ||
| 950 | return vb2_querybuf(&vp->vb_queue, buf); | ||
| 951 | } | ||
| 952 | |||
| 953 | static int s3c_camif_qbuf(struct file *file, void *priv, | ||
| 954 | struct v4l2_buffer *buf) | ||
| 955 | { | ||
| 956 | struct camif_vp *vp = video_drvdata(file); | ||
| 957 | |||
| 958 | pr_debug("[vp%d]\n", vp->id); | ||
| 959 | |||
| 960 | if (vp->owner && vp->owner != priv) | ||
| 961 | return -EBUSY; | ||
| 962 | |||
| 963 | return vb2_qbuf(&vp->vb_queue, buf); | ||
| 964 | } | ||
| 965 | |||
| 966 | static int s3c_camif_dqbuf(struct file *file, void *priv, | ||
| 967 | struct v4l2_buffer *buf) | ||
| 968 | { | ||
| 969 | struct camif_vp *vp = video_drvdata(file); | ||
| 970 | |||
| 971 | pr_debug("[vp%d] sequence: %d\n", vp->id, vp->frame_sequence); | ||
| 972 | |||
| 973 | if (vp->owner && vp->owner != priv) | ||
| 974 | return -EBUSY; | ||
| 975 | |||
| 976 | return vb2_dqbuf(&vp->vb_queue, buf, file->f_flags & O_NONBLOCK); | ||
| 977 | } | ||
| 978 | |||
| 979 | static int s3c_camif_create_bufs(struct file *file, void *priv, | ||
| 980 | struct v4l2_create_buffers *create) | ||
| 981 | { | ||
| 982 | struct camif_vp *vp = video_drvdata(file); | ||
| 983 | int ret; | ||
| 984 | |||
| 985 | if (vp->owner && vp->owner != priv) | ||
| 986 | return -EBUSY; | ||
| 987 | |||
| 988 | create->count = max_t(u32, 1, create->count); | ||
| 989 | ret = vb2_create_bufs(&vp->vb_queue, create); | ||
| 990 | |||
| 991 | if (!ret && vp->owner == NULL) | ||
| 992 | vp->owner = priv; | ||
| 993 | |||
| 994 | return ret; | ||
| 995 | } | ||
| 996 | |||
| 997 | static int s3c_camif_prepare_buf(struct file *file, void *priv, | ||
| 998 | struct v4l2_buffer *b) | ||
| 999 | { | ||
| 1000 | struct camif_vp *vp = video_drvdata(file); | ||
| 1001 | return vb2_prepare_buf(&vp->vb_queue, b); | ||
| 1002 | } | ||
| 1003 | |||
| 1004 | static int s3c_camif_g_selection(struct file *file, void *priv, | ||
| 1005 | struct v4l2_selection *sel) | ||
| 1006 | { | ||
| 1007 | struct camif_vp *vp = video_drvdata(file); | ||
| 1008 | |||
| 1009 | if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
| 1010 | return -EINVAL; | ||
| 1011 | |||
| 1012 | switch (sel->target) { | ||
| 1013 | case V4L2_SEL_TGT_COMPOSE_BOUNDS: | ||
| 1014 | case V4L2_SEL_TGT_COMPOSE_DEFAULT: | ||
| 1015 | sel->r.left = 0; | ||
| 1016 | sel->r.top = 0; | ||
| 1017 | sel->r.width = vp->out_frame.f_width; | ||
| 1018 | sel->r.height = vp->out_frame.f_height; | ||
| 1019 | return 0; | ||
| 1020 | |||
| 1021 | case V4L2_SEL_TGT_COMPOSE: | ||
| 1022 | sel->r = vp->out_frame.rect; | ||
| 1023 | return 0; | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | return -EINVAL; | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | static void __camif_try_compose(struct camif_dev *camif, struct camif_vp *vp, | ||
| 1030 | struct v4l2_rect *r) | ||
| 1031 | { | ||
| 1032 | /* s3c244x doesn't support composition */ | ||
| 1033 | if (camif->variant->ip_revision == S3C244X_CAMIF_IP_REV) { | ||
| 1034 | *r = vp->out_frame.rect; | ||
| 1035 | return; | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | /* TODO: s3c64xx */ | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | static int s3c_camif_s_selection(struct file *file, void *priv, | ||
| 1042 | struct v4l2_selection *sel) | ||
| 1043 | { | ||
| 1044 | struct camif_vp *vp = video_drvdata(file); | ||
| 1045 | struct camif_dev *camif = vp->camif; | ||
| 1046 | struct v4l2_rect rect = sel->r; | ||
| 1047 | unsigned long flags; | ||
| 1048 | |||
| 1049 | if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | ||
| 1050 | sel->target != V4L2_SEL_TGT_COMPOSE) | ||
| 1051 | return -EINVAL; | ||
| 1052 | |||
| 1053 | __camif_try_compose(camif, vp, &rect); | ||
| 1054 | |||
| 1055 | sel->r = rect; | ||
| 1056 | spin_lock_irqsave(&camif->slock, flags); | ||
| 1057 | vp->out_frame.rect = rect; | ||
| 1058 | vp->state |= ST_VP_CONFIG; | ||
| 1059 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 1060 | |||
| 1061 | pr_debug("type: %#x, target: %#x, flags: %#x, (%d,%d)/%dx%d\n", | ||
| 1062 | sel->type, sel->target, sel->flags, | ||
| 1063 | sel->r.left, sel->r.top, sel->r.width, sel->r.height); | ||
| 1064 | |||
| 1065 | return 0; | ||
| 1066 | } | ||
| 1067 | |||
| 1068 | static const struct v4l2_ioctl_ops s3c_camif_ioctl_ops = { | ||
| 1069 | .vidioc_querycap = s3c_camif_vidioc_querycap, | ||
| 1070 | .vidioc_enum_input = s3c_camif_vidioc_enum_input, | ||
| 1071 | .vidioc_g_input = s3c_camif_vidioc_g_input, | ||
| 1072 | .vidioc_s_input = s3c_camif_vidioc_s_input, | ||
| 1073 | .vidioc_enum_fmt_vid_cap = s3c_camif_vidioc_enum_fmt, | ||
| 1074 | .vidioc_try_fmt_vid_cap = s3c_camif_vidioc_try_fmt, | ||
| 1075 | .vidioc_s_fmt_vid_cap = s3c_camif_vidioc_s_fmt, | ||
| 1076 | .vidioc_g_fmt_vid_cap = s3c_camif_vidioc_g_fmt, | ||
| 1077 | .vidioc_g_selection = s3c_camif_g_selection, | ||
| 1078 | .vidioc_s_selection = s3c_camif_s_selection, | ||
| 1079 | .vidioc_reqbufs = s3c_camif_reqbufs, | ||
| 1080 | .vidioc_querybuf = s3c_camif_querybuf, | ||
| 1081 | .vidioc_prepare_buf = s3c_camif_prepare_buf, | ||
| 1082 | .vidioc_create_bufs = s3c_camif_create_bufs, | ||
| 1083 | .vidioc_qbuf = s3c_camif_qbuf, | ||
| 1084 | .vidioc_dqbuf = s3c_camif_dqbuf, | ||
| 1085 | .vidioc_streamon = s3c_camif_streamon, | ||
| 1086 | .vidioc_streamoff = s3c_camif_streamoff, | ||
| 1087 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
| 1088 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
| 1089 | .vidioc_log_status = v4l2_ctrl_log_status, | ||
| 1090 | }; | ||
| 1091 | |||
| 1092 | /* | ||
| 1093 | * Video node controls | ||
| 1094 | */ | ||
| 1095 | static int s3c_camif_video_s_ctrl(struct v4l2_ctrl *ctrl) | ||
| 1096 | { | ||
| 1097 | struct camif_vp *vp = ctrl->priv; | ||
| 1098 | struct camif_dev *camif = vp->camif; | ||
| 1099 | unsigned long flags; | ||
| 1100 | |||
| 1101 | pr_debug("[vp%d] ctrl: %s, value: %d\n", vp->id, | ||
| 1102 | ctrl->name, ctrl->val); | ||
| 1103 | |||
| 1104 | spin_lock_irqsave(&camif->slock, flags); | ||
| 1105 | |||
| 1106 | switch (ctrl->id) { | ||
| 1107 | case V4L2_CID_HFLIP: | ||
| 1108 | vp->hflip = ctrl->val; | ||
| 1109 | break; | ||
| 1110 | |||
| 1111 | case V4L2_CID_VFLIP: | ||
| 1112 | vp->vflip = ctrl->val; | ||
| 1113 | break; | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | vp->state |= ST_VP_CONFIG; | ||
| 1117 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 1118 | return 0; | ||
| 1119 | } | ||
| 1120 | |||
| 1121 | /* Codec and preview video node control ops */ | ||
| 1122 | static const struct v4l2_ctrl_ops s3c_camif_video_ctrl_ops = { | ||
| 1123 | .s_ctrl = s3c_camif_video_s_ctrl, | ||
| 1124 | }; | ||
| 1125 | |||
| 1126 | int s3c_camif_register_video_node(struct camif_dev *camif, int idx) | ||
| 1127 | { | ||
| 1128 | struct camif_vp *vp = &camif->vp[idx]; | ||
| 1129 | struct vb2_queue *q = &vp->vb_queue; | ||
| 1130 | struct video_device *vfd = &vp->vdev; | ||
| 1131 | struct v4l2_ctrl *ctrl; | ||
| 1132 | int ret; | ||
| 1133 | |||
| 1134 | memset(vfd, 0, sizeof(*vfd)); | ||
| 1135 | snprintf(vfd->name, sizeof(vfd->name), "camif-%s", | ||
| 1136 | vp->id == 0 ? "codec" : "preview"); | ||
| 1137 | |||
| 1138 | vfd->fops = &s3c_camif_fops; | ||
| 1139 | vfd->ioctl_ops = &s3c_camif_ioctl_ops; | ||
| 1140 | vfd->v4l2_dev = &camif->v4l2_dev; | ||
| 1141 | vfd->minor = -1; | ||
| 1142 | vfd->release = video_device_release_empty; | ||
| 1143 | vfd->lock = &camif->lock; | ||
| 1144 | vp->reqbufs_count = 0; | ||
| 1145 | |||
| 1146 | INIT_LIST_HEAD(&vp->pending_buf_q); | ||
| 1147 | INIT_LIST_HEAD(&vp->active_buf_q); | ||
| 1148 | |||
| 1149 | memset(q, 0, sizeof(*q)); | ||
| 1150 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
| 1151 | q->io_modes = VB2_MMAP | VB2_USERPTR; | ||
| 1152 | q->ops = &s3c_camif_qops; | ||
| 1153 | q->mem_ops = &vb2_dma_contig_memops; | ||
| 1154 | q->buf_struct_size = sizeof(struct camif_buffer); | ||
| 1155 | q->drv_priv = vp; | ||
| 1156 | |||
| 1157 | ret = vb2_queue_init(q); | ||
| 1158 | if (ret) | ||
| 1159 | goto err_vd_rel; | ||
| 1160 | |||
| 1161 | vp->pad.flags = MEDIA_PAD_FL_SINK; | ||
| 1162 | ret = media_entity_init(&vfd->entity, 1, &vp->pad, 0); | ||
| 1163 | if (ret) | ||
| 1164 | goto err_vd_rel; | ||
| 1165 | |||
| 1166 | video_set_drvdata(vfd, vp); | ||
| 1167 | set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); | ||
| 1168 | |||
| 1169 | v4l2_ctrl_handler_init(&vp->ctrl_handler, 1); | ||
| 1170 | ctrl = v4l2_ctrl_new_std(&vp->ctrl_handler, &s3c_camif_video_ctrl_ops, | ||
| 1171 | V4L2_CID_HFLIP, 0, 1, 1, 0); | ||
| 1172 | if (ctrl) | ||
| 1173 | ctrl->priv = vp; | ||
| 1174 | ctrl = v4l2_ctrl_new_std(&vp->ctrl_handler, &s3c_camif_video_ctrl_ops, | ||
| 1175 | V4L2_CID_VFLIP, 0, 1, 1, 0); | ||
| 1176 | if (ctrl) | ||
| 1177 | ctrl->priv = vp; | ||
| 1178 | |||
| 1179 | ret = vp->ctrl_handler.error; | ||
| 1180 | if (ret < 0) | ||
| 1181 | goto err_me_cleanup; | ||
| 1182 | |||
| 1183 | vfd->ctrl_handler = &vp->ctrl_handler; | ||
| 1184 | |||
| 1185 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); | ||
| 1186 | if (ret) | ||
| 1187 | goto err_ctrlh_free; | ||
| 1188 | |||
| 1189 | v4l2_info(&camif->v4l2_dev, "registered %s as /dev/%s\n", | ||
| 1190 | vfd->name, video_device_node_name(vfd)); | ||
| 1191 | return 0; | ||
| 1192 | |||
| 1193 | err_ctrlh_free: | ||
| 1194 | v4l2_ctrl_handler_free(&vp->ctrl_handler); | ||
| 1195 | err_me_cleanup: | ||
| 1196 | media_entity_cleanup(&vfd->entity); | ||
| 1197 | err_vd_rel: | ||
| 1198 | video_device_release(vfd); | ||
| 1199 | return ret; | ||
| 1200 | } | ||
| 1201 | |||
| 1202 | void s3c_camif_unregister_video_node(struct camif_dev *camif, int idx) | ||
| 1203 | { | ||
| 1204 | struct video_device *vfd = &camif->vp[idx].vdev; | ||
| 1205 | |||
| 1206 | if (video_is_registered(vfd)) { | ||
| 1207 | video_unregister_device(vfd); | ||
| 1208 | media_entity_cleanup(&vfd->entity); | ||
| 1209 | v4l2_ctrl_handler_free(vfd->ctrl_handler); | ||
| 1210 | } | ||
| 1211 | } | ||
| 1212 | |||
| 1213 | /* Media bus pixel formats supported at the camif input */ | ||
| 1214 | static const enum v4l2_mbus_pixelcode camif_mbus_formats[] = { | ||
| 1215 | V4L2_MBUS_FMT_YUYV8_2X8, | ||
| 1216 | V4L2_MBUS_FMT_YVYU8_2X8, | ||
| 1217 | V4L2_MBUS_FMT_UYVY8_2X8, | ||
| 1218 | V4L2_MBUS_FMT_VYUY8_2X8, | ||
| 1219 | }; | ||
| 1220 | |||
| 1221 | /* | ||
| 1222 | * Camera input interface subdev operations | ||
| 1223 | */ | ||
| 1224 | |||
| 1225 | static int s3c_camif_subdev_enum_mbus_code(struct v4l2_subdev *sd, | ||
| 1226 | struct v4l2_subdev_fh *fh, | ||
| 1227 | struct v4l2_subdev_mbus_code_enum *code) | ||
| 1228 | { | ||
| 1229 | if (code->index >= ARRAY_SIZE(camif_mbus_formats)) | ||
| 1230 | return -EINVAL; | ||
| 1231 | |||
| 1232 | code->code = camif_mbus_formats[code->index]; | ||
| 1233 | return 0; | ||
| 1234 | } | ||
| 1235 | |||
| 1236 | static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd, | ||
| 1237 | struct v4l2_subdev_fh *fh, | ||
| 1238 | struct v4l2_subdev_format *fmt) | ||
| 1239 | { | ||
| 1240 | struct camif_dev *camif = v4l2_get_subdevdata(sd); | ||
| 1241 | struct v4l2_mbus_framefmt *mf = &fmt->format; | ||
| 1242 | |||
| 1243 | if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { | ||
| 1244 | mf = v4l2_subdev_get_try_format(fh, fmt->pad); | ||
| 1245 | fmt->format = *mf; | ||
| 1246 | return 0; | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | mutex_lock(&camif->lock); | ||
| 1250 | |||
| 1251 | switch (fmt->pad) { | ||
| 1252 | case CAMIF_SD_PAD_SINK: | ||
| 1253 | /* full camera input pixel size */ | ||
| 1254 | *mf = camif->mbus_fmt; | ||
| 1255 | break; | ||
| 1256 | |||
| 1257 | case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P: | ||
| 1258 | /* crop rectangle at camera interface input */ | ||
| 1259 | mf->width = camif->camif_crop.width; | ||
| 1260 | mf->height = camif->camif_crop.height; | ||
| 1261 | mf->code = camif->mbus_fmt.code; | ||
| 1262 | break; | ||
| 1263 | } | ||
| 1264 | |||
| 1265 | mutex_unlock(&camif->lock); | ||
| 1266 | mf->colorspace = V4L2_COLORSPACE_JPEG; | ||
| 1267 | return 0; | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | static void __camif_subdev_try_format(struct camif_dev *camif, | ||
| 1271 | struct v4l2_mbus_framefmt *mf, int pad) | ||
| 1272 | { | ||
| 1273 | const struct s3c_camif_variant *variant = camif->variant; | ||
| 1274 | const struct vp_pix_limits *pix_lim; | ||
| 1275 | int i = ARRAY_SIZE(camif_mbus_formats); | ||
| 1276 | |||
| 1277 | /* FIXME: constraints against codec or preview path ? */ | ||
| 1278 | pix_lim = &variant->vp_pix_limits[VP_CODEC]; | ||
| 1279 | |||
| 1280 | while (i-- >= 0) | ||
| 1281 | if (camif_mbus_formats[i] == mf->code) | ||
| 1282 | break; | ||
| 1283 | |||
| 1284 | mf->code = camif_mbus_formats[i]; | ||
| 1285 | |||
| 1286 | if (pad == CAMIF_SD_PAD_SINK) { | ||
| 1287 | v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH, | ||
| 1288 | ffs(pix_lim->out_width_align) - 1, | ||
| 1289 | &mf->height, 8, CAMIF_MAX_PIX_HEIGHT, 0, | ||
| 1290 | 0); | ||
| 1291 | } else { | ||
| 1292 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 1293 | v4l_bound_align_image(&mf->width, 8, crop->width, | ||
| 1294 | ffs(pix_lim->out_width_align) - 1, | ||
| 1295 | &mf->height, 8, crop->height, | ||
| 1296 | 0, 0); | ||
| 1297 | } | ||
| 1298 | |||
| 1299 | v4l2_dbg(1, debug, &camif->subdev, "%ux%u\n", mf->width, mf->height); | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd, | ||
| 1303 | struct v4l2_subdev_fh *fh, | ||
| 1304 | struct v4l2_subdev_format *fmt) | ||
| 1305 | { | ||
| 1306 | struct camif_dev *camif = v4l2_get_subdevdata(sd); | ||
| 1307 | struct v4l2_mbus_framefmt *mf = &fmt->format; | ||
| 1308 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 1309 | int i; | ||
| 1310 | |||
| 1311 | v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %ux%u\n", | ||
| 1312 | fmt->pad, mf->code, mf->width, mf->height); | ||
| 1313 | |||
| 1314 | mf->colorspace = V4L2_COLORSPACE_JPEG; | ||
| 1315 | mutex_lock(&camif->lock); | ||
| 1316 | |||
| 1317 | /* | ||
| 1318 | * No pixel format change at the camera input is allowed | ||
| 1319 | * while streaming. | ||
| 1320 | */ | ||
| 1321 | if (vb2_is_busy(&camif->vp[VP_CODEC].vb_queue) || | ||
| 1322 | vb2_is_busy(&camif->vp[VP_PREVIEW].vb_queue)) { | ||
| 1323 | mutex_unlock(&camif->lock); | ||
| 1324 | return -EBUSY; | ||
| 1325 | } | ||
| 1326 | |||
| 1327 | __camif_subdev_try_format(camif, mf, fmt->pad); | ||
| 1328 | |||
| 1329 | if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { | ||
| 1330 | mf = v4l2_subdev_get_try_format(fh, fmt->pad); | ||
| 1331 | *mf = fmt->format; | ||
| 1332 | mutex_unlock(&camif->lock); | ||
| 1333 | return 0; | ||
| 1334 | } | ||
| 1335 | |||
| 1336 | switch (fmt->pad) { | ||
| 1337 | case CAMIF_SD_PAD_SINK: | ||
| 1338 | camif->mbus_fmt = *mf; | ||
| 1339 | /* Reset sink crop rectangle. */ | ||
| 1340 | crop->width = mf->width; | ||
| 1341 | crop->height = mf->height; | ||
| 1342 | crop->left = 0; | ||
| 1343 | crop->top = 0; | ||
| 1344 | /* | ||
| 1345 | * Reset source format (the camif's crop rectangle) | ||
| 1346 | * and the video output resolution. | ||
| 1347 | */ | ||
| 1348 | for (i = 0; i < CAMIF_VP_NUM; i++) { | ||
| 1349 | struct camif_frame *frame = &camif->vp[i].out_frame; | ||
| 1350 | frame->rect = *crop; | ||
| 1351 | frame->f_width = mf->width; | ||
| 1352 | frame->f_height = mf->height; | ||
| 1353 | } | ||
| 1354 | break; | ||
| 1355 | |||
| 1356 | case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P: | ||
| 1357 | /* Pixel format can be only changed on the sink pad. */ | ||
| 1358 | mf->code = camif->mbus_fmt.code; | ||
| 1359 | mf->width = crop->width; | ||
| 1360 | mf->height = crop->height; | ||
| 1361 | break; | ||
| 1362 | } | ||
| 1363 | |||
| 1364 | mutex_unlock(&camif->lock); | ||
| 1365 | return 0; | ||
| 1366 | } | ||
| 1367 | |||
| 1368 | static int s3c_camif_subdev_get_selection(struct v4l2_subdev *sd, | ||
| 1369 | struct v4l2_subdev_fh *fh, | ||
| 1370 | struct v4l2_subdev_selection *sel) | ||
| 1371 | { | ||
| 1372 | struct camif_dev *camif = v4l2_get_subdevdata(sd); | ||
| 1373 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 1374 | struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt; | ||
| 1375 | |||
| 1376 | if ((sel->target != V4L2_SEL_TGT_CROP && | ||
| 1377 | sel->target != V4L2_SEL_TGT_CROP_BOUNDS) || | ||
| 1378 | sel->pad != CAMIF_SD_PAD_SINK) | ||
| 1379 | return -EINVAL; | ||
| 1380 | |||
| 1381 | if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { | ||
| 1382 | sel->r = *v4l2_subdev_get_try_crop(fh, sel->pad); | ||
| 1383 | return 0; | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | mutex_lock(&camif->lock); | ||
| 1387 | |||
| 1388 | if (sel->target == V4L2_SEL_TGT_CROP) { | ||
| 1389 | sel->r = *crop; | ||
| 1390 | } else { /* crop bounds */ | ||
| 1391 | sel->r.width = mf->width; | ||
| 1392 | sel->r.height = mf->height; | ||
| 1393 | sel->r.left = 0; | ||
| 1394 | sel->r.top = 0; | ||
| 1395 | } | ||
| 1396 | |||
| 1397 | mutex_unlock(&camif->lock); | ||
| 1398 | |||
| 1399 | v4l2_dbg(1, debug, sd, "%s: crop: (%d,%d) %dx%d, size: %ux%u\n", | ||
| 1400 | __func__, crop->left, crop->top, crop->width, | ||
| 1401 | crop->height, mf->width, mf->height); | ||
| 1402 | |||
| 1403 | return 0; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | static void __camif_try_crop(struct camif_dev *camif, struct v4l2_rect *r) | ||
| 1407 | { | ||
| 1408 | struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt; | ||
| 1409 | const struct camif_pix_limits *pix_lim = &camif->variant->pix_limits; | ||
| 1410 | unsigned int left = 2 * r->left; | ||
| 1411 | unsigned int top = 2 * r->top; | ||
| 1412 | |||
| 1413 | /* | ||
| 1414 | * Following constraints must be met: | ||
| 1415 | * - r->width + 2 * r->left = mf->width; | ||
| 1416 | * - r->height + 2 * r->top = mf->height; | ||
| 1417 | * - crop rectangle size and position must be aligned | ||
| 1418 | * to 8 or 2 pixels, depending on SoC version. | ||
| 1419 | */ | ||
| 1420 | v4l_bound_align_image(&r->width, 0, mf->width, | ||
| 1421 | ffs(pix_lim->win_hor_offset_align) - 1, | ||
| 1422 | &r->height, 0, mf->height, 1, 0); | ||
| 1423 | |||
| 1424 | v4l_bound_align_image(&left, 0, mf->width - r->width, | ||
| 1425 | ffs(pix_lim->win_hor_offset_align), | ||
| 1426 | &top, 0, mf->height - r->height, 2, 0); | ||
| 1427 | |||
| 1428 | r->left = left / 2; | ||
| 1429 | r->top = top / 2; | ||
| 1430 | r->width = mf->width - left; | ||
| 1431 | r->height = mf->height - top; | ||
| 1432 | /* | ||
| 1433 | * Make sure we either downscale or upscale both the pixel | ||
| 1434 | * width and height. Just return current crop rectangle if | ||
| 1435 | * this scaler constraint is not met. | ||
| 1436 | */ | ||
| 1437 | if (camif->variant->ip_revision == S3C244X_CAMIF_IP_REV && | ||
| 1438 | camif_is_streaming(camif)) { | ||
| 1439 | unsigned int i; | ||
| 1440 | |||
| 1441 | for (i = 0; i < CAMIF_VP_NUM; i++) { | ||
| 1442 | struct v4l2_rect *or = &camif->vp[i].out_frame.rect; | ||
| 1443 | if ((or->width > r->width) == (or->height > r->height)) | ||
| 1444 | continue; | ||
| 1445 | *r = camif->camif_crop; | ||
| 1446 | pr_debug("Width/height scaling direction limitation\n"); | ||
| 1447 | break; | ||
| 1448 | } | ||
| 1449 | } | ||
| 1450 | |||
| 1451 | v4l2_dbg(1, debug, &camif->v4l2_dev, "crop: (%d,%d)/%dx%d, fmt: %ux%u\n", | ||
| 1452 | r->left, r->top, r->width, r->height, mf->width, mf->height); | ||
| 1453 | } | ||
| 1454 | |||
| 1455 | static int s3c_camif_subdev_set_selection(struct v4l2_subdev *sd, | ||
| 1456 | struct v4l2_subdev_fh *fh, | ||
| 1457 | struct v4l2_subdev_selection *sel) | ||
| 1458 | { | ||
| 1459 | struct camif_dev *camif = v4l2_get_subdevdata(sd); | ||
| 1460 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 1461 | struct camif_scaler scaler; | ||
| 1462 | |||
| 1463 | if (sel->target != V4L2_SEL_TGT_CROP || sel->pad != CAMIF_SD_PAD_SINK) | ||
| 1464 | return -EINVAL; | ||
| 1465 | |||
| 1466 | mutex_lock(&camif->lock); | ||
| 1467 | __camif_try_crop(camif, &sel->r); | ||
| 1468 | |||
| 1469 | if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { | ||
| 1470 | *v4l2_subdev_get_try_crop(fh, sel->pad) = sel->r; | ||
| 1471 | } else { | ||
| 1472 | unsigned long flags; | ||
| 1473 | unsigned int i; | ||
| 1474 | |||
| 1475 | spin_lock_irqsave(&camif->slock, flags); | ||
| 1476 | *crop = sel->r; | ||
| 1477 | |||
| 1478 | for (i = 0; i < CAMIF_VP_NUM; i++) { | ||
| 1479 | struct camif_vp *vp = &camif->vp[i]; | ||
| 1480 | scaler = vp->scaler; | ||
| 1481 | if (s3c_camif_get_scaler_config(vp, &scaler)) | ||
| 1482 | continue; | ||
| 1483 | vp->scaler = scaler; | ||
| 1484 | vp->state |= ST_VP_CONFIG; | ||
| 1485 | } | ||
| 1486 | |||
| 1487 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 1488 | } | ||
| 1489 | mutex_unlock(&camif->lock); | ||
| 1490 | |||
| 1491 | v4l2_dbg(1, debug, sd, "%s: (%d,%d) %dx%d, f_w: %u, f_h: %u\n", | ||
| 1492 | __func__, crop->left, crop->top, crop->width, crop->height, | ||
| 1493 | camif->mbus_fmt.width, camif->mbus_fmt.height); | ||
| 1494 | |||
| 1495 | return 0; | ||
| 1496 | } | ||
| 1497 | |||
| 1498 | static const struct v4l2_subdev_pad_ops s3c_camif_subdev_pad_ops = { | ||
| 1499 | .enum_mbus_code = s3c_camif_subdev_enum_mbus_code, | ||
| 1500 | .get_selection = s3c_camif_subdev_get_selection, | ||
| 1501 | .set_selection = s3c_camif_subdev_set_selection, | ||
| 1502 | .get_fmt = s3c_camif_subdev_get_fmt, | ||
| 1503 | .set_fmt = s3c_camif_subdev_set_fmt, | ||
| 1504 | }; | ||
| 1505 | |||
| 1506 | static struct v4l2_subdev_ops s3c_camif_subdev_ops = { | ||
| 1507 | .pad = &s3c_camif_subdev_pad_ops, | ||
| 1508 | }; | ||
| 1509 | |||
| 1510 | static int s3c_camif_subdev_s_ctrl(struct v4l2_ctrl *ctrl) | ||
| 1511 | { | ||
| 1512 | struct camif_dev *camif = container_of(ctrl->handler, struct camif_dev, | ||
| 1513 | ctrl_handler); | ||
| 1514 | unsigned long flags; | ||
| 1515 | |||
| 1516 | spin_lock_irqsave(&camif->slock, flags); | ||
| 1517 | |||
| 1518 | switch (ctrl->id) { | ||
| 1519 | case V4L2_CID_COLORFX: | ||
| 1520 | camif->colorfx = camif->ctrl_colorfx->val; | ||
| 1521 | /* Set Cb, Cr */ | ||
| 1522 | switch (ctrl->val) { | ||
| 1523 | case V4L2_COLORFX_SEPIA: | ||
| 1524 | camif->colorfx_cb = 115; | ||
| 1525 | camif->colorfx_cr = 145; | ||
| 1526 | break; | ||
| 1527 | case V4L2_COLORFX_SET_CBCR: | ||
| 1528 | camif->colorfx_cb = camif->ctrl_colorfx_cbcr->val >> 8; | ||
| 1529 | camif->colorfx_cr = camif->ctrl_colorfx_cbcr->val & 0xff; | ||
| 1530 | break; | ||
| 1531 | default: | ||
| 1532 | /* for V4L2_COLORFX_BW and others */ | ||
| 1533 | camif->colorfx_cb = 128; | ||
| 1534 | camif->colorfx_cr = 128; | ||
| 1535 | } | ||
| 1536 | break; | ||
| 1537 | case V4L2_CID_TEST_PATTERN: | ||
| 1538 | camif->test_pattern = camif->ctrl_test_pattern->val; | ||
| 1539 | break; | ||
| 1540 | default: | ||
| 1541 | WARN_ON(1); | ||
| 1542 | } | ||
| 1543 | |||
| 1544 | camif->vp[VP_CODEC].state |= ST_VP_CONFIG; | ||
| 1545 | camif->vp[VP_PREVIEW].state |= ST_VP_CONFIG; | ||
| 1546 | spin_unlock_irqrestore(&camif->slock, flags); | ||
| 1547 | |||
| 1548 | return 0; | ||
| 1549 | } | ||
| 1550 | |||
| 1551 | static const struct v4l2_ctrl_ops s3c_camif_subdev_ctrl_ops = { | ||
| 1552 | .s_ctrl = s3c_camif_subdev_s_ctrl, | ||
| 1553 | }; | ||
| 1554 | |||
| 1555 | static const char * const s3c_camif_test_pattern_menu[] = { | ||
| 1556 | "Disabled", | ||
| 1557 | "Color bars", | ||
| 1558 | "Horizontal increment", | ||
| 1559 | "Vertical increment", | ||
| 1560 | }; | ||
| 1561 | |||
| 1562 | int s3c_camif_create_subdev(struct camif_dev *camif) | ||
| 1563 | { | ||
| 1564 | struct v4l2_ctrl_handler *handler = &camif->ctrl_handler; | ||
| 1565 | struct v4l2_subdev *sd = &camif->subdev; | ||
| 1566 | int ret; | ||
| 1567 | |||
| 1568 | v4l2_subdev_init(sd, &s3c_camif_subdev_ops); | ||
| 1569 | sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; | ||
| 1570 | strlcpy(sd->name, "S3C-CAMIF", sizeof(sd->name)); | ||
| 1571 | |||
| 1572 | camif->pads[CAMIF_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; | ||
| 1573 | camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE; | ||
| 1574 | camif->pads[CAMIF_SD_PAD_SOURCE_P].flags = MEDIA_PAD_FL_SOURCE; | ||
| 1575 | |||
| 1576 | ret = media_entity_init(&sd->entity, CAMIF_SD_PADS_NUM, | ||
| 1577 | camif->pads, 0); | ||
| 1578 | if (ret) | ||
| 1579 | return ret; | ||
| 1580 | |||
| 1581 | v4l2_ctrl_handler_init(handler, 3); | ||
| 1582 | camif->ctrl_test_pattern = v4l2_ctrl_new_std_menu_items(handler, | ||
| 1583 | &s3c_camif_subdev_ctrl_ops, V4L2_CID_TEST_PATTERN, | ||
| 1584 | ARRAY_SIZE(s3c_camif_test_pattern_menu) - 1, 0, 0, | ||
| 1585 | s3c_camif_test_pattern_menu); | ||
| 1586 | |||
| 1587 | camif->ctrl_colorfx = v4l2_ctrl_new_std_menu(handler, | ||
| 1588 | &s3c_camif_subdev_ctrl_ops, | ||
| 1589 | V4L2_CID_COLORFX, V4L2_COLORFX_SET_CBCR, | ||
| 1590 | ~0x981f, V4L2_COLORFX_NONE); | ||
| 1591 | |||
| 1592 | camif->ctrl_colorfx_cbcr = v4l2_ctrl_new_std(handler, | ||
| 1593 | &s3c_camif_subdev_ctrl_ops, | ||
| 1594 | V4L2_CID_COLORFX_CBCR, 0, 0xffff, 1, 0); | ||
| 1595 | if (handler->error) { | ||
| 1596 | v4l2_ctrl_handler_free(handler); | ||
| 1597 | media_entity_cleanup(&sd->entity); | ||
| 1598 | return handler->error; | ||
| 1599 | } | ||
| 1600 | |||
| 1601 | v4l2_ctrl_auto_cluster(2, &camif->ctrl_colorfx, | ||
| 1602 | V4L2_COLORFX_SET_CBCR, false); | ||
| 1603 | if (!camif->variant->has_img_effect) { | ||
| 1604 | camif->ctrl_colorfx->flags |= V4L2_CTRL_FLAG_DISABLED; | ||
| 1605 | camif->ctrl_colorfx_cbcr->flags |= V4L2_CTRL_FLAG_DISABLED; | ||
| 1606 | } | ||
| 1607 | sd->ctrl_handler = handler; | ||
| 1608 | v4l2_set_subdevdata(sd, camif); | ||
| 1609 | |||
| 1610 | return 0; | ||
| 1611 | } | ||
| 1612 | |||
| 1613 | void s3c_camif_unregister_subdev(struct camif_dev *camif) | ||
| 1614 | { | ||
| 1615 | struct v4l2_subdev *sd = &camif->subdev; | ||
| 1616 | |||
| 1617 | /* Return if not registered */ | ||
| 1618 | if (v4l2_get_subdevdata(sd) == NULL) | ||
| 1619 | return; | ||
| 1620 | |||
| 1621 | v4l2_device_unregister_subdev(sd); | ||
| 1622 | media_entity_cleanup(&sd->entity); | ||
| 1623 | v4l2_ctrl_handler_free(&camif->ctrl_handler); | ||
| 1624 | v4l2_set_subdevdata(sd, NULL); | ||
| 1625 | } | ||
| 1626 | |||
| 1627 | int s3c_camif_set_defaults(struct camif_dev *camif) | ||
| 1628 | { | ||
| 1629 | unsigned int ip_rev = camif->variant->ip_revision; | ||
| 1630 | int i; | ||
| 1631 | |||
| 1632 | for (i = 0; i < CAMIF_VP_NUM; i++) { | ||
| 1633 | struct camif_vp *vp = &camif->vp[i]; | ||
| 1634 | struct camif_frame *f = &vp->out_frame; | ||
| 1635 | |||
| 1636 | vp->camif = camif; | ||
| 1637 | vp->id = i; | ||
| 1638 | vp->offset = camif->variant->vp_offset; | ||
| 1639 | |||
| 1640 | if (ip_rev == S3C244X_CAMIF_IP_REV) | ||
| 1641 | vp->fmt_flags = i ? FMT_FL_S3C24XX_PREVIEW : | ||
| 1642 | FMT_FL_S3C24XX_CODEC; | ||
| 1643 | else | ||
| 1644 | vp->fmt_flags = FMT_FL_S3C64XX; | ||
| 1645 | |||
| 1646 | vp->out_fmt = s3c_camif_find_format(vp, NULL, 0); | ||
| 1647 | BUG_ON(vp->out_fmt == NULL); | ||
| 1648 | |||
| 1649 | memset(f, 0, sizeof(*f)); | ||
| 1650 | f->f_width = CAMIF_DEF_WIDTH; | ||
| 1651 | f->f_height = CAMIF_DEF_HEIGHT; | ||
| 1652 | f->rect.width = CAMIF_DEF_WIDTH; | ||
| 1653 | f->rect.height = CAMIF_DEF_HEIGHT; | ||
| 1654 | |||
| 1655 | /* Scaler is always enabled */ | ||
| 1656 | vp->scaler.enable = 1; | ||
| 1657 | |||
| 1658 | vp->payload = (f->f_width * f->f_height * | ||
| 1659 | vp->out_fmt->depth) / 8; | ||
| 1660 | } | ||
| 1661 | |||
| 1662 | memset(&camif->mbus_fmt, 0, sizeof(camif->mbus_fmt)); | ||
| 1663 | camif->mbus_fmt.width = CAMIF_DEF_WIDTH; | ||
| 1664 | camif->mbus_fmt.height = CAMIF_DEF_HEIGHT; | ||
| 1665 | camif->mbus_fmt.code = camif_mbus_formats[0]; | ||
| 1666 | |||
| 1667 | memset(&camif->camif_crop, 0, sizeof(camif->camif_crop)); | ||
| 1668 | camif->camif_crop.width = CAMIF_DEF_WIDTH; | ||
| 1669 | camif->camif_crop.height = CAMIF_DEF_HEIGHT; | ||
| 1670 | |||
| 1671 | return 0; | ||
| 1672 | } | ||
diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c new file mode 100644 index 000000000000..e2716c35f8f1 --- /dev/null +++ b/drivers/media/platform/s3c-camif/camif-core.c | |||
| @@ -0,0 +1,662 @@ | |||
| 1 | /* | ||
| 2 | * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
| 5 | * Copyright (C) 2012 Tomasz Figa <tomasz.figa@gmail.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published | ||
| 9 | * by the Free Software Foundation, either version 2 of the License, | ||
| 10 | * or (at your option) any later version. | ||
| 11 | */ | ||
| 12 | #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__ | ||
| 13 | |||
| 14 | #include <linux/bug.h> | ||
| 15 | #include <linux/clk.h> | ||
| 16 | #include <linux/delay.h> | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/errno.h> | ||
| 19 | #include <linux/gpio.h> | ||
| 20 | #include <linux/i2c.h> | ||
| 21 | #include <linux/interrupt.h> | ||
| 22 | #include <linux/io.h> | ||
| 23 | #include <linux/kernel.h> | ||
| 24 | #include <linux/list.h> | ||
| 25 | #include <linux/module.h> | ||
| 26 | #include <linux/platform_device.h> | ||
| 27 | #include <linux/pm_runtime.h> | ||
| 28 | #include <linux/slab.h> | ||
| 29 | #include <linux/types.h> | ||
| 30 | |||
| 31 | #include <media/media-device.h> | ||
| 32 | #include <media/v4l2-ctrls.h> | ||
| 33 | #include <media/v4l2-ioctl.h> | ||
| 34 | #include <media/videobuf2-core.h> | ||
| 35 | #include <media/videobuf2-dma-contig.h> | ||
| 36 | |||
| 37 | #include "camif-core.h" | ||
| 38 | |||
| 39 | static char *camif_clocks[CLK_MAX_NUM] = { | ||
| 40 | /* HCLK CAMIF clock */ | ||
| 41 | [CLK_GATE] = "camif", | ||
| 42 | /* CAMIF / external camera sensor master clock */ | ||
| 43 | [CLK_CAM] = "camera", | ||
| 44 | }; | ||
| 45 | |||
| 46 | static const struct camif_fmt camif_formats[] = { | ||
| 47 | { | ||
| 48 | .name = "YUV 4:2:2 planar, Y/Cb/Cr", | ||
| 49 | .fourcc = V4L2_PIX_FMT_YUV422P, | ||
| 50 | .depth = 16, | ||
| 51 | .ybpp = 1, | ||
| 52 | .color = IMG_FMT_YCBCR422P, | ||
| 53 | .colplanes = 3, | ||
| 54 | .flags = FMT_FL_S3C24XX_CODEC | | ||
| 55 | FMT_FL_S3C64XX, | ||
| 56 | }, { | ||
| 57 | .name = "YUV 4:2:0 planar, Y/Cb/Cr", | ||
| 58 | .fourcc = V4L2_PIX_FMT_YUV420, | ||
| 59 | .depth = 12, | ||
| 60 | .ybpp = 1, | ||
| 61 | .color = IMG_FMT_YCBCR420, | ||
| 62 | .colplanes = 3, | ||
| 63 | .flags = FMT_FL_S3C24XX_CODEC | | ||
| 64 | FMT_FL_S3C64XX, | ||
| 65 | }, { | ||
| 66 | .name = "YVU 4:2:0 planar, Y/Cr/Cb", | ||
| 67 | .fourcc = V4L2_PIX_FMT_YVU420, | ||
| 68 | .depth = 12, | ||
| 69 | .ybpp = 1, | ||
| 70 | .color = IMG_FMT_YCRCB420, | ||
| 71 | .colplanes = 3, | ||
| 72 | .flags = FMT_FL_S3C24XX_CODEC | | ||
| 73 | FMT_FL_S3C64XX, | ||
| 74 | }, { | ||
| 75 | .name = "RGB565, 16 bpp", | ||
| 76 | .fourcc = V4L2_PIX_FMT_RGB565X, | ||
| 77 | .depth = 16, | ||
| 78 | .ybpp = 2, | ||
| 79 | .color = IMG_FMT_RGB565, | ||
| 80 | .colplanes = 1, | ||
| 81 | .flags = FMT_FL_S3C24XX_PREVIEW | | ||
| 82 | FMT_FL_S3C64XX, | ||
| 83 | }, { | ||
| 84 | .name = "XRGB8888, 32 bpp", | ||
| 85 | .fourcc = V4L2_PIX_FMT_RGB32, | ||
| 86 | .depth = 32, | ||
| 87 | .ybpp = 4, | ||
| 88 | .color = IMG_FMT_XRGB8888, | ||
| 89 | .colplanes = 1, | ||
| 90 | .flags = FMT_FL_S3C24XX_PREVIEW | | ||
| 91 | FMT_FL_S3C64XX, | ||
| 92 | }, { | ||
| 93 | .name = "BGR666", | ||
| 94 | .fourcc = V4L2_PIX_FMT_BGR666, | ||
| 95 | .depth = 32, | ||
| 96 | .ybpp = 4, | ||
| 97 | .color = IMG_FMT_RGB666, | ||
| 98 | .colplanes = 1, | ||
| 99 | .flags = FMT_FL_S3C64XX, | ||
| 100 | } | ||
| 101 | }; | ||
| 102 | |||
| 103 | /** | ||
| 104 | * s3c_camif_find_format() - lookup camif color format by fourcc or an index | ||
| 105 | * @pixelformat: fourcc to match, ignored if null | ||
| 106 | * @index: index to the camif_formats array, ignored if negative | ||
| 107 | */ | ||
| 108 | const struct camif_fmt *s3c_camif_find_format(struct camif_vp *vp, | ||
| 109 | const u32 *pixelformat, | ||
| 110 | int index) | ||
| 111 | { | ||
| 112 | const struct camif_fmt *fmt, *def_fmt = NULL; | ||
| 113 | unsigned int i; | ||
| 114 | int id = 0; | ||
| 115 | |||
| 116 | if (index >= (int)ARRAY_SIZE(camif_formats)) | ||
| 117 | return NULL; | ||
| 118 | |||
| 119 | for (i = 0; i < ARRAY_SIZE(camif_formats); ++i) { | ||
| 120 | fmt = &camif_formats[i]; | ||
| 121 | if (vp && !(vp->fmt_flags & fmt->flags)) | ||
| 122 | continue; | ||
| 123 | if (pixelformat && fmt->fourcc == *pixelformat) | ||
| 124 | return fmt; | ||
| 125 | if (index == id) | ||
| 126 | def_fmt = fmt; | ||
| 127 | id++; | ||
| 128 | } | ||
| 129 | return def_fmt; | ||
| 130 | } | ||
| 131 | |||
| 132 | static int camif_get_scaler_factor(u32 src, u32 tar, u32 *ratio, u32 *shift) | ||
| 133 | { | ||
| 134 | unsigned int sh = 6; | ||
| 135 | |||
| 136 | if (src >= 64 * tar) | ||
| 137 | return -EINVAL; | ||
| 138 | |||
| 139 | while (sh--) { | ||
| 140 | unsigned int tmp = 1 << sh; | ||
| 141 | if (src >= tar * tmp) { | ||
| 142 | *shift = sh, *ratio = tmp; | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | } | ||
| 146 | *shift = 0, *ratio = 1; | ||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | |||
| 150 | int s3c_camif_get_scaler_config(struct camif_vp *vp, | ||
| 151 | struct camif_scaler *scaler) | ||
| 152 | { | ||
| 153 | struct v4l2_rect *camif_crop = &vp->camif->camif_crop; | ||
| 154 | int source_x = camif_crop->width; | ||
| 155 | int source_y = camif_crop->height; | ||
| 156 | int target_x = vp->out_frame.rect.width; | ||
| 157 | int target_y = vp->out_frame.rect.height; | ||
| 158 | int ret; | ||
| 159 | |||
| 160 | if (vp->rotation == 90 || vp->rotation == 270) | ||
| 161 | swap(target_x, target_y); | ||
| 162 | |||
| 163 | ret = camif_get_scaler_factor(source_x, target_x, &scaler->pre_h_ratio, | ||
| 164 | &scaler->h_shift); | ||
| 165 | if (ret < 0) | ||
| 166 | return ret; | ||
| 167 | |||
| 168 | ret = camif_get_scaler_factor(source_y, target_y, &scaler->pre_v_ratio, | ||
| 169 | &scaler->v_shift); | ||
| 170 | if (ret < 0) | ||
| 171 | return ret; | ||
| 172 | |||
| 173 | scaler->pre_dst_width = source_x / scaler->pre_h_ratio; | ||
| 174 | scaler->pre_dst_height = source_y / scaler->pre_v_ratio; | ||
| 175 | |||
| 176 | scaler->main_h_ratio = (source_x << 8) / (target_x << scaler->h_shift); | ||
| 177 | scaler->main_v_ratio = (source_y << 8) / (target_y << scaler->v_shift); | ||
| 178 | |||
| 179 | scaler->scaleup_h = (target_x >= source_x); | ||
| 180 | scaler->scaleup_v = (target_y >= source_y); | ||
| 181 | |||
| 182 | scaler->copy = 0; | ||
| 183 | |||
| 184 | pr_debug("H: ratio: %u, shift: %u. V: ratio: %u, shift: %u.\n", | ||
| 185 | scaler->pre_h_ratio, scaler->h_shift, | ||
| 186 | scaler->pre_v_ratio, scaler->v_shift); | ||
| 187 | |||
| 188 | pr_debug("Source: %dx%d, Target: %dx%d, scaleup_h/v: %d/%d\n", | ||
| 189 | source_x, source_y, target_x, target_y, | ||
| 190 | scaler->scaleup_h, scaler->scaleup_v); | ||
| 191 | |||
| 192 | return 0; | ||
| 193 | } | ||
| 194 | |||
| 195 | static int camif_register_sensor(struct camif_dev *camif) | ||
| 196 | { | ||
| 197 | struct s3c_camif_sensor_info *sensor = &camif->pdata.sensor; | ||
| 198 | struct v4l2_device *v4l2_dev = &camif->v4l2_dev; | ||
| 199 | struct i2c_adapter *adapter; | ||
| 200 | struct v4l2_subdev_format format; | ||
| 201 | struct v4l2_subdev *sd; | ||
| 202 | int ret; | ||
| 203 | |||
| 204 | camif->sensor.sd = NULL; | ||
| 205 | |||
| 206 | if (sensor->i2c_board_info.addr == 0) | ||
| 207 | return -EINVAL; | ||
| 208 | |||
| 209 | adapter = i2c_get_adapter(sensor->i2c_bus_num); | ||
| 210 | if (adapter == NULL) { | ||
| 211 | v4l2_warn(v4l2_dev, "failed to get I2C adapter %d\n", | ||
| 212 | sensor->i2c_bus_num); | ||
| 213 | return -EPROBE_DEFER; | ||
| 214 | } | ||
| 215 | |||
| 216 | sd = v4l2_i2c_new_subdev_board(v4l2_dev, adapter, | ||
| 217 | &sensor->i2c_board_info, NULL); | ||
| 218 | if (sd == NULL) { | ||
| 219 | i2c_put_adapter(adapter); | ||
| 220 | v4l2_warn(v4l2_dev, "failed to acquire subdev %s\n", | ||
| 221 | sensor->i2c_board_info.type); | ||
| 222 | return -EPROBE_DEFER; | ||
| 223 | } | ||
| 224 | camif->sensor.sd = sd; | ||
| 225 | |||
| 226 | v4l2_info(v4l2_dev, "registered sensor subdevice %s\n", sd->name); | ||
| 227 | |||
| 228 | /* Get initial pixel format and set it at the camif sink pad */ | ||
| 229 | format.pad = 0; | ||
| 230 | format.which = V4L2_SUBDEV_FORMAT_ACTIVE; | ||
| 231 | ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &format); | ||
| 232 | |||
| 233 | if (ret < 0) | ||
| 234 | return 0; | ||
| 235 | |||
| 236 | format.pad = CAMIF_SD_PAD_SINK; | ||
| 237 | v4l2_subdev_call(&camif->subdev, pad, set_fmt, NULL, &format); | ||
| 238 | |||
| 239 | v4l2_info(sd, "Initial format from sensor: %dx%d, %#x\n", | ||
| 240 | format.format.width, format.format.height, | ||
| 241 | format.format.code); | ||
| 242 | return 0; | ||
| 243 | } | ||
| 244 | |||
| 245 | static void camif_unregister_sensor(struct camif_dev *camif) | ||
| 246 | { | ||
| 247 | struct v4l2_subdev *sd = camif->sensor.sd; | ||
| 248 | struct i2c_client *client = sd ? v4l2_get_subdevdata(sd) : NULL; | ||
| 249 | struct i2c_adapter *adapter; | ||
| 250 | |||
| 251 | if (client == NULL) | ||
| 252 | return; | ||
| 253 | |||
| 254 | adapter = client->adapter; | ||
| 255 | v4l2_device_unregister_subdev(sd); | ||
| 256 | camif->sensor.sd = NULL; | ||
| 257 | i2c_unregister_device(client); | ||
| 258 | if (adapter) | ||
| 259 | i2c_put_adapter(adapter); | ||
| 260 | } | ||
| 261 | |||
| 262 | static int camif_create_media_links(struct camif_dev *camif) | ||
| 263 | { | ||
| 264 | int i, ret; | ||
| 265 | |||
| 266 | ret = media_entity_create_link(&camif->sensor.sd->entity, 0, | ||
| 267 | &camif->subdev.entity, CAMIF_SD_PAD_SINK, | ||
| 268 | MEDIA_LNK_FL_IMMUTABLE | | ||
| 269 | MEDIA_LNK_FL_ENABLED); | ||
| 270 | if (ret) | ||
| 271 | return ret; | ||
| 272 | |||
| 273 | for (i = 1; i < CAMIF_SD_PADS_NUM && !ret; i++) { | ||
| 274 | ret = media_entity_create_link(&camif->subdev.entity, i, | ||
| 275 | &camif->vp[i - 1].vdev.entity, 0, | ||
| 276 | MEDIA_LNK_FL_IMMUTABLE | | ||
| 277 | MEDIA_LNK_FL_ENABLED); | ||
| 278 | } | ||
| 279 | |||
| 280 | return ret; | ||
| 281 | } | ||
| 282 | |||
| 283 | static int camif_register_video_nodes(struct camif_dev *camif) | ||
| 284 | { | ||
| 285 | int ret = s3c_camif_register_video_node(camif, VP_CODEC); | ||
| 286 | if (ret < 0) | ||
| 287 | return ret; | ||
| 288 | |||
| 289 | return s3c_camif_register_video_node(camif, VP_PREVIEW); | ||
| 290 | } | ||
| 291 | |||
| 292 | static void camif_unregister_video_nodes(struct camif_dev *camif) | ||
| 293 | { | ||
| 294 | s3c_camif_unregister_video_node(camif, VP_CODEC); | ||
| 295 | s3c_camif_unregister_video_node(camif, VP_PREVIEW); | ||
| 296 | } | ||
| 297 | |||
| 298 | static void camif_unregister_media_entities(struct camif_dev *camif) | ||
| 299 | { | ||
| 300 | camif_unregister_video_nodes(camif); | ||
| 301 | camif_unregister_sensor(camif); | ||
| 302 | s3c_camif_unregister_subdev(camif); | ||
| 303 | } | ||
| 304 | |||
| 305 | /* | ||
| 306 | * Media device | ||
| 307 | */ | ||
| 308 | static int camif_media_dev_register(struct camif_dev *camif) | ||
| 309 | { | ||
| 310 | struct media_device *md = &camif->media_dev; | ||
| 311 | struct v4l2_device *v4l2_dev = &camif->v4l2_dev; | ||
| 312 | unsigned int ip_rev = camif->variant->ip_revision; | ||
| 313 | int ret; | ||
| 314 | |||
| 315 | memset(md, 0, sizeof(*md)); | ||
| 316 | snprintf(md->model, sizeof(md->model), "SAMSUNG S3C%s CAMIF", | ||
| 317 | ip_rev == S3C6410_CAMIF_IP_REV ? "6410" : "244X"); | ||
| 318 | strlcpy(md->bus_info, "platform", sizeof(md->bus_info)); | ||
| 319 | md->hw_revision = ip_rev; | ||
| 320 | md->driver_version = KERNEL_VERSION(1, 0, 0); | ||
| 321 | |||
| 322 | md->dev = camif->dev; | ||
| 323 | |||
| 324 | strlcpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name)); | ||
| 325 | v4l2_dev->mdev = md; | ||
| 326 | |||
| 327 | ret = v4l2_device_register(camif->dev, v4l2_dev); | ||
| 328 | if (ret < 0) | ||
| 329 | return ret; | ||
| 330 | |||
| 331 | ret = media_device_register(md); | ||
| 332 | if (ret < 0) | ||
| 333 | v4l2_device_unregister(v4l2_dev); | ||
| 334 | |||
| 335 | return ret; | ||
| 336 | } | ||
| 337 | |||
| 338 | static void camif_clk_put(struct camif_dev *camif) | ||
| 339 | { | ||
| 340 | int i; | ||
| 341 | |||
| 342 | for (i = 0; i < CLK_MAX_NUM; i++) { | ||
| 343 | if (IS_ERR_OR_NULL(camif->clock[i])) | ||
| 344 | continue; | ||
| 345 | clk_unprepare(camif->clock[i]); | ||
| 346 | clk_put(camif->clock[i]); | ||
| 347 | } | ||
| 348 | } | ||
| 349 | |||
| 350 | static int camif_clk_get(struct camif_dev *camif) | ||
| 351 | { | ||
| 352 | int ret, i; | ||
| 353 | |||
| 354 | for (i = 0; i < CLK_MAX_NUM; i++) { | ||
| 355 | camif->clock[i] = clk_get(camif->dev, camif_clocks[i]); | ||
| 356 | if (IS_ERR(camif->clock[i])) { | ||
| 357 | ret = PTR_ERR(camif->clock[i]); | ||
| 358 | goto err; | ||
| 359 | } | ||
| 360 | ret = clk_prepare(camif->clock[i]); | ||
| 361 | if (ret < 0) { | ||
| 362 | clk_put(camif->clock[i]); | ||
| 363 | camif->clock[i] = NULL; | ||
| 364 | goto err; | ||
| 365 | } | ||
| 366 | } | ||
| 367 | return 0; | ||
| 368 | err: | ||
| 369 | camif_clk_put(camif); | ||
| 370 | dev_err(camif->dev, "failed to get clock: %s\n", | ||
| 371 | camif_clocks[i]); | ||
| 372 | return ret; | ||
| 373 | } | ||
| 374 | |||
| 375 | /* | ||
| 376 | * The CAMIF device has two relatively independent data processing paths | ||
| 377 | * that can source data from memory or the common camera input frontend. | ||
| 378 | * Register interrupts for each data processing path (camif_vp). | ||
| 379 | */ | ||
| 380 | static int camif_request_irqs(struct platform_device *pdev, | ||
| 381 | struct camif_dev *camif) | ||
| 382 | { | ||
| 383 | int irq, ret, i; | ||
| 384 | |||
| 385 | for (i = 0; i < CAMIF_VP_NUM; i++) { | ||
| 386 | struct camif_vp *vp = &camif->vp[i]; | ||
| 387 | |||
| 388 | init_waitqueue_head(&vp->irq_queue); | ||
| 389 | |||
| 390 | irq = platform_get_irq(pdev, i); | ||
| 391 | if (irq <= 0) { | ||
| 392 | dev_err(&pdev->dev, "failed to get IRQ %d\n", i); | ||
| 393 | return -ENXIO; | ||
| 394 | } | ||
| 395 | |||
| 396 | ret = devm_request_irq(&pdev->dev, irq, s3c_camif_irq_handler, | ||
| 397 | 0, dev_name(&pdev->dev), vp); | ||
| 398 | if (ret < 0) { | ||
| 399 | dev_err(&pdev->dev, "failed to install IRQ: %d\n", ret); | ||
| 400 | break; | ||
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 | return ret; | ||
| 405 | } | ||
| 406 | |||
| 407 | static int s3c_camif_probe(struct platform_device *pdev) | ||
| 408 | { | ||
| 409 | struct device *dev = &pdev->dev; | ||
| 410 | struct s3c_camif_plat_data *pdata = dev->platform_data; | ||
| 411 | struct s3c_camif_drvdata *drvdata; | ||
| 412 | struct camif_dev *camif; | ||
| 413 | struct resource *mres; | ||
| 414 | int ret = 0; | ||
| 415 | |||
| 416 | camif = devm_kzalloc(dev, sizeof(*camif), GFP_KERNEL); | ||
| 417 | if (!camif) | ||
| 418 | return -ENOMEM; | ||
| 419 | |||
| 420 | spin_lock_init(&camif->slock); | ||
| 421 | mutex_init(&camif->lock); | ||
| 422 | |||
| 423 | camif->dev = dev; | ||
| 424 | |||
| 425 | if (!pdata || !pdata->gpio_get || !pdata->gpio_put) { | ||
| 426 | dev_err(dev, "wrong platform data\n"); | ||
| 427 | return -EINVAL; | ||
| 428 | } | ||
| 429 | |||
| 430 | camif->pdata = *pdata; | ||
| 431 | drvdata = (void *)platform_get_device_id(pdev)->driver_data; | ||
| 432 | camif->variant = drvdata->variant; | ||
| 433 | |||
| 434 | mres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 435 | |||
| 436 | camif->io_base = devm_request_and_ioremap(dev, mres); | ||
| 437 | if (!camif->io_base) { | ||
| 438 | dev_err(dev, "failed to obtain I/O memory\n"); | ||
| 439 | return -ENOENT; | ||
| 440 | } | ||
| 441 | |||
| 442 | ret = camif_request_irqs(pdev, camif); | ||
| 443 | if (ret < 0) | ||
| 444 | return ret; | ||
| 445 | |||
| 446 | ret = pdata->gpio_get(); | ||
| 447 | if (ret < 0) | ||
| 448 | return ret; | ||
| 449 | |||
| 450 | ret = s3c_camif_create_subdev(camif); | ||
| 451 | if (ret < 0) | ||
| 452 | goto err_sd; | ||
| 453 | |||
| 454 | ret = camif_clk_get(camif); | ||
| 455 | if (ret < 0) | ||
| 456 | goto err_clk; | ||
| 457 | |||
| 458 | platform_set_drvdata(pdev, camif); | ||
| 459 | clk_set_rate(camif->clock[CLK_CAM], | ||
| 460 | camif->pdata.sensor.clock_frequency); | ||
| 461 | |||
| 462 | dev_info(dev, "sensor clock frequency: %lu\n", | ||
| 463 | clk_get_rate(camif->clock[CLK_CAM])); | ||
| 464 | /* | ||
| 465 | * Set initial pixel format, resolution and crop rectangle. | ||
| 466 | * Must be done before a sensor subdev is registered as some | ||
| 467 | * settings are overrode with values from sensor subdev. | ||
| 468 | */ | ||
| 469 | s3c_camif_set_defaults(camif); | ||
| 470 | |||
| 471 | pm_runtime_enable(dev); | ||
| 472 | |||
| 473 | ret = pm_runtime_get_sync(dev); | ||
| 474 | if (ret < 0) | ||
| 475 | goto err_pm; | ||
| 476 | |||
| 477 | /* Initialize contiguous memory allocator */ | ||
| 478 | camif->alloc_ctx = vb2_dma_contig_init_ctx(dev); | ||
| 479 | if (IS_ERR(camif->alloc_ctx)) { | ||
| 480 | ret = PTR_ERR(camif->alloc_ctx); | ||
| 481 | goto err_alloc; | ||
| 482 | } | ||
| 483 | |||
| 484 | ret = camif_media_dev_register(camif); | ||
| 485 | if (ret < 0) | ||
| 486 | goto err_mdev; | ||
| 487 | |||
| 488 | ret = camif_register_sensor(camif); | ||
| 489 | if (ret < 0) | ||
| 490 | goto err_sens; | ||
| 491 | |||
| 492 | ret = v4l2_device_register_subdev(&camif->v4l2_dev, &camif->subdev); | ||
| 493 | if (ret < 0) | ||
| 494 | goto err_sens; | ||
| 495 | |||
| 496 | mutex_lock(&camif->media_dev.graph_mutex); | ||
| 497 | |||
| 498 | ret = v4l2_device_register_subdev_nodes(&camif->v4l2_dev); | ||
| 499 | if (ret < 0) | ||
| 500 | goto err_unlock; | ||
| 501 | |||
| 502 | ret = camif_register_video_nodes(camif); | ||
| 503 | if (ret < 0) | ||
| 504 | goto err_unlock; | ||
| 505 | |||
| 506 | ret = camif_create_media_links(camif); | ||
| 507 | if (ret < 0) | ||
| 508 | goto err_unlock; | ||
| 509 | |||
| 510 | mutex_unlock(&camif->media_dev.graph_mutex); | ||
| 511 | pm_runtime_put(dev); | ||
| 512 | return 0; | ||
| 513 | |||
| 514 | err_unlock: | ||
| 515 | mutex_unlock(&camif->media_dev.graph_mutex); | ||
| 516 | err_sens: | ||
| 517 | v4l2_device_unregister(&camif->v4l2_dev); | ||
| 518 | media_device_unregister(&camif->media_dev); | ||
| 519 | camif_unregister_media_entities(camif); | ||
| 520 | err_mdev: | ||
| 521 | vb2_dma_contig_cleanup_ctx(camif->alloc_ctx); | ||
| 522 | err_alloc: | ||
| 523 | pm_runtime_put(dev); | ||
| 524 | pm_runtime_disable(dev); | ||
| 525 | err_pm: | ||
| 526 | camif_clk_put(camif); | ||
| 527 | err_clk: | ||
| 528 | s3c_camif_unregister_subdev(camif); | ||
| 529 | err_sd: | ||
| 530 | pdata->gpio_put(); | ||
| 531 | return ret; | ||
| 532 | } | ||
| 533 | |||
| 534 | static int s3c_camif_remove(struct platform_device *pdev) | ||
| 535 | { | ||
| 536 | struct camif_dev *camif = platform_get_drvdata(pdev); | ||
| 537 | struct s3c_camif_plat_data *pdata = &camif->pdata; | ||
| 538 | |||
| 539 | media_device_unregister(&camif->media_dev); | ||
| 540 | camif_unregister_media_entities(camif); | ||
| 541 | v4l2_device_unregister(&camif->v4l2_dev); | ||
| 542 | |||
| 543 | pm_runtime_disable(&pdev->dev); | ||
| 544 | camif_clk_put(camif); | ||
| 545 | pdata->gpio_put(); | ||
| 546 | |||
| 547 | return 0; | ||
| 548 | } | ||
| 549 | |||
| 550 | static int s3c_camif_runtime_resume(struct device *dev) | ||
| 551 | { | ||
| 552 | struct camif_dev *camif = dev_get_drvdata(dev); | ||
| 553 | |||
| 554 | clk_enable(camif->clock[CLK_GATE]); | ||
| 555 | /* null op on s3c244x */ | ||
| 556 | clk_enable(camif->clock[CLK_CAM]); | ||
| 557 | return 0; | ||
| 558 | } | ||
| 559 | |||
| 560 | static int s3c_camif_runtime_suspend(struct device *dev) | ||
| 561 | { | ||
| 562 | struct camif_dev *camif = dev_get_drvdata(dev); | ||
| 563 | |||
| 564 | /* null op on s3c244x */ | ||
| 565 | clk_disable(camif->clock[CLK_CAM]); | ||
| 566 | |||
| 567 | clk_disable(camif->clock[CLK_GATE]); | ||
| 568 | return 0; | ||
| 569 | } | ||
| 570 | |||
| 571 | static const struct s3c_camif_variant s3c244x_camif_variant = { | ||
| 572 | .vp_pix_limits = { | ||
| 573 | [VP_CODEC] = { | ||
| 574 | .max_out_width = 4096, | ||
| 575 | .max_sc_out_width = 2048, | ||
| 576 | .out_width_align = 16, | ||
| 577 | .min_out_width = 16, | ||
| 578 | .max_height = 4096, | ||
| 579 | }, | ||
| 580 | [VP_PREVIEW] = { | ||
| 581 | .max_out_width = 640, | ||
| 582 | .max_sc_out_width = 640, | ||
| 583 | .out_width_align = 16, | ||
| 584 | .min_out_width = 16, | ||
| 585 | .max_height = 480, | ||
| 586 | } | ||
| 587 | }, | ||
| 588 | .pix_limits = { | ||
| 589 | .win_hor_offset_align = 8, | ||
| 590 | }, | ||
| 591 | .ip_revision = S3C244X_CAMIF_IP_REV, | ||
| 592 | }; | ||
| 593 | |||
| 594 | static struct s3c_camif_drvdata s3c244x_camif_drvdata = { | ||
| 595 | .variant = &s3c244x_camif_variant, | ||
| 596 | .bus_clk_freq = 24000000UL, | ||
| 597 | }; | ||
| 598 | |||
| 599 | static const struct s3c_camif_variant s3c6410_camif_variant = { | ||
| 600 | .vp_pix_limits = { | ||
| 601 | [VP_CODEC] = { | ||
| 602 | .max_out_width = 4096, | ||
| 603 | .max_sc_out_width = 2048, | ||
| 604 | .out_width_align = 16, | ||
| 605 | .min_out_width = 16, | ||
| 606 | .max_height = 4096, | ||
| 607 | }, | ||
| 608 | [VP_PREVIEW] = { | ||
| 609 | .max_out_width = 4096, | ||
| 610 | .max_sc_out_width = 720, | ||
| 611 | .out_width_align = 16, | ||
| 612 | .min_out_width = 16, | ||
| 613 | .max_height = 4096, | ||
| 614 | } | ||
| 615 | }, | ||
| 616 | .pix_limits = { | ||
| 617 | .win_hor_offset_align = 8, | ||
| 618 | }, | ||
| 619 | .ip_revision = S3C6410_CAMIF_IP_REV, | ||
| 620 | .has_img_effect = 1, | ||
| 621 | .vp_offset = 0x20, | ||
| 622 | }; | ||
| 623 | |||
| 624 | static struct s3c_camif_drvdata s3c6410_camif_drvdata = { | ||
| 625 | .variant = &s3c6410_camif_variant, | ||
| 626 | .bus_clk_freq = 133000000UL, | ||
| 627 | }; | ||
| 628 | |||
| 629 | static struct platform_device_id s3c_camif_driver_ids[] = { | ||
| 630 | { | ||
| 631 | .name = "s3c2440-camif", | ||
| 632 | .driver_data = (unsigned long)&s3c244x_camif_drvdata, | ||
| 633 | }, { | ||
| 634 | .name = "s3c6410-camif", | ||
| 635 | .driver_data = (unsigned long)&s3c6410_camif_drvdata, | ||
| 636 | }, | ||
| 637 | { /* sentinel */ }, | ||
| 638 | }; | ||
| 639 | MODULE_DEVICE_TABLE(platform, s3c_camif_driver_ids); | ||
| 640 | |||
| 641 | static const struct dev_pm_ops s3c_camif_pm_ops = { | ||
| 642 | .runtime_suspend = s3c_camif_runtime_suspend, | ||
| 643 | .runtime_resume = s3c_camif_runtime_resume, | ||
| 644 | }; | ||
| 645 | |||
| 646 | static struct platform_driver s3c_camif_driver = { | ||
| 647 | .probe = s3c_camif_probe, | ||
| 648 | .remove = s3c_camif_remove, | ||
| 649 | .id_table = s3c_camif_driver_ids, | ||
| 650 | .driver = { | ||
| 651 | .name = S3C_CAMIF_DRIVER_NAME, | ||
| 652 | .owner = THIS_MODULE, | ||
| 653 | .pm = &s3c_camif_pm_ops, | ||
| 654 | } | ||
| 655 | }; | ||
| 656 | |||
| 657 | module_platform_driver(s3c_camif_driver); | ||
| 658 | |||
| 659 | MODULE_AUTHOR("Sylwester Nawrocki <sylvester.nawrocki@gmail.com>"); | ||
| 660 | MODULE_AUTHOR("Tomasz Figa <tomasz.figa@gmail.com>"); | ||
| 661 | MODULE_DESCRIPTION("S3C24XX/S3C64XX SoC camera interface driver"); | ||
| 662 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/platform/s3c-camif/camif-core.h b/drivers/media/platform/s3c-camif/camif-core.h new file mode 100644 index 000000000000..261134baa655 --- /dev/null +++ b/drivers/media/platform/s3c-camif/camif-core.h | |||
| @@ -0,0 +1,393 @@ | |||
| 1 | /* | ||
| 2 | * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
| 5 | * Copyright (C) 2012 Tomasz Figa <tomasz.figa@gmail.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef CAMIF_CORE_H_ | ||
| 13 | #define CAMIF_CORE_H_ | ||
| 14 | |||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/irq.h> | ||
| 17 | #include <linux/platform_device.h> | ||
| 18 | #include <linux/sched.h> | ||
| 19 | #include <linux/spinlock.h> | ||
| 20 | #include <linux/types.h> | ||
| 21 | #include <linux/videodev2.h> | ||
| 22 | |||
| 23 | #include <media/media-entity.h> | ||
| 24 | #include <media/v4l2-ctrls.h> | ||
| 25 | #include <media/v4l2-dev.h> | ||
| 26 | #include <media/v4l2-device.h> | ||
| 27 | #include <media/v4l2-mediabus.h> | ||
| 28 | #include <media/videobuf2-core.h> | ||
| 29 | #include <media/s3c_camif.h> | ||
| 30 | |||
| 31 | #define S3C_CAMIF_DRIVER_NAME "s3c-camif" | ||
| 32 | #define CAMIF_REQ_BUFS_MIN 3 | ||
| 33 | #define CAMIF_MAX_OUT_BUFS 4 | ||
| 34 | #define CAMIF_MAX_PIX_WIDTH 4096 | ||
| 35 | #define CAMIF_MAX_PIX_HEIGHT 4096 | ||
| 36 | #define SCALER_MAX_RATIO 64 | ||
| 37 | #define CAMIF_DEF_WIDTH 640 | ||
| 38 | #define CAMIF_DEF_HEIGHT 480 | ||
| 39 | #define CAMIF_STOP_TIMEOUT 1500 /* ms */ | ||
| 40 | |||
| 41 | #define S3C244X_CAMIF_IP_REV 0x20 /* 2.0 */ | ||
| 42 | #define S3C2450_CAMIF_IP_REV 0x30 /* 3.0 - not implemented, not tested */ | ||
| 43 | #define S3C6400_CAMIF_IP_REV 0x31 /* 3.1 - not implemented, not tested */ | ||
| 44 | #define S3C6410_CAMIF_IP_REV 0x32 /* 3.2 */ | ||
| 45 | |||
| 46 | /* struct camif_vp::state */ | ||
| 47 | |||
| 48 | #define ST_VP_PENDING (1 << 0) | ||
| 49 | #define ST_VP_RUNNING (1 << 1) | ||
| 50 | #define ST_VP_STREAMING (1 << 2) | ||
| 51 | #define ST_VP_SENSOR_STREAMING (1 << 3) | ||
| 52 | |||
| 53 | #define ST_VP_ABORTING (1 << 4) | ||
| 54 | #define ST_VP_OFF (1 << 5) | ||
| 55 | #define ST_VP_LASTIRQ (1 << 6) | ||
| 56 | |||
| 57 | #define ST_VP_CONFIG (1 << 8) | ||
| 58 | |||
| 59 | #define CAMIF_SD_PAD_SINK 0 | ||
| 60 | #define CAMIF_SD_PAD_SOURCE_C 1 | ||
| 61 | #define CAMIF_SD_PAD_SOURCE_P 2 | ||
| 62 | #define CAMIF_SD_PADS_NUM 3 | ||
| 63 | |||
| 64 | enum img_fmt { | ||
| 65 | IMG_FMT_RGB565 = 0x0010, | ||
| 66 | IMG_FMT_RGB666, | ||
| 67 | IMG_FMT_XRGB8888, | ||
| 68 | IMG_FMT_YCBCR420 = 0x0020, | ||
| 69 | IMG_FMT_YCRCB420, | ||
| 70 | IMG_FMT_YCBCR422P, | ||
| 71 | IMG_FMT_YCBYCR422 = 0x0040, | ||
| 72 | IMG_FMT_YCRYCB422, | ||
| 73 | IMG_FMT_CBYCRY422, | ||
| 74 | IMG_FMT_CRYCBY422, | ||
| 75 | }; | ||
| 76 | |||
| 77 | #define img_fmt_is_rgb(x) ((x) & 0x10) | ||
| 78 | #define img_fmt_is_ycbcr(x) ((x) & 0x60) | ||
| 79 | |||
| 80 | /* Possible values for struct camif_fmt::flags */ | ||
| 81 | #define FMT_FL_S3C24XX_CODEC (1 << 0) | ||
| 82 | #define FMT_FL_S3C24XX_PREVIEW (1 << 1) | ||
| 83 | #define FMT_FL_S3C64XX (1 << 2) | ||
| 84 | |||
| 85 | /** | ||
| 86 | * struct camif_fmt - pixel format description | ||
| 87 | * @fourcc: fourcc code for this format, 0 if not applicable | ||
| 88 | * @color: a corresponding enum img_fmt | ||
| 89 | * @colplanes: number of physically contiguous data planes | ||
| 90 | * @flags: indicate for which SoCs revisions this format is valid | ||
| 91 | * @depth: bits per pixel (total) | ||
| 92 | * @ybpp: number of luminance bytes per pixel | ||
| 93 | */ | ||
| 94 | struct camif_fmt { | ||
| 95 | char *name; | ||
| 96 | u32 fourcc; | ||
| 97 | u32 color; | ||
| 98 | u16 colplanes; | ||
| 99 | u16 flags; | ||
| 100 | u8 depth; | ||
| 101 | u8 ybpp; | ||
| 102 | }; | ||
| 103 | |||
| 104 | /** | ||
| 105 | * struct camif_dma_offset - pixel offset information for DMA | ||
| 106 | * @initial: offset (in pixels) to first pixel | ||
| 107 | * @line: offset (in pixels) from end of line to start of next line | ||
| 108 | */ | ||
| 109 | struct camif_dma_offset { | ||
| 110 | int initial; | ||
| 111 | int line; | ||
| 112 | }; | ||
| 113 | |||
| 114 | /** | ||
| 115 | * struct camif_frame - source/target frame properties | ||
| 116 | * @f_width: full pixel width | ||
| 117 | * @f_height: full pixel height | ||
| 118 | * @rect: crop/composition rectangle | ||
| 119 | * @dma_offset: DMA offset configuration | ||
| 120 | */ | ||
| 121 | struct camif_frame { | ||
| 122 | u16 f_width; | ||
| 123 | u16 f_height; | ||
| 124 | struct v4l2_rect rect; | ||
| 125 | struct camif_dma_offset dma_offset; | ||
| 126 | }; | ||
| 127 | |||
| 128 | /* CAMIF clocks enumeration */ | ||
| 129 | enum { | ||
| 130 | CLK_GATE, | ||
| 131 | CLK_CAM, | ||
| 132 | CLK_MAX_NUM, | ||
| 133 | }; | ||
| 134 | |||
| 135 | struct vp_pix_limits { | ||
| 136 | u16 max_out_width; | ||
| 137 | u16 max_sc_out_width; | ||
| 138 | u16 out_width_align; | ||
| 139 | u16 max_height; | ||
| 140 | u8 min_out_width; | ||
| 141 | u16 out_hor_offset_align; | ||
| 142 | }; | ||
| 143 | |||
| 144 | struct camif_pix_limits { | ||
| 145 | u16 win_hor_offset_align; | ||
| 146 | }; | ||
| 147 | |||
| 148 | /** | ||
| 149 | * struct s3c_camif_variant - CAMIF variant structure | ||
| 150 | * @vp_pix_limits: pixel limits for the codec and preview paths | ||
| 151 | * @camif_pix_limits: pixel limits for the camera input interface | ||
| 152 | * @ip_revision: the CAMIF IP revision: 0x20 for s3c244x, 0x32 for s3c6410 | ||
| 153 | */ | ||
| 154 | struct s3c_camif_variant { | ||
| 155 | struct vp_pix_limits vp_pix_limits[2]; | ||
| 156 | struct camif_pix_limits pix_limits; | ||
| 157 | u8 ip_revision; | ||
| 158 | u8 has_img_effect; | ||
| 159 | unsigned int vp_offset; | ||
| 160 | }; | ||
| 161 | |||
| 162 | struct s3c_camif_drvdata { | ||
| 163 | const struct s3c_camif_variant *variant; | ||
| 164 | unsigned long bus_clk_freq; | ||
| 165 | }; | ||
| 166 | |||
| 167 | struct camif_scaler { | ||
| 168 | u8 scaleup_h; | ||
| 169 | u8 scaleup_v; | ||
| 170 | u8 copy; | ||
| 171 | u8 enable; | ||
| 172 | u32 h_shift; | ||
| 173 | u32 v_shift; | ||
| 174 | u32 pre_h_ratio; | ||
| 175 | u32 pre_v_ratio; | ||
| 176 | u32 pre_dst_width; | ||
| 177 | u32 pre_dst_height; | ||
| 178 | u32 main_h_ratio; | ||
| 179 | u32 main_v_ratio; | ||
| 180 | }; | ||
| 181 | |||
| 182 | struct camif_dev; | ||
| 183 | |||
| 184 | /** | ||
| 185 | * struct camif_vp - CAMIF data processing path structure (codec/preview) | ||
| 186 | * @irq_queue: interrupt handling waitqueue | ||
| 187 | * @irq: interrupt number for this data path | ||
| 188 | * @camif: pointer to the camif structure | ||
| 189 | * @pad: media pad for the video node | ||
| 190 | * @vdev video device | ||
| 191 | * @ctrl_handler: video node controls handler | ||
| 192 | * @owner: file handle that own the streaming | ||
| 193 | * @pending_buf_q: pending (empty) buffers queue head | ||
| 194 | * @active_buf_q: active (being written) buffers queue head | ||
| 195 | * @active_buffers: counter of buffer set up at the DMA engine | ||
| 196 | * @buf_index: identifier of a last empty buffer set up in H/W | ||
| 197 | * @frame_sequence: image frame sequence counter | ||
| 198 | * @reqbufs_count: the number of buffers requested | ||
| 199 | * @scaler: the scaler structure | ||
| 200 | * @out_fmt: pixel format at this video path output | ||
| 201 | * @payload: the output data frame payload size | ||
| 202 | * @out_frame: the output pixel resolution | ||
| 203 | * @state: the video path's state | ||
| 204 | * @fmt_flags: flags determining supported pixel formats | ||
| 205 | * @id: CAMIF id, 0 - codec, 1 - preview | ||
| 206 | * @rotation: current image rotation value | ||
| 207 | * @hflip: apply horizontal flip if set | ||
| 208 | * @vflip: apply vertical flip if set | ||
| 209 | */ | ||
| 210 | struct camif_vp { | ||
| 211 | wait_queue_head_t irq_queue; | ||
| 212 | int irq; | ||
| 213 | struct camif_dev *camif; | ||
| 214 | struct media_pad pad; | ||
| 215 | struct video_device vdev; | ||
| 216 | struct v4l2_ctrl_handler ctrl_handler; | ||
| 217 | struct v4l2_fh *owner; | ||
| 218 | struct vb2_queue vb_queue; | ||
| 219 | struct list_head pending_buf_q; | ||
| 220 | struct list_head active_buf_q; | ||
| 221 | unsigned int active_buffers; | ||
| 222 | unsigned int buf_index; | ||
| 223 | unsigned int frame_sequence; | ||
| 224 | unsigned int reqbufs_count; | ||
| 225 | struct camif_scaler scaler; | ||
| 226 | const struct camif_fmt *out_fmt; | ||
| 227 | unsigned int payload; | ||
| 228 | struct camif_frame out_frame; | ||
| 229 | unsigned int state; | ||
| 230 | u16 fmt_flags; | ||
| 231 | u8 id; | ||
| 232 | u8 rotation; | ||
| 233 | u8 hflip; | ||
| 234 | u8 vflip; | ||
| 235 | unsigned int offset; | ||
| 236 | }; | ||
| 237 | |||
| 238 | /* Video processing path enumeration */ | ||
| 239 | #define VP_CODEC 0 | ||
| 240 | #define VP_PREVIEW 1 | ||
| 241 | #define CAMIF_VP_NUM 2 | ||
| 242 | |||
| 243 | /** | ||
| 244 | * struct camif_dev - the CAMIF driver private data structure | ||
| 245 | * @media_dev: top-level media device structure | ||
| 246 | * @v4l2_dev: root v4l2_device | ||
| 247 | * @subdev: camera interface ("catchcam") subdev | ||
| 248 | * @mbus_fmt: camera input media bus format | ||
| 249 | * @camif_crop: camera input interface crop rectangle | ||
| 250 | * @pads: the camif subdev's media pads | ||
| 251 | * @stream_count: the camera interface streaming reference counter | ||
| 252 | * @sensor: image sensor data structure | ||
| 253 | * @m_pipeline: video entity pipeline description | ||
| 254 | * @ctrl_handler: v4l2 control handler (owned by @subdev) | ||
| 255 | * @test_pattern: test pattern controls | ||
| 256 | * @vp: video path (DMA) description (codec/preview) | ||
| 257 | * @alloc_ctx: memory buffer allocator context | ||
| 258 | * @variant: variant information for this device | ||
| 259 | * @dev: pointer to the CAMIF device struct | ||
| 260 | * @pdata: a copy of the driver's platform data | ||
| 261 | * @clock: clocks required for the CAMIF operation | ||
| 262 | * @lock: mutex protecting this data structure | ||
| 263 | * @slock: spinlock protecting CAMIF registers | ||
| 264 | * @io_base: start address of the mmaped CAMIF registers | ||
| 265 | */ | ||
| 266 | struct camif_dev { | ||
| 267 | struct media_device media_dev; | ||
| 268 | struct v4l2_device v4l2_dev; | ||
| 269 | struct v4l2_subdev subdev; | ||
| 270 | struct v4l2_mbus_framefmt mbus_fmt; | ||
| 271 | struct v4l2_rect camif_crop; | ||
| 272 | struct media_pad pads[CAMIF_SD_PADS_NUM]; | ||
| 273 | int stream_count; | ||
| 274 | |||
| 275 | struct cam_sensor { | ||
| 276 | struct v4l2_subdev *sd; | ||
| 277 | short power_count; | ||
| 278 | short stream_count; | ||
| 279 | } sensor; | ||
| 280 | struct media_pipeline *m_pipeline; | ||
| 281 | |||
| 282 | struct v4l2_ctrl_handler ctrl_handler; | ||
| 283 | struct v4l2_ctrl *ctrl_test_pattern; | ||
| 284 | struct { | ||
| 285 | struct v4l2_ctrl *ctrl_colorfx; | ||
| 286 | struct v4l2_ctrl *ctrl_colorfx_cbcr; | ||
| 287 | }; | ||
| 288 | u8 test_pattern; | ||
| 289 | u8 colorfx; | ||
| 290 | u8 colorfx_cb; | ||
| 291 | u8 colorfx_cr; | ||
| 292 | |||
| 293 | struct camif_vp vp[CAMIF_VP_NUM]; | ||
| 294 | struct vb2_alloc_ctx *alloc_ctx; | ||
| 295 | |||
| 296 | const struct s3c_camif_variant *variant; | ||
| 297 | struct device *dev; | ||
| 298 | struct s3c_camif_plat_data pdata; | ||
| 299 | struct clk *clock[CLK_MAX_NUM]; | ||
| 300 | struct mutex lock; | ||
| 301 | spinlock_t slock; | ||
| 302 | void __iomem *io_base; | ||
| 303 | }; | ||
| 304 | |||
| 305 | /** | ||
| 306 | * struct camif_addr - Y/Cb/Cr DMA start address structure | ||
| 307 | * @y: luminance plane dma address | ||
| 308 | * @cb: Cb plane dma address | ||
| 309 | * @cr: Cr plane dma address | ||
| 310 | */ | ||
| 311 | struct camif_addr { | ||
| 312 | dma_addr_t y; | ||
| 313 | dma_addr_t cb; | ||
| 314 | dma_addr_t cr; | ||
| 315 | }; | ||
| 316 | |||
| 317 | /** | ||
| 318 | * struct camif_buffer - the camif video buffer structure | ||
| 319 | * @vb: vb2 buffer | ||
| 320 | * @list: list head for the buffers queue | ||
| 321 | * @paddr: DMA start addresses | ||
| 322 | * @index: an identifier of this buffer at the DMA engine | ||
| 323 | */ | ||
| 324 | struct camif_buffer { | ||
| 325 | struct vb2_buffer vb; | ||
| 326 | struct list_head list; | ||
| 327 | struct camif_addr paddr; | ||
| 328 | unsigned int index; | ||
| 329 | }; | ||
| 330 | |||
| 331 | const struct camif_fmt *s3c_camif_find_format(struct camif_vp *vp, | ||
| 332 | const u32 *pixelformat, int index); | ||
| 333 | int s3c_camif_register_video_node(struct camif_dev *camif, int idx); | ||
| 334 | void s3c_camif_unregister_video_node(struct camif_dev *camif, int idx); | ||
| 335 | irqreturn_t s3c_camif_irq_handler(int irq, void *priv); | ||
| 336 | int s3c_camif_create_subdev(struct camif_dev *camif); | ||
| 337 | void s3c_camif_unregister_subdev(struct camif_dev *camif); | ||
| 338 | int s3c_camif_set_defaults(struct camif_dev *camif); | ||
| 339 | int s3c_camif_get_scaler_config(struct camif_vp *vp, | ||
| 340 | struct camif_scaler *scaler); | ||
| 341 | |||
| 342 | static inline void camif_active_queue_add(struct camif_vp *vp, | ||
| 343 | struct camif_buffer *buf) | ||
| 344 | { | ||
| 345 | list_add_tail(&buf->list, &vp->active_buf_q); | ||
| 346 | vp->active_buffers++; | ||
| 347 | } | ||
| 348 | |||
| 349 | static inline struct camif_buffer *camif_active_queue_pop( | ||
| 350 | struct camif_vp *vp) | ||
| 351 | { | ||
| 352 | struct camif_buffer *buf = list_first_entry(&vp->active_buf_q, | ||
| 353 | struct camif_buffer, list); | ||
| 354 | list_del(&buf->list); | ||
| 355 | vp->active_buffers--; | ||
| 356 | return buf; | ||
| 357 | } | ||
| 358 | |||
| 359 | static inline struct camif_buffer *camif_active_queue_peek( | ||
| 360 | struct camif_vp *vp, int index) | ||
| 361 | { | ||
| 362 | struct camif_buffer *tmp, *buf; | ||
| 363 | |||
| 364 | if (WARN_ON(list_empty(&vp->active_buf_q))) | ||
| 365 | return NULL; | ||
| 366 | |||
| 367 | list_for_each_entry_safe(buf, tmp, &vp->active_buf_q, list) { | ||
| 368 | if (buf->index == index) { | ||
| 369 | list_del(&buf->list); | ||
| 370 | vp->active_buffers--; | ||
| 371 | return buf; | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | return NULL; | ||
| 376 | } | ||
| 377 | |||
| 378 | static inline void camif_pending_queue_add(struct camif_vp *vp, | ||
| 379 | struct camif_buffer *buf) | ||
| 380 | { | ||
| 381 | list_add_tail(&buf->list, &vp->pending_buf_q); | ||
| 382 | } | ||
| 383 | |||
| 384 | static inline struct camif_buffer *camif_pending_queue_pop( | ||
| 385 | struct camif_vp *vp) | ||
| 386 | { | ||
| 387 | struct camif_buffer *buf = list_first_entry(&vp->pending_buf_q, | ||
| 388 | struct camif_buffer, list); | ||
| 389 | list_del(&buf->list); | ||
| 390 | return buf; | ||
| 391 | } | ||
| 392 | |||
| 393 | #endif /* CAMIF_CORE_H_ */ | ||
diff --git a/drivers/media/platform/s3c-camif/camif-regs.c b/drivers/media/platform/s3c-camif/camif-regs.c new file mode 100644 index 000000000000..1a3b4fc05ec6 --- /dev/null +++ b/drivers/media/platform/s3c-camif/camif-regs.c | |||
| @@ -0,0 +1,606 @@ | |||
| 1 | /* | ||
| 2 | * Samsung s3c24xx/s3c64xx SoC CAMIF driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
| 5 | * Copyright (C) 2012 Tomasz Figa <tomasz.figa@gmail.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__ | ||
| 12 | |||
| 13 | #include <linux/delay.h> | ||
| 14 | #include "camif-regs.h" | ||
| 15 | |||
| 16 | #define camif_write(_camif, _off, _val) writel(_val, (_camif)->io_base + (_off)) | ||
| 17 | #define camif_read(_camif, _off) readl((_camif)->io_base + (_off)) | ||
| 18 | |||
| 19 | void camif_hw_reset(struct camif_dev *camif) | ||
| 20 | { | ||
| 21 | u32 cfg; | ||
| 22 | |||
| 23 | cfg = camif_read(camif, S3C_CAMIF_REG_CISRCFMT); | ||
| 24 | cfg |= CISRCFMT_ITU601_8BIT; | ||
| 25 | camif_write(camif, S3C_CAMIF_REG_CISRCFMT, cfg); | ||
| 26 | |||
| 27 | /* S/W reset */ | ||
| 28 | cfg = camif_read(camif, S3C_CAMIF_REG_CIGCTRL); | ||
| 29 | cfg |= CIGCTRL_SWRST; | ||
| 30 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV) | ||
| 31 | cfg |= CIGCTRL_IRQ_LEVEL; | ||
| 32 | camif_write(camif, S3C_CAMIF_REG_CIGCTRL, cfg); | ||
| 33 | udelay(10); | ||
| 34 | |||
| 35 | cfg = camif_read(camif, S3C_CAMIF_REG_CIGCTRL); | ||
| 36 | cfg &= ~CIGCTRL_SWRST; | ||
| 37 | camif_write(camif, S3C_CAMIF_REG_CIGCTRL, cfg); | ||
| 38 | udelay(10); | ||
| 39 | } | ||
| 40 | |||
| 41 | void camif_hw_clear_pending_irq(struct camif_vp *vp) | ||
| 42 | { | ||
| 43 | u32 cfg = camif_read(vp->camif, S3C_CAMIF_REG_CIGCTRL); | ||
| 44 | cfg |= CIGCTRL_IRQ_CLR(vp->id); | ||
| 45 | camif_write(vp->camif, S3C_CAMIF_REG_CIGCTRL, cfg); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* | ||
| 49 | * Sets video test pattern (off, color bar, horizontal or vertical gradient). | ||
| 50 | * External sensor pixel clock must be active for the test pattern to work. | ||
| 51 | */ | ||
| 52 | void camif_hw_set_test_pattern(struct camif_dev *camif, unsigned int pattern) | ||
| 53 | { | ||
| 54 | u32 cfg = camif_read(camif, S3C_CAMIF_REG_CIGCTRL); | ||
| 55 | cfg &= ~CIGCTRL_TESTPATTERN_MASK; | ||
| 56 | cfg |= (pattern << 27); | ||
| 57 | camif_write(camif, S3C_CAMIF_REG_CIGCTRL, cfg); | ||
| 58 | } | ||
| 59 | |||
| 60 | void camif_hw_set_effect(struct camif_dev *camif, unsigned int effect, | ||
| 61 | unsigned int cr, unsigned int cb) | ||
| 62 | { | ||
| 63 | static const struct v4l2_control colorfx[] = { | ||
| 64 | { V4L2_COLORFX_NONE, CIIMGEFF_FIN_BYPASS }, | ||
| 65 | { V4L2_COLORFX_BW, CIIMGEFF_FIN_ARBITRARY }, | ||
| 66 | { V4L2_COLORFX_SEPIA, CIIMGEFF_FIN_ARBITRARY }, | ||
| 67 | { V4L2_COLORFX_NEGATIVE, CIIMGEFF_FIN_NEGATIVE }, | ||
| 68 | { V4L2_COLORFX_ART_FREEZE, CIIMGEFF_FIN_ARTFREEZE }, | ||
| 69 | { V4L2_COLORFX_EMBOSS, CIIMGEFF_FIN_EMBOSSING }, | ||
| 70 | { V4L2_COLORFX_SILHOUETTE, CIIMGEFF_FIN_SILHOUETTE }, | ||
| 71 | { V4L2_COLORFX_SET_CBCR, CIIMGEFF_FIN_ARBITRARY }, | ||
| 72 | }; | ||
| 73 | unsigned int i, cfg; | ||
| 74 | |||
| 75 | for (i = 0; i < ARRAY_SIZE(colorfx); i++) | ||
| 76 | if (colorfx[i].id == effect) | ||
| 77 | break; | ||
| 78 | |||
| 79 | if (i == ARRAY_SIZE(colorfx)) | ||
| 80 | return; | ||
| 81 | |||
| 82 | cfg = camif_read(camif, S3C_CAMIF_REG_CIIMGEFF(camif->vp->offset)); | ||
| 83 | /* Set effect */ | ||
| 84 | cfg &= ~CIIMGEFF_FIN_MASK; | ||
| 85 | cfg |= colorfx[i].value; | ||
| 86 | /* Set both paths */ | ||
| 87 | if (camif->variant->ip_revision >= S3C6400_CAMIF_IP_REV) { | ||
| 88 | if (effect == V4L2_COLORFX_NONE) | ||
| 89 | cfg &= ~CIIMGEFF_IE_ENABLE_MASK; | ||
| 90 | else | ||
| 91 | cfg |= CIIMGEFF_IE_ENABLE_MASK; | ||
| 92 | } | ||
| 93 | cfg &= ~CIIMGEFF_PAT_CBCR_MASK; | ||
| 94 | cfg |= cr | (cb << 13); | ||
| 95 | camif_write(camif, S3C_CAMIF_REG_CIIMGEFF(camif->vp->offset), cfg); | ||
| 96 | } | ||
| 97 | |||
| 98 | static const u32 src_pixfmt_map[8][2] = { | ||
| 99 | { V4L2_MBUS_FMT_YUYV8_2X8, CISRCFMT_ORDER422_YCBYCR }, | ||
| 100 | { V4L2_MBUS_FMT_YVYU8_2X8, CISRCFMT_ORDER422_YCRYCB }, | ||
| 101 | { V4L2_MBUS_FMT_UYVY8_2X8, CISRCFMT_ORDER422_CBYCRY }, | ||
| 102 | { V4L2_MBUS_FMT_VYUY8_2X8, CISRCFMT_ORDER422_CRYCBY }, | ||
| 103 | }; | ||
| 104 | |||
| 105 | /* Set camera input pixel format and resolution */ | ||
| 106 | void camif_hw_set_source_format(struct camif_dev *camif) | ||
| 107 | { | ||
| 108 | struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt; | ||
| 109 | unsigned int i = ARRAY_SIZE(src_pixfmt_map); | ||
| 110 | u32 cfg; | ||
| 111 | |||
| 112 | while (i-- >= 0) { | ||
| 113 | if (src_pixfmt_map[i][0] == mf->code) | ||
| 114 | break; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (i == 0 && src_pixfmt_map[i][0] != mf->code) { | ||
| 118 | dev_err(camif->dev, | ||
| 119 | "Unsupported pixel code, falling back to %#08x\n", | ||
| 120 | src_pixfmt_map[i][0]); | ||
| 121 | } | ||
| 122 | |||
| 123 | cfg = camif_read(camif, S3C_CAMIF_REG_CISRCFMT); | ||
| 124 | cfg &= ~(CISRCFMT_ORDER422_MASK | CISRCFMT_SIZE_CAM_MASK); | ||
| 125 | cfg |= (mf->width << 16) | mf->height; | ||
| 126 | cfg |= src_pixfmt_map[i][1]; | ||
| 127 | camif_write(camif, S3C_CAMIF_REG_CISRCFMT, cfg); | ||
| 128 | } | ||
| 129 | |||
| 130 | /* Set the camera host input window offsets (cropping) */ | ||
| 131 | void camif_hw_set_camera_crop(struct camif_dev *camif) | ||
| 132 | { | ||
| 133 | struct v4l2_mbus_framefmt *mf = &camif->mbus_fmt; | ||
| 134 | struct v4l2_rect *crop = &camif->camif_crop; | ||
| 135 | u32 hoff2, voff2; | ||
| 136 | u32 cfg; | ||
| 137 | |||
| 138 | /* Note: s3c244x requirement: left = f_width - rect.width / 2 */ | ||
| 139 | cfg = camif_read(camif, S3C_CAMIF_REG_CIWDOFST); | ||
| 140 | cfg &= ~(CIWDOFST_OFST_MASK | CIWDOFST_WINOFSEN); | ||
| 141 | cfg |= (crop->left << 16) | crop->top; | ||
| 142 | if (crop->left != 0 || crop->top != 0) | ||
| 143 | cfg |= CIWDOFST_WINOFSEN; | ||
| 144 | camif_write(camif, S3C_CAMIF_REG_CIWDOFST, cfg); | ||
| 145 | |||
| 146 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV) { | ||
| 147 | hoff2 = mf->width - crop->width - crop->left; | ||
| 148 | voff2 = mf->height - crop->height - crop->top; | ||
| 149 | cfg = (hoff2 << 16) | voff2; | ||
| 150 | camif_write(camif, S3C_CAMIF_REG_CIWDOFST2, cfg); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | void camif_hw_clear_fifo_overflow(struct camif_vp *vp) | ||
| 155 | { | ||
| 156 | struct camif_dev *camif = vp->camif; | ||
| 157 | u32 cfg; | ||
| 158 | |||
| 159 | cfg = camif_read(camif, S3C_CAMIF_REG_CIWDOFST); | ||
| 160 | if (vp->id == 0) | ||
| 161 | cfg |= (CIWDOFST_CLROVCOFIY | CIWDOFST_CLROVCOFICB | | ||
| 162 | CIWDOFST_CLROVCOFICR); | ||
| 163 | else | ||
| 164 | cfg |= (/* CIWDOFST_CLROVPRFIY | */ CIWDOFST_CLROVPRFICB | | ||
| 165 | CIWDOFST_CLROVPRFICR); | ||
| 166 | camif_write(camif, S3C_CAMIF_REG_CIWDOFST, cfg); | ||
| 167 | } | ||
| 168 | |||
| 169 | /* Set video bus signals polarity */ | ||
| 170 | void camif_hw_set_camera_bus(struct camif_dev *camif) | ||
| 171 | { | ||
| 172 | unsigned int flags = camif->pdata.sensor.flags; | ||
| 173 | |||
| 174 | u32 cfg = camif_read(camif, S3C_CAMIF_REG_CIGCTRL); | ||
| 175 | |||
| 176 | cfg &= ~(CIGCTRL_INVPOLPCLK | CIGCTRL_INVPOLVSYNC | | ||
| 177 | CIGCTRL_INVPOLHREF | CIGCTRL_INVPOLFIELD); | ||
| 178 | |||
| 179 | if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) | ||
| 180 | cfg |= CIGCTRL_INVPOLPCLK; | ||
| 181 | |||
| 182 | if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) | ||
| 183 | cfg |= CIGCTRL_INVPOLVSYNC; | ||
| 184 | /* | ||
| 185 | * HREF is normally high during frame active data | ||
| 186 | * transmission and low during horizontal synchronization | ||
| 187 | * period. Thus HREF active high means HSYNC active low. | ||
| 188 | */ | ||
| 189 | if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) | ||
| 190 | cfg |= CIGCTRL_INVPOLHREF; /* HREF active low */ | ||
| 191 | |||
| 192 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV) { | ||
| 193 | if (flags & V4L2_MBUS_FIELD_EVEN_LOW) | ||
| 194 | cfg |= CIGCTRL_INVPOLFIELD; | ||
| 195 | cfg |= CIGCTRL_FIELDMODE; | ||
| 196 | } | ||
| 197 | |||
| 198 | pr_debug("Setting CIGCTRL to: %#x\n", cfg); | ||
| 199 | |||
| 200 | camif_write(camif, S3C_CAMIF_REG_CIGCTRL, cfg); | ||
| 201 | } | ||
| 202 | |||
| 203 | void camif_hw_set_output_addr(struct camif_vp *vp, | ||
| 204 | struct camif_addr *paddr, int i) | ||
| 205 | { | ||
| 206 | struct camif_dev *camif = vp->camif; | ||
| 207 | |||
| 208 | camif_write(camif, S3C_CAMIF_REG_CIYSA(vp->id, i), paddr->y); | ||
| 209 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV | ||
| 210 | || vp->id == VP_CODEC) { | ||
| 211 | camif_write(camif, S3C_CAMIF_REG_CICBSA(vp->id, i), | ||
| 212 | paddr->cb); | ||
| 213 | camif_write(camif, S3C_CAMIF_REG_CICRSA(vp->id, i), | ||
| 214 | paddr->cr); | ||
| 215 | } | ||
| 216 | |||
| 217 | pr_debug("dst_buf[%d]: %#X, cb: %#X, cr: %#X\n", | ||
| 218 | i, paddr->y, paddr->cb, paddr->cr); | ||
| 219 | } | ||
| 220 | |||
| 221 | static void camif_hw_set_out_dma_size(struct camif_vp *vp) | ||
| 222 | { | ||
| 223 | struct camif_frame *frame = &vp->out_frame; | ||
| 224 | u32 cfg; | ||
| 225 | |||
| 226 | cfg = camif_read(vp->camif, S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset)); | ||
| 227 | cfg &= ~CITRGFMT_TARGETSIZE_MASK; | ||
| 228 | cfg |= (frame->f_width << 16) | frame->f_height; | ||
| 229 | camif_write(vp->camif, S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset), cfg); | ||
| 230 | } | ||
| 231 | |||
| 232 | static void camif_get_dma_burst(u32 width, u32 ybpp, u32 *mburst, u32 *rburst) | ||
| 233 | { | ||
| 234 | unsigned int nwords = width * ybpp / 4; | ||
| 235 | unsigned int div, rem; | ||
| 236 | |||
| 237 | if (WARN_ON(width < 8 || (width * ybpp) & 7)) | ||
| 238 | return; | ||
| 239 | |||
| 240 | for (div = 16; div >= 2; div /= 2) { | ||
| 241 | if (nwords < div) | ||
| 242 | continue; | ||
| 243 | |||
| 244 | rem = nwords & (div - 1); | ||
| 245 | if (rem == 0) { | ||
| 246 | *mburst = div; | ||
| 247 | *rburst = div; | ||
| 248 | break; | ||
| 249 | } | ||
| 250 | if (rem == div / 2 || rem == div / 4) { | ||
| 251 | *mburst = div; | ||
| 252 | *rburst = rem; | ||
| 253 | break; | ||
| 254 | } | ||
| 255 | } | ||
| 256 | } | ||
| 257 | |||
| 258 | void camif_hw_set_output_dma(struct camif_vp *vp) | ||
| 259 | { | ||
| 260 | struct camif_dev *camif = vp->camif; | ||
| 261 | struct camif_frame *frame = &vp->out_frame; | ||
| 262 | const struct camif_fmt *fmt = vp->out_fmt; | ||
| 263 | unsigned int ymburst = 0, yrburst = 0; | ||
| 264 | u32 cfg; | ||
| 265 | |||
| 266 | camif_hw_set_out_dma_size(vp); | ||
| 267 | |||
| 268 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV) { | ||
| 269 | struct camif_dma_offset *offset = &frame->dma_offset; | ||
| 270 | /* Set the input dma offsets. */ | ||
| 271 | cfg = S3C_CISS_OFFS_INITIAL(offset->initial); | ||
| 272 | cfg |= S3C_CISS_OFFS_LINE(offset->line); | ||
| 273 | camif_write(camif, S3C_CAMIF_REG_CISSY(vp->id), cfg); | ||
| 274 | camif_write(camif, S3C_CAMIF_REG_CISSCB(vp->id), cfg); | ||
| 275 | camif_write(camif, S3C_CAMIF_REG_CISSCR(vp->id), cfg); | ||
| 276 | } | ||
| 277 | |||
| 278 | /* Configure DMA burst values */ | ||
| 279 | camif_get_dma_burst(frame->rect.width, fmt->ybpp, &ymburst, &yrburst); | ||
| 280 | |||
| 281 | cfg = camif_read(camif, S3C_CAMIF_REG_CICTRL(vp->id, vp->offset)); | ||
| 282 | cfg &= ~CICTRL_BURST_MASK; | ||
| 283 | |||
| 284 | cfg |= CICTRL_YBURST1(ymburst) | CICTRL_YBURST2(yrburst); | ||
| 285 | cfg |= CICTRL_CBURST1(ymburst / 2) | CICTRL_CBURST2(yrburst / 2); | ||
| 286 | |||
| 287 | camif_write(camif, S3C_CAMIF_REG_CICTRL(vp->id, vp->offset), cfg); | ||
| 288 | |||
| 289 | pr_debug("ymburst: %u, yrburst: %u\n", ymburst, yrburst); | ||
| 290 | } | ||
| 291 | |||
| 292 | void camif_hw_set_input_path(struct camif_vp *vp) | ||
| 293 | { | ||
| 294 | u32 cfg = camif_read(vp->camif, S3C_CAMIF_REG_MSCTRL(vp->id)); | ||
| 295 | cfg &= ~MSCTRL_SEL_DMA_CAM; | ||
| 296 | camif_write(vp->camif, S3C_CAMIF_REG_MSCTRL(vp->id), cfg); | ||
| 297 | } | ||
| 298 | |||
| 299 | void camif_hw_set_target_format(struct camif_vp *vp) | ||
| 300 | { | ||
| 301 | struct camif_dev *camif = vp->camif; | ||
| 302 | struct camif_frame *frame = &vp->out_frame; | ||
| 303 | u32 cfg; | ||
| 304 | |||
| 305 | pr_debug("fw: %d, fh: %d color: %d\n", frame->f_width, | ||
| 306 | frame->f_height, vp->out_fmt->color); | ||
| 307 | |||
| 308 | cfg = camif_read(camif, S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset)); | ||
| 309 | cfg &= ~CITRGFMT_TARGETSIZE_MASK; | ||
| 310 | |||
| 311 | if (camif->variant->ip_revision == S3C244X_CAMIF_IP_REV) { | ||
| 312 | /* We currently support only YCbCr 4:2:2 at the camera input */ | ||
| 313 | cfg |= CITRGFMT_IN422; | ||
| 314 | cfg &= ~CITRGFMT_OUT422; | ||
| 315 | if (vp->out_fmt->color == IMG_FMT_YCBCR422P) | ||
| 316 | cfg |= CITRGFMT_OUT422; | ||
| 317 | } else { | ||
| 318 | cfg &= ~CITRGFMT_OUTFORMAT_MASK; | ||
| 319 | switch (vp->out_fmt->color) { | ||
| 320 | case IMG_FMT_RGB565...IMG_FMT_XRGB8888: | ||
| 321 | cfg |= CITRGFMT_OUTFORMAT_RGB; | ||
| 322 | break; | ||
| 323 | case IMG_FMT_YCBCR420...IMG_FMT_YCRCB420: | ||
| 324 | cfg |= CITRGFMT_OUTFORMAT_YCBCR420; | ||
| 325 | break; | ||
| 326 | case IMG_FMT_YCBCR422P: | ||
| 327 | cfg |= CITRGFMT_OUTFORMAT_YCBCR422; | ||
| 328 | break; | ||
| 329 | case IMG_FMT_YCBYCR422...IMG_FMT_CRYCBY422: | ||
| 330 | cfg |= CITRGFMT_OUTFORMAT_YCBCR422I; | ||
| 331 | break; | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | /* Rotation is only supported by s3c64xx */ | ||
| 336 | if (vp->rotation == 90 || vp->rotation == 270) | ||
| 337 | cfg |= (frame->f_height << 16) | frame->f_width; | ||
| 338 | else | ||
| 339 | cfg |= (frame->f_width << 16) | frame->f_height; | ||
| 340 | camif_write(camif, S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset), cfg); | ||
| 341 | |||
| 342 | /* Target area, output pixel width * height */ | ||
| 343 | cfg = camif_read(camif, S3C_CAMIF_REG_CITAREA(vp->id, vp->offset)); | ||
| 344 | cfg &= ~CITAREA_MASK; | ||
| 345 | cfg |= (frame->f_width * frame->f_height); | ||
| 346 | camif_write(camif, S3C_CAMIF_REG_CITAREA(vp->id, vp->offset), cfg); | ||
| 347 | } | ||
| 348 | |||
| 349 | void camif_hw_set_flip(struct camif_vp *vp) | ||
| 350 | { | ||
| 351 | u32 cfg = camif_read(vp->camif, | ||
| 352 | S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset)); | ||
| 353 | |||
| 354 | cfg &= ~CITRGFMT_FLIP_MASK; | ||
| 355 | |||
| 356 | if (vp->hflip) | ||
| 357 | cfg |= CITRGFMT_FLIP_Y_MIRROR; | ||
| 358 | if (vp->vflip) | ||
| 359 | cfg |= CITRGFMT_FLIP_X_MIRROR; | ||
| 360 | |||
| 361 | camif_write(vp->camif, S3C_CAMIF_REG_CITRGFMT(vp->id, vp->offset), cfg); | ||
| 362 | } | ||
| 363 | |||
| 364 | static void camif_hw_set_prescaler(struct camif_vp *vp) | ||
| 365 | { | ||
| 366 | struct camif_dev *camif = vp->camif; | ||
| 367 | struct camif_scaler *sc = &vp->scaler; | ||
| 368 | u32 cfg, shfactor, addr; | ||
| 369 | |||
| 370 | addr = S3C_CAMIF_REG_CISCPRERATIO(vp->id, vp->offset); | ||
| 371 | |||
| 372 | shfactor = 10 - (sc->h_shift + sc->v_shift); | ||
| 373 | cfg = shfactor << 28; | ||
| 374 | |||
| 375 | cfg |= (sc->pre_h_ratio << 16) | sc->pre_v_ratio; | ||
| 376 | camif_write(camif, addr, cfg); | ||
| 377 | |||
| 378 | cfg = (sc->pre_dst_width << 16) | sc->pre_dst_height; | ||
| 379 | camif_write(camif, S3C_CAMIF_REG_CISCPREDST(vp->id, vp->offset), cfg); | ||
| 380 | } | ||
| 381 | |||
| 382 | void camif_s3c244x_hw_set_scaler(struct camif_vp *vp) | ||
| 383 | { | ||
| 384 | struct camif_dev *camif = vp->camif; | ||
| 385 | struct camif_scaler *scaler = &vp->scaler; | ||
| 386 | unsigned int color = vp->out_fmt->color; | ||
| 387 | u32 cfg; | ||
| 388 | |||
| 389 | camif_hw_set_prescaler(vp); | ||
| 390 | |||
| 391 | cfg = camif_read(camif, S3C_CAMIF_REG_CISCCTRL(vp->id, vp->offset)); | ||
| 392 | |||
| 393 | cfg &= ~(CISCCTRL_SCALEUP_MASK | CISCCTRL_SCALERBYPASS | | ||
| 394 | CISCCTRL_MAIN_RATIO_MASK | CIPRSCCTRL_RGB_FORMAT_24BIT); | ||
| 395 | |||
| 396 | if (scaler->enable) { | ||
| 397 | if (scaler->scaleup_h) { | ||
| 398 | if (vp->id == VP_CODEC) | ||
| 399 | cfg |= CISCCTRL_SCALEUP_H; | ||
| 400 | else | ||
| 401 | cfg |= CIPRSCCTRL_SCALEUP_H; | ||
| 402 | } | ||
| 403 | if (scaler->scaleup_v) { | ||
| 404 | if (vp->id == VP_CODEC) | ||
| 405 | cfg |= CISCCTRL_SCALEUP_V; | ||
| 406 | else | ||
| 407 | cfg |= CIPRSCCTRL_SCALEUP_V; | ||
| 408 | } | ||
| 409 | } else { | ||
| 410 | if (vp->id == VP_CODEC) | ||
| 411 | cfg |= CISCCTRL_SCALERBYPASS; | ||
| 412 | } | ||
| 413 | |||
| 414 | cfg |= ((scaler->main_h_ratio & 0x1ff) << 16); | ||
| 415 | cfg |= scaler->main_v_ratio & 0x1ff; | ||
| 416 | |||
| 417 | if (vp->id == VP_PREVIEW) { | ||
| 418 | if (color == IMG_FMT_XRGB8888) | ||
| 419 | cfg |= CIPRSCCTRL_RGB_FORMAT_24BIT; | ||
| 420 | cfg |= CIPRSCCTRL_SAMPLE; | ||
| 421 | } | ||
| 422 | |||
| 423 | camif_write(camif, S3C_CAMIF_REG_CISCCTRL(vp->id, vp->offset), cfg); | ||
| 424 | |||
| 425 | pr_debug("main: h_ratio: %#x, v_ratio: %#x", | ||
| 426 | scaler->main_h_ratio, scaler->main_v_ratio); | ||
| 427 | } | ||
| 428 | |||
| 429 | void camif_s3c64xx_hw_set_scaler(struct camif_vp *vp) | ||
| 430 | { | ||
| 431 | struct camif_dev *camif = vp->camif; | ||
| 432 | struct camif_scaler *scaler = &vp->scaler; | ||
| 433 | unsigned int color = vp->out_fmt->color; | ||
| 434 | u32 cfg; | ||
| 435 | |||
| 436 | camif_hw_set_prescaler(vp); | ||
| 437 | |||
| 438 | cfg = camif_read(camif, S3C_CAMIF_REG_CISCCTRL(vp->id, vp->offset)); | ||
| 439 | |||
| 440 | cfg &= ~(CISCCTRL_CSCR2Y_WIDE | CISCCTRL_CSCY2R_WIDE | ||
| 441 | | CISCCTRL_SCALEUP_H | CISCCTRL_SCALEUP_V | ||
| 442 | | CISCCTRL_SCALERBYPASS | CISCCTRL_ONE2ONE | ||
| 443 | | CISCCTRL_INRGB_FMT_MASK | CISCCTRL_OUTRGB_FMT_MASK | ||
| 444 | | CISCCTRL_INTERLACE | CISCCTRL_EXTRGB_EXTENSION | ||
| 445 | | CISCCTRL_MAIN_RATIO_MASK); | ||
| 446 | |||
| 447 | cfg |= (CISCCTRL_CSCR2Y_WIDE | CISCCTRL_CSCY2R_WIDE); | ||
| 448 | |||
| 449 | if (!scaler->enable) { | ||
| 450 | cfg |= CISCCTRL_SCALERBYPASS; | ||
| 451 | } else { | ||
| 452 | if (scaler->scaleup_h) | ||
| 453 | cfg |= CISCCTRL_SCALEUP_H; | ||
| 454 | if (scaler->scaleup_v) | ||
| 455 | cfg |= CISCCTRL_SCALEUP_V; | ||
| 456 | if (scaler->copy) | ||
| 457 | cfg |= CISCCTRL_ONE2ONE; | ||
| 458 | } | ||
| 459 | |||
| 460 | switch (color) { | ||
| 461 | case IMG_FMT_RGB666: | ||
| 462 | cfg |= CISCCTRL_OUTRGB_FMT_RGB666; | ||
| 463 | break; | ||
| 464 | case IMG_FMT_XRGB8888: | ||
| 465 | cfg |= CISCCTRL_OUTRGB_FMT_RGB888; | ||
| 466 | break; | ||
| 467 | } | ||
| 468 | |||
| 469 | cfg |= (scaler->main_h_ratio & 0x1ff) << 16; | ||
| 470 | cfg |= scaler->main_v_ratio & 0x1ff; | ||
| 471 | |||
| 472 | camif_write(camif, S3C_CAMIF_REG_CISCCTRL(vp->id, vp->offset), cfg); | ||
| 473 | |||
| 474 | pr_debug("main: h_ratio: %#x, v_ratio: %#x", | ||
| 475 | scaler->main_h_ratio, scaler->main_v_ratio); | ||
| 476 | } | ||
| 477 | |||
| 478 | void camif_hw_set_scaler(struct camif_vp *vp) | ||
| 479 | { | ||
| 480 | unsigned int ip_rev = vp->camif->variant->ip_revision; | ||
| 481 | |||
| 482 | if (ip_rev == S3C244X_CAMIF_IP_REV) | ||
| 483 | camif_s3c244x_hw_set_scaler(vp); | ||
| 484 | else | ||
| 485 | camif_s3c64xx_hw_set_scaler(vp); | ||
| 486 | } | ||
| 487 | |||
| 488 | void camif_hw_enable_scaler(struct camif_vp *vp, bool on) | ||
| 489 | { | ||
| 490 | u32 addr = S3C_CAMIF_REG_CISCCTRL(vp->id, vp->offset); | ||
| 491 | u32 cfg; | ||
| 492 | |||
| 493 | cfg = camif_read(vp->camif, addr); | ||
| 494 | if (on) | ||
| 495 | cfg |= CISCCTRL_SCALERSTART; | ||
| 496 | else | ||
| 497 | cfg &= ~CISCCTRL_SCALERSTART; | ||
| 498 | camif_write(vp->camif, addr, cfg); | ||
| 499 | } | ||
| 500 | |||
| 501 | void camif_hw_set_lastirq(struct camif_vp *vp, int enable) | ||
| 502 | { | ||
| 503 | u32 addr = S3C_CAMIF_REG_CICTRL(vp->id, vp->offset); | ||
| 504 | u32 cfg; | ||
| 505 | |||
| 506 | cfg = camif_read(vp->camif, addr); | ||
| 507 | if (enable) | ||
| 508 | cfg |= CICTRL_LASTIRQ_ENABLE; | ||
| 509 | else | ||
| 510 | cfg &= ~CICTRL_LASTIRQ_ENABLE; | ||
| 511 | camif_write(vp->camif, addr, cfg); | ||
| 512 | } | ||
| 513 | |||
| 514 | void camif_hw_enable_capture(struct camif_vp *vp) | ||
| 515 | { | ||
| 516 | struct camif_dev *camif = vp->camif; | ||
| 517 | u32 cfg; | ||
| 518 | |||
| 519 | cfg = camif_read(camif, S3C_CAMIF_REG_CIIMGCPT(vp->offset)); | ||
| 520 | camif->stream_count++; | ||
| 521 | |||
| 522 | if (camif->variant->ip_revision == S3C6410_CAMIF_IP_REV) | ||
| 523 | cfg |= CIIMGCPT_CPT_FREN_ENABLE(vp->id); | ||
| 524 | |||
| 525 | if (vp->scaler.enable) | ||
| 526 | cfg |= CIIMGCPT_IMGCPTEN_SC(vp->id); | ||
| 527 | |||
| 528 | if (camif->stream_count == 1) | ||
| 529 | cfg |= CIIMGCPT_IMGCPTEN; | ||
| 530 | |||
| 531 | camif_write(camif, S3C_CAMIF_REG_CIIMGCPT(vp->offset), cfg); | ||
| 532 | |||
| 533 | pr_debug("CIIMGCPT: %#x, camif->stream_count: %d\n", | ||
| 534 | cfg, camif->stream_count); | ||
| 535 | } | ||
| 536 | |||
| 537 | void camif_hw_disable_capture(struct camif_vp *vp) | ||
| 538 | { | ||
| 539 | struct camif_dev *camif = vp->camif; | ||
| 540 | u32 cfg; | ||
| 541 | |||
| 542 | cfg = camif_read(camif, S3C_CAMIF_REG_CIIMGCPT(vp->offset)); | ||
| 543 | cfg &= ~CIIMGCPT_IMGCPTEN_SC(vp->id); | ||
| 544 | |||
| 545 | if (WARN_ON(--(camif->stream_count) < 0)) | ||
| 546 | camif->stream_count = 0; | ||
| 547 | |||
| 548 | if (camif->stream_count == 0) | ||
| 549 | cfg &= ~CIIMGCPT_IMGCPTEN; | ||
| 550 | |||
| 551 | pr_debug("CIIMGCPT: %#x, camif->stream_count: %d\n", | ||
| 552 | cfg, camif->stream_count); | ||
| 553 | |||
| 554 | camif_write(camif, S3C_CAMIF_REG_CIIMGCPT(vp->offset), cfg); | ||
| 555 | } | ||
| 556 | |||
| 557 | void camif_hw_dump_regs(struct camif_dev *camif, const char *label) | ||
| 558 | { | ||
| 559 | struct { | ||
| 560 | u32 offset; | ||
| 561 | const char * const name; | ||
| 562 | } registers[] = { | ||
| 563 | { S3C_CAMIF_REG_CISRCFMT, "CISRCFMT" }, | ||
| 564 | { S3C_CAMIF_REG_CIWDOFST, "CIWDOFST" }, | ||
| 565 | { S3C_CAMIF_REG_CIGCTRL, "CIGCTRL" }, | ||
| 566 | { S3C_CAMIF_REG_CIWDOFST2, "CIWDOFST2" }, | ||
| 567 | { S3C_CAMIF_REG_CIYSA(0, 0), "CICOYSA0" }, | ||
| 568 | { S3C_CAMIF_REG_CICBSA(0, 0), "CICOCBSA0" }, | ||
| 569 | { S3C_CAMIF_REG_CICRSA(0, 0), "CICOCRSA0" }, | ||
| 570 | { S3C_CAMIF_REG_CIYSA(0, 1), "CICOYSA1" }, | ||
| 571 | { S3C_CAMIF_REG_CICBSA(0, 1), "CICOCBSA1" }, | ||
| 572 | { S3C_CAMIF_REG_CICRSA(0, 1), "CICOCRSA1" }, | ||
| 573 | { S3C_CAMIF_REG_CIYSA(0, 2), "CICOYSA2" }, | ||
| 574 | { S3C_CAMIF_REG_CICBSA(0, 2), "CICOCBSA2" }, | ||
| 575 | { S3C_CAMIF_REG_CICRSA(0, 2), "CICOCRSA2" }, | ||
| 576 | { S3C_CAMIF_REG_CIYSA(0, 3), "CICOYSA3" }, | ||
| 577 | { S3C_CAMIF_REG_CICBSA(0, 3), "CICOCBSA3" }, | ||
| 578 | { S3C_CAMIF_REG_CICRSA(0, 3), "CICOCRSA3" }, | ||
| 579 | { S3C_CAMIF_REG_CIYSA(1, 0), "CIPRYSA0" }, | ||
| 580 | { S3C_CAMIF_REG_CIYSA(1, 1), "CIPRYSA1" }, | ||
| 581 | { S3C_CAMIF_REG_CIYSA(1, 2), "CIPRYSA2" }, | ||
| 582 | { S3C_CAMIF_REG_CIYSA(1, 3), "CIPRYSA3" }, | ||
| 583 | { S3C_CAMIF_REG_CITRGFMT(0, 0), "CICOTRGFMT" }, | ||
| 584 | { S3C_CAMIF_REG_CITRGFMT(1, 0), "CIPRTRGFMT" }, | ||
| 585 | { S3C_CAMIF_REG_CICTRL(0, 0), "CICOCTRL" }, | ||
| 586 | { S3C_CAMIF_REG_CICTRL(1, 0), "CIPRCTRL" }, | ||
| 587 | { S3C_CAMIF_REG_CISCPREDST(0, 0), "CICOSCPREDST" }, | ||
| 588 | { S3C_CAMIF_REG_CISCPREDST(1, 0), "CIPRSCPREDST" }, | ||
| 589 | { S3C_CAMIF_REG_CISCPRERATIO(0, 0), "CICOSCPRERATIO" }, | ||
| 590 | { S3C_CAMIF_REG_CISCPRERATIO(1, 0), "CIPRSCPRERATIO" }, | ||
| 591 | { S3C_CAMIF_REG_CISCCTRL(0, 0), "CICOSCCTRL" }, | ||
| 592 | { S3C_CAMIF_REG_CISCCTRL(1, 0), "CIPRSCCTRL" }, | ||
| 593 | { S3C_CAMIF_REG_CITAREA(0, 0), "CICOTAREA" }, | ||
| 594 | { S3C_CAMIF_REG_CITAREA(1, 0), "CIPRTAREA" }, | ||
| 595 | { S3C_CAMIF_REG_CISTATUS(0, 0), "CICOSTATUS" }, | ||
| 596 | { S3C_CAMIF_REG_CISTATUS(1, 0), "CIPRSTATUS" }, | ||
| 597 | { S3C_CAMIF_REG_CIIMGCPT(0), "CIIMGCPT" }, | ||
| 598 | }; | ||
| 599 | u32 i; | ||
| 600 | |||
| 601 | pr_info("--- %s ---\n", label); | ||
| 602 | for (i = 0; i < ARRAY_SIZE(registers); i++) { | ||
| 603 | u32 cfg = readl(camif->io_base + registers[i].offset); | ||
| 604 | printk(KERN_INFO "%s:\t0x%08x\n", registers[i].name, cfg); | ||
| 605 | } | ||
| 606 | } | ||
diff --git a/drivers/media/platform/s3c-camif/camif-regs.h b/drivers/media/platform/s3c-camif/camif-regs.h new file mode 100644 index 000000000000..af2d472ea1dd --- /dev/null +++ b/drivers/media/platform/s3c-camif/camif-regs.h | |||
| @@ -0,0 +1,269 @@ | |||
| 1 | /* | ||
| 2 | * Register definition file for s3c24xx/s3c64xx SoC CAMIF driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
| 5 | * Copyright (C) 2012 Tomasz Figa <tomasz.figa@gmail.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef CAMIF_REGS_H_ | ||
| 13 | #define CAMIF_REGS_H_ | ||
| 14 | |||
| 15 | #include "camif-core.h" | ||
| 16 | #include <media/s3c_camif.h> | ||
| 17 | |||
| 18 | /* | ||
| 19 | * The id argument indicates the processing path: | ||
| 20 | * id = 0 - codec (FIMC C), 1 - preview (FIMC P). | ||
| 21 | */ | ||
| 22 | |||
| 23 | /* Camera input format */ | ||
| 24 | #define S3C_CAMIF_REG_CISRCFMT 0x00 | ||
| 25 | #define CISRCFMT_ITU601_8BIT (1 << 31) | ||
| 26 | #define CISRCFMT_ITU656_8BIT (0 << 31) | ||
| 27 | #define CISRCFMT_ORDER422_YCBYCR (0 << 14) | ||
| 28 | #define CISRCFMT_ORDER422_YCRYCB (1 << 14) | ||
| 29 | #define CISRCFMT_ORDER422_CBYCRY (2 << 14) | ||
| 30 | #define CISRCFMT_ORDER422_CRYCBY (3 << 14) | ||
| 31 | #define CISRCFMT_ORDER422_MASK (3 << 14) | ||
| 32 | #define CISRCFMT_SIZE_CAM_MASK (0x1fff << 16 | 0x1fff) | ||
| 33 | |||
| 34 | /* Window offset */ | ||
| 35 | #define S3C_CAMIF_REG_CIWDOFST 0x04 | ||
| 36 | #define CIWDOFST_WINOFSEN (1 << 31) | ||
| 37 | #define CIWDOFST_CLROVCOFIY (1 << 30) | ||
| 38 | #define CIWDOFST_CLROVRLB_PR (1 << 28) | ||
| 39 | /* #define CIWDOFST_CLROVPRFIY (1 << 27) */ | ||
| 40 | #define CIWDOFST_CLROVCOFICB (1 << 15) | ||
| 41 | #define CIWDOFST_CLROVCOFICR (1 << 14) | ||
| 42 | #define CIWDOFST_CLROVPRFICB (1 << 13) | ||
| 43 | #define CIWDOFST_CLROVPRFICR (1 << 12) | ||
| 44 | #define CIWDOFST_OFST_MASK (0x7ff << 16 | 0x7ff) | ||
| 45 | |||
| 46 | /* Window offset 2 */ | ||
| 47 | #define S3C_CAMIF_REG_CIWDOFST2 0x14 | ||
| 48 | #define CIWDOFST2_OFST2_MASK (0xfff << 16 | 0xfff) | ||
| 49 | |||
| 50 | /* Global control */ | ||
| 51 | #define S3C_CAMIF_REG_CIGCTRL 0x08 | ||
| 52 | #define CIGCTRL_SWRST (1 << 31) | ||
| 53 | #define CIGCTRL_CAMRST (1 << 30) | ||
| 54 | #define CIGCTRL_TESTPATTERN_NORMAL (0 << 27) | ||
| 55 | #define CIGCTRL_TESTPATTERN_COLOR_BAR (1 << 27) | ||
| 56 | #define CIGCTRL_TESTPATTERN_HOR_INC (2 << 27) | ||
| 57 | #define CIGCTRL_TESTPATTERN_VER_INC (3 << 27) | ||
| 58 | #define CIGCTRL_TESTPATTERN_MASK (3 << 27) | ||
| 59 | #define CIGCTRL_INVPOLPCLK (1 << 26) | ||
| 60 | #define CIGCTRL_INVPOLVSYNC (1 << 25) | ||
| 61 | #define CIGCTRL_INVPOLHREF (1 << 24) | ||
| 62 | #define CIGCTRL_IRQ_OVFEN (1 << 22) | ||
| 63 | #define CIGCTRL_HREF_MASK (1 << 21) | ||
| 64 | #define CIGCTRL_IRQ_LEVEL (1 << 20) | ||
| 65 | /* IRQ_CLR_C, IRQ_CLR_P */ | ||
| 66 | #define CIGCTRL_IRQ_CLR(id) (1 << (19 - (id))) | ||
| 67 | #define CIGCTRL_FIELDMODE (1 << 2) | ||
| 68 | #define CIGCTRL_INVPOLFIELD (1 << 1) | ||
| 69 | #define CIGCTRL_CAM_INTERLACE (1 << 0) | ||
| 70 | |||
| 71 | /* Y DMA output frame start address. n = 0..3. */ | ||
| 72 | #define S3C_CAMIF_REG_CIYSA(id, n) (0x18 + (id) * 0x54 + (n) * 4) | ||
| 73 | /* Cb plane output DMA start address. n = 0..3. Only codec path. */ | ||
| 74 | #define S3C_CAMIF_REG_CICBSA(id, n) (0x28 + (id) * 0x54 + (n) * 4) | ||
| 75 | /* Cr plane output DMA start address. n = 0..3. Only codec path. */ | ||
| 76 | #define S3C_CAMIF_REG_CICRSA(id, n) (0x38 + (id) * 0x54 + (n) * 4) | ||
| 77 | |||
| 78 | /* CICOTRGFMT, CIPRTRGFMT - Target format */ | ||
| 79 | #define S3C_CAMIF_REG_CITRGFMT(id, _offs) (0x48 + (id) * (0x34 + (_offs))) | ||
| 80 | #define CITRGFMT_IN422 (1 << 31) /* only for s3c24xx */ | ||
| 81 | #define CITRGFMT_OUT422 (1 << 30) /* only for s3c24xx */ | ||
| 82 | #define CITRGFMT_OUTFORMAT_YCBCR420 (0 << 29) /* only for s3c6410 */ | ||
| 83 | #define CITRGFMT_OUTFORMAT_YCBCR422 (1 << 29) /* only for s3c6410 */ | ||
| 84 | #define CITRGFMT_OUTFORMAT_YCBCR422I (2 << 29) /* only for s3c6410 */ | ||
| 85 | #define CITRGFMT_OUTFORMAT_RGB (3 << 29) /* only for s3c6410 */ | ||
| 86 | #define CITRGFMT_OUTFORMAT_MASK (3 << 29) /* only for s3c6410 */ | ||
| 87 | #define CITRGFMT_TARGETHSIZE(x) ((x) << 16) | ||
| 88 | #define CITRGFMT_FLIP_NORMAL (0 << 14) | ||
| 89 | #define CITRGFMT_FLIP_X_MIRROR (1 << 14) | ||
| 90 | #define CITRGFMT_FLIP_Y_MIRROR (2 << 14) | ||
| 91 | #define CITRGFMT_FLIP_180 (3 << 14) | ||
| 92 | #define CITRGFMT_FLIP_MASK (3 << 14) | ||
| 93 | /* Preview path only */ | ||
| 94 | #define CITRGFMT_ROT90_PR (1 << 13) | ||
| 95 | #define CITRGFMT_TARGETVSIZE(x) ((x) << 0) | ||
| 96 | #define CITRGFMT_TARGETSIZE_MASK ((0x1fff << 16) | 0x1fff) | ||
| 97 | |||
| 98 | /* CICOCTRL, CIPRCTRL. Output DMA control. */ | ||
| 99 | #define S3C_CAMIF_REG_CICTRL(id, _offs) (0x4c + (id) * (0x34 + (_offs))) | ||
| 100 | #define CICTRL_BURST_MASK (0xfffff << 4) | ||
| 101 | /* xBURSTn - 5-bits width */ | ||
| 102 | #define CICTRL_YBURST1(x) ((x) << 19) | ||
| 103 | #define CICTRL_YBURST2(x) ((x) << 14) | ||
| 104 | #define CICTRL_RGBBURST1(x) ((x) << 19) | ||
| 105 | #define CICTRL_RGBBURST2(x) ((x) << 14) | ||
| 106 | #define CICTRL_CBURST1(x) ((x) << 9) | ||
| 107 | #define CICTRL_CBURST2(x) ((x) << 4) | ||
| 108 | #define CICTRL_LASTIRQ_ENABLE (1 << 2) | ||
| 109 | #define CICTRL_ORDER422_MASK (3 << 0) | ||
| 110 | |||
| 111 | /* CICOSCPRERATIO, CIPRSCPRERATIO. Pre-scaler control 1. */ | ||
| 112 | #define S3C_CAMIF_REG_CISCPRERATIO(id, _offs) (0x50 + (id) * (0x34 + (_offs))) | ||
| 113 | |||
| 114 | /* CICOSCPREDST, CIPRSCPREDST. Pre-scaler control 2. */ | ||
| 115 | #define S3C_CAMIF_REG_CISCPREDST(id, _offs) (0x54 + (id) * (0x34 + (_offs))) | ||
| 116 | |||
| 117 | /* CICOSCCTRL, CIPRSCCTRL. Main scaler control. */ | ||
| 118 | #define S3C_CAMIF_REG_CISCCTRL(id, _offs) (0x58 + (id) * (0x34 + (_offs))) | ||
| 119 | #define CISCCTRL_SCALERBYPASS (1 << 31) | ||
| 120 | /* s3c244x preview path only, s3c64xx both */ | ||
| 121 | #define CIPRSCCTRL_SAMPLE (1 << 31) | ||
| 122 | /* 0 - 16-bit RGB, 1 - 24-bit RGB */ | ||
| 123 | #define CIPRSCCTRL_RGB_FORMAT_24BIT (1 << 30) /* only for s3c244x */ | ||
| 124 | #define CIPRSCCTRL_SCALEUP_H (1 << 29) /* only for s3c244x */ | ||
| 125 | #define CIPRSCCTRL_SCALEUP_V (1 << 28) /* only for s3c244x */ | ||
| 126 | /* s3c64xx */ | ||
| 127 | #define CISCCTRL_SCALEUP_H (1 << 30) | ||
| 128 | #define CISCCTRL_SCALEUP_V (1 << 29) | ||
| 129 | #define CISCCTRL_SCALEUP_MASK (0x3 << 29) | ||
| 130 | #define CISCCTRL_CSCR2Y_WIDE (1 << 28) | ||
| 131 | #define CISCCTRL_CSCY2R_WIDE (1 << 27) | ||
| 132 | #define CISCCTRL_LCDPATHEN_FIFO (1 << 26) | ||
| 133 | #define CISCCTRL_INTERLACE (1 << 25) | ||
| 134 | #define CISCCTRL_SCALERSTART (1 << 15) | ||
| 135 | #define CISCCTRL_INRGB_FMT_RGB565 (0 << 13) | ||
| 136 | #define CISCCTRL_INRGB_FMT_RGB666 (1 << 13) | ||
| 137 | #define CISCCTRL_INRGB_FMT_RGB888 (2 << 13) | ||
| 138 | #define CISCCTRL_INRGB_FMT_MASK (3 << 13) | ||
| 139 | #define CISCCTRL_OUTRGB_FMT_RGB565 (0 << 11) | ||
| 140 | #define CISCCTRL_OUTRGB_FMT_RGB666 (1 << 11) | ||
| 141 | #define CISCCTRL_OUTRGB_FMT_RGB888 (2 << 11) | ||
| 142 | #define CISCCTRL_OUTRGB_FMT_MASK (3 << 11) | ||
| 143 | #define CISCCTRL_EXTRGB_EXTENSION (1 << 10) | ||
| 144 | #define CISCCTRL_ONE2ONE (1 << 9) | ||
| 145 | #define CISCCTRL_MAIN_RATIO_MASK (0x1ff << 16 | 0x1ff) | ||
| 146 | |||
| 147 | /* CICOTAREA, CIPRTAREA. Target area for DMA (Hsize x Vsize). */ | ||
| 148 | #define S3C_CAMIF_REG_CITAREA(id, _offs) (0x5c + (id) * (0x34 + (_offs))) | ||
| 149 | #define CITAREA_MASK 0xfffffff | ||
| 150 | |||
| 151 | /* Codec (id = 0) or preview (id = 1) path status. */ | ||
| 152 | #define S3C_CAMIF_REG_CISTATUS(id, _offs) (0x64 + (id) * (0x34 + (_offs))) | ||
| 153 | #define CISTATUS_OVFIY_STATUS (1 << 31) | ||
| 154 | #define CISTATUS_OVFICB_STATUS (1 << 30) | ||
| 155 | #define CISTATUS_OVFICR_STATUS (1 << 29) | ||
| 156 | #define CISTATUS_OVF_MASK (0x7 << 29) | ||
| 157 | #define CIPRSTATUS_OVF_MASK (0x3 << 30) | ||
| 158 | #define CISTATUS_VSYNC_STATUS (1 << 28) | ||
| 159 | #define CISTATUS_FRAMECNT_MASK (3 << 26) | ||
| 160 | #define CISTATUS_FRAMECNT(__reg) (((__reg) >> 26) & 0x3) | ||
| 161 | #define CISTATUS_WINOFSTEN_STATUS (1 << 25) | ||
| 162 | #define CISTATUS_IMGCPTEN_STATUS (1 << 22) | ||
| 163 | #define CISTATUS_IMGCPTENSC_STATUS (1 << 21) | ||
| 164 | #define CISTATUS_VSYNC_A_STATUS (1 << 20) | ||
| 165 | #define CISTATUS_FRAMEEND_STATUS (1 << 19) /* 17 on s3c64xx */ | ||
| 166 | |||
| 167 | /* Image capture enable */ | ||
| 168 | #define S3C_CAMIF_REG_CIIMGCPT(_offs) (0xa0 + (_offs)) | ||
| 169 | #define CIIMGCPT_IMGCPTEN (1 << 31) | ||
| 170 | #define CIIMGCPT_IMGCPTEN_SC(id) (1 << (30 - (id))) | ||
| 171 | /* Frame control: 1 - one-shot, 0 - free run */ | ||
| 172 | #define CIIMGCPT_CPT_FREN_ENABLE(id) (1 << (25 - (id))) | ||
| 173 | #define CIIMGCPT_CPT_FRMOD_ENABLE (0 << 18) | ||
| 174 | #define CIIMGCPT_CPT_FRMOD_CNT (1 << 18) | ||
| 175 | |||
| 176 | /* Capture sequence */ | ||
| 177 | #define S3C_CAMIF_REG_CICPTSEQ 0xc4 | ||
| 178 | |||
| 179 | /* Image effects */ | ||
| 180 | #define S3C_CAMIF_REG_CIIMGEFF(_offs) (0xb0 + (_offs)) | ||
| 181 | #define CIIMGEFF_IE_ENABLE(id) (1 << (30 + (id))) | ||
| 182 | #define CIIMGEFF_IE_ENABLE_MASK (3 << 30) | ||
| 183 | /* Image effect: 1 - after scaler, 0 - before scaler */ | ||
| 184 | #define CIIMGEFF_IE_AFTER_SC (1 << 29) | ||
| 185 | #define CIIMGEFF_FIN_MASK (7 << 26) | ||
| 186 | #define CIIMGEFF_FIN_BYPASS (0 << 26) | ||
| 187 | #define CIIMGEFF_FIN_ARBITRARY (1 << 26) | ||
| 188 | #define CIIMGEFF_FIN_NEGATIVE (2 << 26) | ||
| 189 | #define CIIMGEFF_FIN_ARTFREEZE (3 << 26) | ||
| 190 | #define CIIMGEFF_FIN_EMBOSSING (4 << 26) | ||
| 191 | #define CIIMGEFF_FIN_SILHOUETTE (5 << 26) | ||
| 192 | #define CIIMGEFF_PAT_CBCR_MASK ((0xff << 13) | 0xff) | ||
| 193 | #define CIIMGEFF_PAT_CB(x) ((x) << 13) | ||
| 194 | #define CIIMGEFF_PAT_CR(x) (x) | ||
| 195 | |||
| 196 | /* MSCOY0SA, MSPRY0SA. Y/Cb/Cr frame start address for input DMA. */ | ||
| 197 | #define S3C_CAMIF_REG_MSY0SA(id) (0xd4 + ((id) * 0x2c)) | ||
| 198 | #define S3C_CAMIF_REG_MSCB0SA(id) (0xd8 + ((id) * 0x2c)) | ||
| 199 | #define S3C_CAMIF_REG_MSCR0SA(id) (0xdc + ((id) * 0x2c)) | ||
| 200 | |||
| 201 | /* MSCOY0END, MSCOY0END. Y/Cb/Cr frame end address for input DMA. */ | ||
| 202 | #define S3C_CAMIF_REG_MSY0END(id) (0xe0 + ((id) * 0x2c)) | ||
| 203 | #define S3C_CAMIF_REG_MSCB0END(id) (0xe4 + ((id) * 0x2c)) | ||
| 204 | #define S3C_CAMIF_REG_MSCR0END(id) (0xe8 + ((id) * 0x2c)) | ||
| 205 | |||
| 206 | /* MSPRYOFF, MSPRYOFF. Y/Cb/Cr offset. n: 0 - codec, 1 - preview. */ | ||
| 207 | #define S3C_CAMIF_REG_MSYOFF(id) (0x118 + ((id) * 0x2c)) | ||
| 208 | #define S3C_CAMIF_REG_MSCBOFF(id) (0x11c + ((id) * 0x2c)) | ||
| 209 | #define S3C_CAMIF_REG_MSCROFF(id) (0x120 + ((id) * 0x2c)) | ||
| 210 | |||
| 211 | /* Real input DMA data size. n = 0 - codec, 1 - preview. */ | ||
| 212 | #define S3C_CAMIF_REG_MSWIDTH(id) (0xf8 + (id) * 0x2c) | ||
| 213 | #define AUTOLOAD_ENABLE (1 << 31) | ||
| 214 | #define ADDR_CH_DIS (1 << 30) | ||
| 215 | #define MSHEIGHT(x) (((x) & 0x3ff) << 16) | ||
| 216 | #define MSWIDTH(x) ((x) & 0x3ff) | ||
| 217 | |||
| 218 | /* Input DMA control. n = 0 - codec, 1 - preview */ | ||
| 219 | #define S3C_CAMIF_REG_MSCTRL(id) (0xfc + (id) * 0x2c) | ||
| 220 | #define MSCTRL_ORDER422_M_YCBYCR (0 << 4) | ||
| 221 | #define MSCTRL_ORDER422_M_YCRYCB (1 << 4) | ||
| 222 | #define MSCTRL_ORDER422_M_CBYCRY (2 << 4) | ||
| 223 | #define MSCTRL_ORDER422_M_CRYCBY (3 << 4) | ||
| 224 | /* 0 - camera, 1 - DMA */ | ||
| 225 | #define MSCTRL_SEL_DMA_CAM (1 << 3) | ||
| 226 | #define MSCTRL_INFORMAT_M_YCBCR420 (0 << 1) | ||
| 227 | #define MSCTRL_INFORMAT_M_YCBCR422 (1 << 1) | ||
| 228 | #define MSCTRL_INFORMAT_M_YCBCR422I (2 << 1) | ||
| 229 | #define MSCTRL_INFORMAT_M_RGB (3 << 1) | ||
| 230 | #define MSCTRL_ENVID_M (1 << 0) | ||
| 231 | |||
| 232 | /* CICOSCOSY, CIPRSCOSY. Scan line Y/Cb/Cr offset. */ | ||
| 233 | #define S3C_CAMIF_REG_CISSY(id) (0x12c + (id) * 0x0c) | ||
| 234 | #define S3C_CAMIF_REG_CISSCB(id) (0x130 + (id) * 0x0c) | ||
| 235 | #define S3C_CAMIF_REG_CISSCR(id) (0x134 + (id) * 0x0c) | ||
| 236 | #define S3C_CISS_OFFS_INITIAL(x) ((x) << 16) | ||
| 237 | #define S3C_CISS_OFFS_LINE(x) ((x) << 0) | ||
| 238 | |||
| 239 | /* ------------------------------------------------------------------ */ | ||
| 240 | |||
| 241 | void camif_hw_reset(struct camif_dev *camif); | ||
| 242 | void camif_hw_clear_pending_irq(struct camif_vp *vp); | ||
| 243 | void camif_hw_clear_fifo_overflow(struct camif_vp *vp); | ||
| 244 | void camif_hw_set_lastirq(struct camif_vp *vp, int enable); | ||
| 245 | void camif_hw_set_input_path(struct camif_vp *vp); | ||
| 246 | void camif_hw_enable_scaler(struct camif_vp *vp, bool on); | ||
| 247 | void camif_hw_enable_capture(struct camif_vp *vp); | ||
| 248 | void camif_hw_disable_capture(struct camif_vp *vp); | ||
| 249 | void camif_hw_set_camera_bus(struct camif_dev *camif); | ||
| 250 | void camif_hw_set_source_format(struct camif_dev *camif); | ||
| 251 | void camif_hw_set_camera_crop(struct camif_dev *camif); | ||
| 252 | void camif_hw_set_scaler(struct camif_vp *vp); | ||
| 253 | void camif_hw_set_flip(struct camif_vp *vp); | ||
| 254 | void camif_hw_set_output_dma(struct camif_vp *vp); | ||
| 255 | void camif_hw_set_target_format(struct camif_vp *vp); | ||
| 256 | void camif_hw_set_test_pattern(struct camif_dev *camif, unsigned int pattern); | ||
| 257 | void camif_hw_set_effect(struct camif_dev *camif, unsigned int effect, | ||
| 258 | unsigned int cr, unsigned int cb); | ||
| 259 | void camif_hw_set_output_addr(struct camif_vp *vp, struct camif_addr *paddr, | ||
| 260 | int index); | ||
| 261 | void camif_hw_dump_regs(struct camif_dev *camif, const char *label); | ||
| 262 | |||
| 263 | static inline u32 camif_hw_get_status(struct camif_vp *vp) | ||
| 264 | { | ||
| 265 | return readl(vp->camif->io_base + S3C_CAMIF_REG_CISTATUS(vp->id, | ||
| 266 | vp->offset)); | ||
| 267 | } | ||
| 268 | |||
| 269 | #endif /* CAMIF_REGS_H_ */ | ||
diff --git a/drivers/media/platform/s5p-fimc/Kconfig b/drivers/media/platform/s5p-fimc/Kconfig index 8f090a8f270e..c16b20d86ed2 100644 --- a/drivers/media/platform/s5p-fimc/Kconfig +++ b/drivers/media/platform/s5p-fimc/Kconfig | |||
| @@ -24,6 +24,7 @@ config VIDEO_S5P_FIMC | |||
| 24 | config VIDEO_S5P_MIPI_CSIS | 24 | config VIDEO_S5P_MIPI_CSIS |
| 25 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" | 25 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" |
| 26 | depends on REGULATOR | 26 | depends on REGULATOR |
| 27 | select S5P_SETUP_MIPIPHY | ||
| 27 | help | 28 | help |
| 28 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 | 29 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 |
| 29 | receiver (MIPI-CSIS) devices. | 30 | receiver (MIPI-CSIS) devices. |
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c index 367efd164d0f..fdb6740248a7 100644 --- a/drivers/media/platform/s5p-fimc/fimc-capture.c +++ b/drivers/media/platform/s5p-fimc/fimc-capture.c | |||
| @@ -556,8 +556,7 @@ static int fimc_capture_close(struct file *file) | |||
| 556 | 556 | ||
| 557 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); | 557 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); |
| 558 | 558 | ||
| 559 | if (mutex_lock_interruptible(&fimc->lock)) | 559 | mutex_lock(&fimc->lock); |
| 560 | return -ERESTARTSYS; | ||
| 561 | 560 | ||
| 562 | if (--fimc->vid_cap.refcnt == 0) { | 561 | if (--fimc->vid_cap.refcnt == 0) { |
| 563 | clear_bit(ST_CAPT_BUSY, &fimc->state); | 562 | clear_bit(ST_CAPT_BUSY, &fimc->state); |
| @@ -1231,6 +1230,14 @@ static int fimc_cap_qbuf(struct file *file, void *priv, | |||
| 1231 | return vb2_qbuf(&fimc->vid_cap.vbq, buf); | 1230 | return vb2_qbuf(&fimc->vid_cap.vbq, buf); |
| 1232 | } | 1231 | } |
| 1233 | 1232 | ||
| 1233 | static int fimc_cap_expbuf(struct file *file, void *priv, | ||
| 1234 | struct v4l2_exportbuffer *eb) | ||
| 1235 | { | ||
| 1236 | struct fimc_dev *fimc = video_drvdata(file); | ||
| 1237 | |||
| 1238 | return vb2_expbuf(&fimc->vid_cap.vbq, eb); | ||
| 1239 | } | ||
| 1240 | |||
| 1234 | static int fimc_cap_dqbuf(struct file *file, void *priv, | 1241 | static int fimc_cap_dqbuf(struct file *file, void *priv, |
| 1235 | struct v4l2_buffer *buf) | 1242 | struct v4l2_buffer *buf) |
| 1236 | { | 1243 | { |
| @@ -1355,6 +1362,7 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = { | |||
| 1355 | 1362 | ||
| 1356 | .vidioc_qbuf = fimc_cap_qbuf, | 1363 | .vidioc_qbuf = fimc_cap_qbuf, |
| 1357 | .vidioc_dqbuf = fimc_cap_dqbuf, | 1364 | .vidioc_dqbuf = fimc_cap_dqbuf, |
| 1365 | .vidioc_expbuf = fimc_cap_expbuf, | ||
| 1358 | 1366 | ||
| 1359 | .vidioc_prepare_buf = fimc_cap_prepare_buf, | 1367 | .vidioc_prepare_buf = fimc_cap_prepare_buf, |
| 1360 | .vidioc_create_bufs = fimc_cap_create_bufs, | 1368 | .vidioc_create_bufs = fimc_cap_create_bufs, |
| @@ -1730,13 +1738,15 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, | |||
| 1730 | q = &fimc->vid_cap.vbq; | 1738 | q = &fimc->vid_cap.vbq; |
| 1731 | memset(q, 0, sizeof(*q)); | 1739 | memset(q, 0, sizeof(*q)); |
| 1732 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1740 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 1733 | q->io_modes = VB2_MMAP | VB2_USERPTR; | 1741 | q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; |
| 1734 | q->drv_priv = fimc->vid_cap.ctx; | 1742 | q->drv_priv = fimc->vid_cap.ctx; |
| 1735 | q->ops = &fimc_capture_qops; | 1743 | q->ops = &fimc_capture_qops; |
| 1736 | q->mem_ops = &vb2_dma_contig_memops; | 1744 | q->mem_ops = &vb2_dma_contig_memops; |
| 1737 | q->buf_struct_size = sizeof(struct fimc_vid_buffer); | 1745 | q->buf_struct_size = sizeof(struct fimc_vid_buffer); |
| 1738 | 1746 | ||
| 1739 | vb2_queue_init(q); | 1747 | ret = vb2_queue_init(q); |
| 1748 | if (ret) | ||
| 1749 | goto err_ent; | ||
| 1740 | 1750 | ||
| 1741 | vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; | 1751 | vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; |
| 1742 | ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); | 1752 | ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); |
| @@ -1772,9 +1782,13 @@ static int fimc_capture_subdev_registered(struct v4l2_subdev *sd) | |||
| 1772 | if (ret) | 1782 | if (ret) |
| 1773 | return ret; | 1783 | return ret; |
| 1774 | 1784 | ||
| 1785 | fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd); | ||
| 1786 | |||
| 1775 | ret = fimc_register_capture_device(fimc, sd->v4l2_dev); | 1787 | ret = fimc_register_capture_device(fimc, sd->v4l2_dev); |
| 1776 | if (ret) | 1788 | if (ret) { |
| 1777 | fimc_unregister_m2m_device(fimc); | 1789 | fimc_unregister_m2m_device(fimc); |
| 1790 | fimc->pipeline_ops = NULL; | ||
| 1791 | } | ||
| 1778 | 1792 | ||
| 1779 | return ret; | 1793 | return ret; |
| 1780 | } | 1794 | } |
| @@ -1791,6 +1805,7 @@ static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd) | |||
| 1791 | if (video_is_registered(&fimc->vid_cap.vfd)) { | 1805 | if (video_is_registered(&fimc->vid_cap.vfd)) { |
| 1792 | video_unregister_device(&fimc->vid_cap.vfd); | 1806 | video_unregister_device(&fimc->vid_cap.vfd); |
| 1793 | media_entity_cleanup(&fimc->vid_cap.vfd.entity); | 1807 | media_entity_cleanup(&fimc->vid_cap.vfd.entity); |
| 1808 | fimc->pipeline_ops = NULL; | ||
| 1794 | } | 1809 | } |
| 1795 | kfree(fimc->vid_cap.ctx); | 1810 | kfree(fimc->vid_cap.ctx); |
| 1796 | fimc->vid_cap.ctx = NULL; | 1811 | fimc->vid_cap.ctx = NULL; |
diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index 8d0d2b94a135..545b46ae12a1 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c | |||
| @@ -1035,7 +1035,7 @@ static int fimc_suspend(struct device *dev) | |||
| 1035 | } | 1035 | } |
| 1036 | #endif /* CONFIG_PM_SLEEP */ | 1036 | #endif /* CONFIG_PM_SLEEP */ |
| 1037 | 1037 | ||
| 1038 | static int __devexit fimc_remove(struct platform_device *pdev) | 1038 | static int fimc_remove(struct platform_device *pdev) |
| 1039 | { | 1039 | { |
| 1040 | struct fimc_dev *fimc = platform_get_drvdata(pdev); | 1040 | struct fimc_dev *fimc = platform_get_drvdata(pdev); |
| 1041 | 1041 | ||
| @@ -1234,7 +1234,7 @@ static const struct dev_pm_ops fimc_pm_ops = { | |||
| 1234 | 1234 | ||
| 1235 | static struct platform_driver fimc_driver = { | 1235 | static struct platform_driver fimc_driver = { |
| 1236 | .probe = fimc_probe, | 1236 | .probe = fimc_probe, |
| 1237 | .remove = __devexit_p(fimc_remove), | 1237 | .remove = fimc_remove, |
| 1238 | .id_table = fimc_driver_ids, | 1238 | .id_table = fimc_driver_ids, |
| 1239 | .driver = { | 1239 | .driver = { |
| 1240 | .name = FIMC_MODULE_NAME, | 1240 | .name = FIMC_MODULE_NAME, |
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c index 70bcf39de879..ed67220d0a64 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c | |||
| @@ -491,8 +491,7 @@ static int fimc_lite_close(struct file *file) | |||
| 491 | struct fimc_lite *fimc = video_drvdata(file); | 491 | struct fimc_lite *fimc = video_drvdata(file); |
| 492 | int ret; | 492 | int ret; |
| 493 | 493 | ||
| 494 | if (mutex_lock_interruptible(&fimc->lock)) | 494 | mutex_lock(&fimc->lock); |
| 495 | return -ERESTARTSYS; | ||
| 496 | 495 | ||
| 497 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { | 496 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { |
| 498 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 497 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
| @@ -1253,7 +1252,9 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) | |||
| 1253 | q->buf_struct_size = sizeof(struct flite_buffer); | 1252 | q->buf_struct_size = sizeof(struct flite_buffer); |
| 1254 | q->drv_priv = fimc; | 1253 | q->drv_priv = fimc; |
| 1255 | 1254 | ||
| 1256 | vb2_queue_init(q); | 1255 | ret = vb2_queue_init(q); |
| 1256 | if (ret < 0) | ||
| 1257 | return ret; | ||
| 1257 | 1258 | ||
| 1258 | fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; | 1259 | fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; |
| 1259 | ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); | 1260 | ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); |
| @@ -1261,10 +1262,12 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) | |||
| 1261 | return ret; | 1262 | return ret; |
| 1262 | 1263 | ||
| 1263 | video_set_drvdata(vfd, fimc); | 1264 | video_set_drvdata(vfd, fimc); |
| 1265 | fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd); | ||
| 1264 | 1266 | ||
| 1265 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); | 1267 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); |
| 1266 | if (ret < 0) { | 1268 | if (ret < 0) { |
| 1267 | media_entity_cleanup(&vfd->entity); | 1269 | media_entity_cleanup(&vfd->entity); |
| 1270 | fimc->pipeline_ops = NULL; | ||
| 1268 | return ret; | 1271 | return ret; |
| 1269 | } | 1272 | } |
| 1270 | 1273 | ||
| @@ -1283,6 +1286,7 @@ static void fimc_lite_subdev_unregistered(struct v4l2_subdev *sd) | |||
| 1283 | if (video_is_registered(&fimc->vfd)) { | 1286 | if (video_is_registered(&fimc->vfd)) { |
| 1284 | video_unregister_device(&fimc->vfd); | 1287 | video_unregister_device(&fimc->vfd); |
| 1285 | media_entity_cleanup(&fimc->vfd.entity); | 1288 | media_entity_cleanup(&fimc->vfd.entity); |
| 1289 | fimc->pipeline_ops = NULL; | ||
| 1286 | } | 1290 | } |
| 1287 | } | 1291 | } |
| 1288 | 1292 | ||
| @@ -1402,7 +1406,7 @@ static int fimc_lite_clk_get(struct fimc_lite *fimc) | |||
| 1402 | return ret; | 1406 | return ret; |
| 1403 | } | 1407 | } |
| 1404 | 1408 | ||
| 1405 | static int __devinit fimc_lite_probe(struct platform_device *pdev) | 1409 | static int fimc_lite_probe(struct platform_device *pdev) |
| 1406 | { | 1410 | { |
| 1407 | struct flite_drvdata *drv_data = fimc_lite_get_drvdata(pdev); | 1411 | struct flite_drvdata *drv_data = fimc_lite_get_drvdata(pdev); |
| 1408 | struct fimc_lite *fimc; | 1412 | struct fimc_lite *fimc; |
| @@ -1543,7 +1547,7 @@ static int fimc_lite_suspend(struct device *dev) | |||
| 1543 | } | 1547 | } |
| 1544 | #endif /* CONFIG_PM_SLEEP */ | 1548 | #endif /* CONFIG_PM_SLEEP */ |
| 1545 | 1549 | ||
| 1546 | static int __devexit fimc_lite_remove(struct platform_device *pdev) | 1550 | static int fimc_lite_remove(struct platform_device *pdev) |
| 1547 | { | 1551 | { |
| 1548 | struct fimc_lite *fimc = platform_get_drvdata(pdev); | 1552 | struct fimc_lite *fimc = platform_get_drvdata(pdev); |
| 1549 | struct device *dev = &pdev->dev; | 1553 | struct device *dev = &pdev->dev; |
| @@ -1591,7 +1595,7 @@ static const struct dev_pm_ops fimc_lite_pm_ops = { | |||
| 1591 | 1595 | ||
| 1592 | static struct platform_driver fimc_lite_driver = { | 1596 | static struct platform_driver fimc_lite_driver = { |
| 1593 | .probe = fimc_lite_probe, | 1597 | .probe = fimc_lite_probe, |
| 1594 | .remove = __devexit_p(fimc_lite_remove), | 1598 | .remove = fimc_lite_remove, |
| 1595 | .id_table = fimc_lite_driver_ids, | 1599 | .id_table = fimc_lite_driver_ids, |
| 1596 | .driver = { | 1600 | .driver = { |
| 1597 | .name = FIMC_LITE_DRV_NAME, | 1601 | .name = FIMC_LITE_DRV_NAME, |
diff --git a/drivers/media/platform/s5p-fimc/fimc-m2m.c b/drivers/media/platform/s5p-fimc/fimc-m2m.c index 4500e44f6857..1d21da4bd24b 100644 --- a/drivers/media/platform/s5p-fimc/fimc-m2m.c +++ b/drivers/media/platform/s5p-fimc/fimc-m2m.c | |||
| @@ -105,7 +105,7 @@ static void fimc_device_run(void *priv) | |||
| 105 | struct fimc_frame *sf, *df; | 105 | struct fimc_frame *sf, *df; |
| 106 | struct fimc_dev *fimc; | 106 | struct fimc_dev *fimc; |
| 107 | unsigned long flags; | 107 | unsigned long flags; |
| 108 | u32 ret; | 108 | int ret; |
| 109 | 109 | ||
| 110 | if (WARN(!ctx, "Null context\n")) | 110 | if (WARN(!ctx, "Null context\n")) |
| 111 | return; | 111 | return; |
| @@ -439,6 +439,15 @@ static int fimc_m2m_dqbuf(struct file *file, void *fh, | |||
| 439 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); | 439 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | static int fimc_m2m_expbuf(struct file *file, void *fh, | ||
| 443 | struct v4l2_exportbuffer *eb) | ||
| 444 | { | ||
| 445 | struct fimc_ctx *ctx = fh_to_ctx(fh); | ||
| 446 | |||
| 447 | return v4l2_m2m_expbuf(file, ctx->m2m_ctx, eb); | ||
| 448 | } | ||
| 449 | |||
| 450 | |||
| 442 | static int fimc_m2m_streamon(struct file *file, void *fh, | 451 | static int fimc_m2m_streamon(struct file *file, void *fh, |
| 443 | enum v4l2_buf_type type) | 452 | enum v4l2_buf_type type) |
| 444 | { | 453 | { |
| @@ -607,6 +616,7 @@ static const struct v4l2_ioctl_ops fimc_m2m_ioctl_ops = { | |||
| 607 | .vidioc_querybuf = fimc_m2m_querybuf, | 616 | .vidioc_querybuf = fimc_m2m_querybuf, |
| 608 | .vidioc_qbuf = fimc_m2m_qbuf, | 617 | .vidioc_qbuf = fimc_m2m_qbuf, |
| 609 | .vidioc_dqbuf = fimc_m2m_dqbuf, | 618 | .vidioc_dqbuf = fimc_m2m_dqbuf, |
| 619 | .vidioc_expbuf = fimc_m2m_expbuf, | ||
| 610 | .vidioc_streamon = fimc_m2m_streamon, | 620 | .vidioc_streamon = fimc_m2m_streamon, |
| 611 | .vidioc_streamoff = fimc_m2m_streamoff, | 621 | .vidioc_streamoff = fimc_m2m_streamoff, |
| 612 | .vidioc_g_crop = fimc_m2m_g_crop, | 622 | .vidioc_g_crop = fimc_m2m_g_crop, |
| @@ -622,7 +632,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, | |||
| 622 | int ret; | 632 | int ret; |
| 623 | 633 | ||
| 624 | src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 634 | src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| 625 | src_vq->io_modes = VB2_MMAP | VB2_USERPTR; | 635 | src_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; |
| 626 | src_vq->drv_priv = ctx; | 636 | src_vq->drv_priv = ctx; |
| 627 | src_vq->ops = &fimc_qops; | 637 | src_vq->ops = &fimc_qops; |
| 628 | src_vq->mem_ops = &vb2_dma_contig_memops; | 638 | src_vq->mem_ops = &vb2_dma_contig_memops; |
| @@ -633,7 +643,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, | |||
| 633 | return ret; | 643 | return ret; |
| 634 | 644 | ||
| 635 | dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 645 | dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 636 | dst_vq->io_modes = VB2_MMAP | VB2_USERPTR; | 646 | dst_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; |
| 637 | dst_vq->drv_priv = ctx; | 647 | dst_vq->drv_priv = ctx; |
| 638 | dst_vq->ops = &fimc_qops; | 648 | dst_vq->ops = &fimc_qops; |
| 639 | dst_vq->mem_ops = &vb2_dma_contig_memops; | 649 | dst_vq->mem_ops = &vb2_dma_contig_memops; |
| @@ -718,8 +728,7 @@ static int fimc_m2m_release(struct file *file) | |||
| 718 | dbg("pid: %d, state: 0x%lx, refcnt= %d", | 728 | dbg("pid: %d, state: 0x%lx, refcnt= %d", |
| 719 | task_pid_nr(current), fimc->state, fimc->m2m.refcnt); | 729 | task_pid_nr(current), fimc->state, fimc->m2m.refcnt); |
| 720 | 730 | ||
| 721 | if (mutex_lock_interruptible(&fimc->lock)) | 731 | mutex_lock(&fimc->lock); |
| 722 | return -ERESTARTSYS; | ||
| 723 | 732 | ||
| 724 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | 733 | v4l2_m2m_ctx_release(ctx->m2m_ctx); |
| 725 | fimc_ctrls_delete(ctx); | 734 | fimc_ctrls_delete(ctx); |
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index 80ada5882f62..4ab99f3a7b09 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c | |||
| @@ -213,7 +213,7 @@ static int fimc_pipeline_close(struct fimc_pipeline *p) | |||
| 213 | * @pipeline: video pipeline structure | 213 | * @pipeline: video pipeline structure |
| 214 | * @on: passed as the s_stream call argument | 214 | * @on: passed as the s_stream call argument |
| 215 | */ | 215 | */ |
| 216 | int fimc_pipeline_s_stream(struct fimc_pipeline *p, bool on) | 216 | static int fimc_pipeline_s_stream(struct fimc_pipeline *p, bool on) |
| 217 | { | 217 | { |
| 218 | int i, ret; | 218 | int i, ret; |
| 219 | 219 | ||
| @@ -343,53 +343,50 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) | |||
| 343 | static int fimc_register_callback(struct device *dev, void *p) | 343 | static int fimc_register_callback(struct device *dev, void *p) |
| 344 | { | 344 | { |
| 345 | struct fimc_dev *fimc = dev_get_drvdata(dev); | 345 | struct fimc_dev *fimc = dev_get_drvdata(dev); |
| 346 | struct v4l2_subdev *sd = &fimc->vid_cap.subdev; | 346 | struct v4l2_subdev *sd; |
| 347 | struct fimc_md *fmd = p; | 347 | struct fimc_md *fmd = p; |
| 348 | int ret = 0; | 348 | int ret; |
| 349 | |||
| 350 | if (!fimc || !fimc->pdev) | ||
| 351 | return 0; | ||
| 352 | 349 | ||
| 353 | if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) | 350 | if (fimc == NULL || fimc->id >= FIMC_MAX_DEVS) |
| 354 | return 0; | 351 | return 0; |
| 355 | 352 | ||
| 356 | fimc->pipeline_ops = &fimc_pipeline_ops; | 353 | sd = &fimc->vid_cap.subdev; |
| 357 | fmd->fimc[fimc->pdev->id] = fimc; | ||
| 358 | sd->grp_id = FIMC_GROUP_ID; | 354 | sd->grp_id = FIMC_GROUP_ID; |
| 355 | v4l2_set_subdev_hostdata(sd, (void *)&fimc_pipeline_ops); | ||
| 359 | 356 | ||
| 360 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | 357 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); |
| 361 | if (ret) { | 358 | if (ret) { |
| 362 | v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", | 359 | v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", |
| 363 | fimc->id, ret); | 360 | fimc->id, ret); |
| 361 | return ret; | ||
| 364 | } | 362 | } |
| 365 | 363 | ||
| 366 | return ret; | 364 | fmd->fimc[fimc->id] = fimc; |
| 365 | return 0; | ||
| 367 | } | 366 | } |
| 368 | 367 | ||
| 369 | static int fimc_lite_register_callback(struct device *dev, void *p) | 368 | static int fimc_lite_register_callback(struct device *dev, void *p) |
| 370 | { | 369 | { |
| 371 | struct fimc_lite *fimc = dev_get_drvdata(dev); | 370 | struct fimc_lite *fimc = dev_get_drvdata(dev); |
| 372 | struct v4l2_subdev *sd = &fimc->subdev; | ||
| 373 | struct fimc_md *fmd = p; | 371 | struct fimc_md *fmd = p; |
| 374 | int ret; | 372 | int ret; |
| 375 | 373 | ||
| 376 | if (fimc == NULL) | 374 | if (fimc == NULL || fimc->index >= FIMC_LITE_MAX_DEVS) |
| 377 | return 0; | 375 | return 0; |
| 378 | 376 | ||
| 379 | if (fimc->index >= FIMC_LITE_MAX_DEVS) | 377 | fimc->subdev.grp_id = FLITE_GROUP_ID; |
| 380 | return 0; | 378 | v4l2_set_subdev_hostdata(&fimc->subdev, (void *)&fimc_pipeline_ops); |
| 381 | |||
| 382 | fimc->pipeline_ops = &fimc_pipeline_ops; | ||
| 383 | fmd->fimc_lite[fimc->index] = fimc; | ||
| 384 | sd->grp_id = FLITE_GROUP_ID; | ||
| 385 | 379 | ||
| 386 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | 380 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev); |
| 387 | if (ret) { | 381 | if (ret) { |
| 388 | v4l2_err(&fmd->v4l2_dev, | 382 | v4l2_err(&fmd->v4l2_dev, |
| 389 | "Failed to register FIMC-LITE.%d (%d)\n", | 383 | "Failed to register FIMC-LITE.%d (%d)\n", |
| 390 | fimc->index, ret); | 384 | fimc->index, ret); |
| 385 | return ret; | ||
| 391 | } | 386 | } |
| 392 | return ret; | 387 | |
| 388 | fmd->fimc_lite[fimc->index] = fimc; | ||
| 389 | return 0; | ||
| 393 | } | 390 | } |
| 394 | 391 | ||
| 395 | static int csis_register_callback(struct device *dev, void *p) | 392 | static int csis_register_callback(struct device *dev, void *p) |
| @@ -407,10 +404,12 @@ static int csis_register_callback(struct device *dev, void *p) | |||
| 407 | v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); | 404 | v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); |
| 408 | 405 | ||
| 409 | id = pdev->id < 0 ? 0 : pdev->id; | 406 | id = pdev->id < 0 ? 0 : pdev->id; |
| 410 | fmd->csis[id].sd = sd; | ||
| 411 | sd->grp_id = CSIS_GROUP_ID; | 407 | sd->grp_id = CSIS_GROUP_ID; |
| 408 | |||
| 412 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); | 409 | ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); |
| 413 | if (ret) | 410 | if (!ret) |
| 411 | fmd->csis[id].sd = sd; | ||
| 412 | else | ||
| 414 | v4l2_err(&fmd->v4l2_dev, | 413 | v4l2_err(&fmd->v4l2_dev, |
| 415 | "Failed to register CSIS subdevice: %d\n", ret); | 414 | "Failed to register CSIS subdevice: %d\n", ret); |
| 416 | return ret; | 415 | return ret; |
| @@ -548,7 +547,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
| 548 | if (ret) | 547 | if (ret) |
| 549 | break; | 548 | break; |
| 550 | 549 | ||
| 551 | v4l2_info(&fmd->v4l2_dev, "created link [%s] %c> [%s]", | 550 | v4l2_info(&fmd->v4l2_dev, "created link [%s] %c> [%s]\n", |
| 552 | source->name, flags ? '=' : '-', sink->name); | 551 | source->name, flags ? '=' : '-', sink->name); |
| 553 | 552 | ||
| 554 | if (flags == 0 || sensor == NULL) | 553 | if (flags == 0 || sensor == NULL) |
| @@ -1001,7 +1000,7 @@ err_md: | |||
| 1001 | return ret; | 1000 | return ret; |
| 1002 | } | 1001 | } |
| 1003 | 1002 | ||
| 1004 | static int __devexit fimc_md_remove(struct platform_device *pdev) | 1003 | static int fimc_md_remove(struct platform_device *pdev) |
| 1005 | { | 1004 | { |
| 1006 | struct fimc_md *fmd = platform_get_drvdata(pdev); | 1005 | struct fimc_md *fmd = platform_get_drvdata(pdev); |
| 1007 | 1006 | ||
| @@ -1016,7 +1015,7 @@ static int __devexit fimc_md_remove(struct platform_device *pdev) | |||
| 1016 | 1015 | ||
| 1017 | static struct platform_driver fimc_md_driver = { | 1016 | static struct platform_driver fimc_md_driver = { |
| 1018 | .probe = fimc_md_probe, | 1017 | .probe = fimc_md_probe, |
| 1019 | .remove = __devexit_p(fimc_md_remove), | 1018 | .remove = fimc_md_remove, |
| 1020 | .driver = { | 1019 | .driver = { |
| 1021 | .name = "s5p-fimc-md", | 1020 | .name = "s5p-fimc-md", |
| 1022 | .owner = THIS_MODULE, | 1021 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c index 4c961b1b68e6..ec3fa7d75306 100644 --- a/drivers/media/platform/s5p-fimc/mipi-csis.c +++ b/drivers/media/platform/s5p-fimc/mipi-csis.c | |||
| @@ -654,7 +654,7 @@ static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id) | |||
| 654 | return IRQ_HANDLED; | 654 | return IRQ_HANDLED; |
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | static int __devinit s5pcsis_probe(struct platform_device *pdev) | 657 | static int s5pcsis_probe(struct platform_device *pdev) |
| 658 | { | 658 | { |
| 659 | struct s5p_platform_mipi_csis *pdata; | 659 | struct s5p_platform_mipi_csis *pdata; |
| 660 | struct resource *mem_res; | 660 | struct resource *mem_res; |
| @@ -851,7 +851,7 @@ static int s5pcsis_runtime_resume(struct device *dev) | |||
| 851 | } | 851 | } |
| 852 | #endif | 852 | #endif |
| 853 | 853 | ||
| 854 | static int __devexit s5pcsis_remove(struct platform_device *pdev) | 854 | static int s5pcsis_remove(struct platform_device *pdev) |
| 855 | { | 855 | { |
| 856 | struct v4l2_subdev *sd = platform_get_drvdata(pdev); | 856 | struct v4l2_subdev *sd = platform_get_drvdata(pdev); |
| 857 | struct csis_state *state = sd_to_csis_state(sd); | 857 | struct csis_state *state = sd_to_csis_state(sd); |
| @@ -876,7 +876,7 @@ static const struct dev_pm_ops s5pcsis_pm_ops = { | |||
| 876 | 876 | ||
| 877 | static struct platform_driver s5pcsis_driver = { | 877 | static struct platform_driver s5pcsis_driver = { |
| 878 | .probe = s5pcsis_probe, | 878 | .probe = s5pcsis_probe, |
| 879 | .remove = __devexit_p(s5pcsis_remove), | 879 | .remove = s5pcsis_remove, |
| 880 | .driver = { | 880 | .driver = { |
| 881 | .name = CSIS_DRIVER_NAME, | 881 | .name = CSIS_DRIVER_NAME, |
| 882 | .owner = THIS_MODULE, | 882 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 130f4ac8649e..379f57433711 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
| @@ -381,11 +381,8 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, | |||
| 381 | ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops, | 381 | ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops, |
| 382 | get_consumed_stream, dev); | 382 | get_consumed_stream, dev); |
| 383 | if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC && | 383 | if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC && |
| 384 | s5p_mfc_hw_call(dev->mfc_ops, | 384 | ctx->consumed_stream + STUFF_BYTE < |
| 385 | get_dec_frame_type, dev) == | 385 | src_buf->b->v4l2_planes[0].bytesused) { |
| 386 | S5P_FIMV_DECODE_FRAME_P_FRAME | ||
| 387 | && ctx->consumed_stream + STUFF_BYTE < | ||
| 388 | src_buf->b->v4l2_planes[0].bytesused) { | ||
| 389 | /* Run MFC again on the same buffer */ | 386 | /* Run MFC again on the same buffer */ |
| 390 | mfc_debug(2, "Running again the same buffer\n"); | 387 | mfc_debug(2, "Running again the same buffer\n"); |
| 391 | ctx->after_packed_pb = 1; | 388 | ctx->after_packed_pb = 1; |
| @@ -1206,7 +1203,7 @@ err_res: | |||
| 1206 | } | 1203 | } |
| 1207 | 1204 | ||
| 1208 | /* Remove the driver */ | 1205 | /* Remove the driver */ |
| 1209 | static int __devexit s5p_mfc_remove(struct platform_device *pdev) | 1206 | static int s5p_mfc_remove(struct platform_device *pdev) |
| 1210 | { | 1207 | { |
| 1211 | struct s5p_mfc_dev *dev = platform_get_drvdata(pdev); | 1208 | struct s5p_mfc_dev *dev = platform_get_drvdata(pdev); |
| 1212 | 1209 | ||
| @@ -1371,7 +1368,7 @@ MODULE_DEVICE_TABLE(platform, mfc_driver_ids); | |||
| 1371 | 1368 | ||
| 1372 | static struct platform_driver s5p_mfc_driver = { | 1369 | static struct platform_driver s5p_mfc_driver = { |
| 1373 | .probe = s5p_mfc_probe, | 1370 | .probe = s5p_mfc_probe, |
| 1374 | .remove = __devexit_p(s5p_mfc_remove), | 1371 | .remove = s5p_mfc_remove, |
| 1375 | .id_table = mfc_driver_ids, | 1372 | .id_table = mfc_driver_ids, |
| 1376 | .driver = { | 1373 | .driver = { |
| 1377 | .name = S5P_MFC_NAME, | 1374 | .name = S5P_MFC_NAME, |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index eb6a70b0f821..6dad9a74f61c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
| @@ -636,6 +636,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
| 636 | return -EINVAL; | 636 | return -EINVAL; |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | /* Export DMA buffer */ | ||
| 640 | static int vidioc_expbuf(struct file *file, void *priv, | ||
| 641 | struct v4l2_exportbuffer *eb) | ||
| 642 | { | ||
| 643 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | ||
| 644 | |||
| 645 | if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) | ||
| 646 | return vb2_expbuf(&ctx->vq_src, eb); | ||
| 647 | if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
| 648 | return vb2_expbuf(&ctx->vq_dst, eb); | ||
| 649 | return -EINVAL; | ||
| 650 | } | ||
| 651 | |||
| 639 | /* Stream on */ | 652 | /* Stream on */ |
| 640 | static int vidioc_streamon(struct file *file, void *priv, | 653 | static int vidioc_streamon(struct file *file, void *priv, |
| 641 | enum v4l2_buf_type type) | 654 | enum v4l2_buf_type type) |
| @@ -813,6 +826,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { | |||
| 813 | .vidioc_querybuf = vidioc_querybuf, | 826 | .vidioc_querybuf = vidioc_querybuf, |
| 814 | .vidioc_qbuf = vidioc_qbuf, | 827 | .vidioc_qbuf = vidioc_qbuf, |
| 815 | .vidioc_dqbuf = vidioc_dqbuf, | 828 | .vidioc_dqbuf = vidioc_dqbuf, |
| 829 | .vidioc_expbuf = vidioc_expbuf, | ||
| 816 | .vidioc_streamon = vidioc_streamon, | 830 | .vidioc_streamon = vidioc_streamon, |
| 817 | .vidioc_streamoff = vidioc_streamoff, | 831 | .vidioc_streamoff = vidioc_streamoff, |
| 818 | .vidioc_g_crop = vidioc_g_crop, | 832 | .vidioc_g_crop = vidioc_g_crop, |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2af6d522f4ac..f92f6ddd739f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
| @@ -1165,6 +1165,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
| 1165 | return ret; | 1165 | return ret; |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| 1168 | /* Export DMA buffer */ | ||
| 1169 | static int vidioc_expbuf(struct file *file, void *priv, | ||
| 1170 | struct v4l2_exportbuffer *eb) | ||
| 1171 | { | ||
| 1172 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | ||
| 1173 | |||
| 1174 | if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) | ||
| 1175 | return vb2_expbuf(&ctx->vq_src, eb); | ||
| 1176 | if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
| 1177 | return vb2_expbuf(&ctx->vq_dst, eb); | ||
| 1178 | return -EINVAL; | ||
| 1179 | } | ||
| 1180 | |||
| 1168 | /* Stream on */ | 1181 | /* Stream on */ |
| 1169 | static int vidioc_streamon(struct file *file, void *priv, | 1182 | static int vidioc_streamon(struct file *file, void *priv, |
| 1170 | enum v4l2_buf_type type) | 1183 | enum v4l2_buf_type type) |
| @@ -1542,7 +1555,7 @@ int vidioc_encoder_cmd(struct file *file, void *priv, | |||
| 1542 | } | 1555 | } |
| 1543 | 1556 | ||
| 1544 | static int vidioc_subscribe_event(struct v4l2_fh *fh, | 1557 | static int vidioc_subscribe_event(struct v4l2_fh *fh, |
| 1545 | struct v4l2_event_subscription *sub) | 1558 | const struct v4l2_event_subscription *sub) |
| 1546 | { | 1559 | { |
| 1547 | switch (sub->type) { | 1560 | switch (sub->type) { |
| 1548 | case V4L2_EVENT_EOS: | 1561 | case V4L2_EVENT_EOS: |
| @@ -1568,6 +1581,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = { | |||
| 1568 | .vidioc_querybuf = vidioc_querybuf, | 1581 | .vidioc_querybuf = vidioc_querybuf, |
| 1569 | .vidioc_qbuf = vidioc_qbuf, | 1582 | .vidioc_qbuf = vidioc_qbuf, |
| 1570 | .vidioc_dqbuf = vidioc_dqbuf, | 1583 | .vidioc_dqbuf = vidioc_dqbuf, |
| 1584 | .vidioc_expbuf = vidioc_expbuf, | ||
| 1571 | .vidioc_streamon = vidioc_streamon, | 1585 | .vidioc_streamon = vidioc_streamon, |
| 1572 | .vidioc_streamoff = vidioc_streamoff, | 1586 | .vidioc_streamoff = vidioc_streamoff, |
| 1573 | .vidioc_s_parm = vidioc_s_parm, | 1587 | .vidioc_s_parm = vidioc_s_parm, |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 50b5bee3c44e..3a8cfd9fc1bd 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | |||
| @@ -1762,7 +1762,7 @@ int s5p_mfc_get_dspl_y_adr_v6(struct s5p_mfc_dev *dev) | |||
| 1762 | 1762 | ||
| 1763 | int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev) | 1763 | int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev) |
| 1764 | { | 1764 | { |
| 1765 | return mfc_read(dev, S5P_FIMV_D_DISPLAY_LUMA_ADDR_V6); | 1765 | return mfc_read(dev, S5P_FIMV_D_DECODED_LUMA_ADDR_V6); |
| 1766 | } | 1766 | } |
| 1767 | 1767 | ||
| 1768 | int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) | 1768 | int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 367db7552289..2895333866fc 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | |||
| @@ -28,7 +28,7 @@ static struct s5p_mfc_pm *pm; | |||
| 28 | static struct s5p_mfc_dev *p_dev; | 28 | static struct s5p_mfc_dev *p_dev; |
| 29 | 29 | ||
| 30 | #ifdef CLK_DEBUG | 30 | #ifdef CLK_DEBUG |
| 31 | atomic_t clk_ref; | 31 | static atomic_t clk_ref; |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) | 34 | int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) |
diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c index 8a9cf43018f6..7c1116c73bf3 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c | |||
| @@ -830,7 +830,7 @@ fail: | |||
| 830 | return -ENODEV; | 830 | return -ENODEV; |
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | static int __devinit hdmi_probe(struct platform_device *pdev) | 833 | static int hdmi_probe(struct platform_device *pdev) |
| 834 | { | 834 | { |
| 835 | struct device *dev = &pdev->dev; | 835 | struct device *dev = &pdev->dev; |
| 836 | struct resource *res; | 836 | struct resource *res; |
| @@ -979,7 +979,7 @@ fail: | |||
| 979 | return ret; | 979 | return ret; |
| 980 | } | 980 | } |
| 981 | 981 | ||
| 982 | static int __devexit hdmi_remove(struct platform_device *pdev) | 982 | static int hdmi_remove(struct platform_device *pdev) |
| 983 | { | 983 | { |
| 984 | struct device *dev = &pdev->dev; | 984 | struct device *dev = &pdev->dev; |
| 985 | struct v4l2_subdev *sd = dev_get_drvdata(dev); | 985 | struct v4l2_subdev *sd = dev_get_drvdata(dev); |
| @@ -997,7 +997,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev) | |||
| 997 | 997 | ||
| 998 | static struct platform_driver hdmi_driver __refdata = { | 998 | static struct platform_driver hdmi_driver __refdata = { |
| 999 | .probe = hdmi_probe, | 999 | .probe = hdmi_probe, |
| 1000 | .remove = __devexit_p(hdmi_remove), | 1000 | .remove = hdmi_remove, |
| 1001 | .id_table = hdmi_driver_types, | 1001 | .id_table = hdmi_driver_types, |
| 1002 | .driver = { | 1002 | .driver = { |
| 1003 | .name = "s5p-hdmi", | 1003 | .name = "s5p-hdmi", |
diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c index f67b38631801..06b5d2dbb2d9 100644 --- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c +++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c | |||
| @@ -279,8 +279,8 @@ static const struct v4l2_subdev_ops hdmiphy_ops = { | |||
| 279 | .video = &hdmiphy_video_ops, | 279 | .video = &hdmiphy_video_ops, |
| 280 | }; | 280 | }; |
| 281 | 281 | ||
| 282 | static int __devinit hdmiphy_probe(struct i2c_client *client, | 282 | static int hdmiphy_probe(struct i2c_client *client, |
| 283 | const struct i2c_device_id *id) | 283 | const struct i2c_device_id *id) |
| 284 | { | 284 | { |
| 285 | struct hdmiphy_ctx *ctx; | 285 | struct hdmiphy_ctx *ctx; |
| 286 | 286 | ||
| @@ -295,7 +295,7 @@ static int __devinit hdmiphy_probe(struct i2c_client *client, | |||
| 295 | return 0; | 295 | return 0; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | static int __devexit hdmiphy_remove(struct i2c_client *client) | 298 | static int hdmiphy_remove(struct i2c_client *client) |
| 299 | { | 299 | { |
| 300 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 300 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 301 | struct hdmiphy_ctx *ctx = sd_to_ctx(sd); | 301 | struct hdmiphy_ctx *ctx = sd_to_ctx(sd); |
| @@ -322,7 +322,7 @@ static struct i2c_driver hdmiphy_driver = { | |||
| 322 | .owner = THIS_MODULE, | 322 | .owner = THIS_MODULE, |
| 323 | }, | 323 | }, |
| 324 | .probe = hdmiphy_probe, | 324 | .probe = hdmiphy_probe, |
| 325 | .remove = __devexit_p(hdmiphy_remove), | 325 | .remove = hdmiphy_remove, |
| 326 | .id_table = hdmiphy_id, | 326 | .id_table = hdmiphy_id, |
| 327 | }; | 327 | }; |
| 328 | 328 | ||
diff --git a/drivers/media/platform/s5p-tv/mixer.h b/drivers/media/platform/s5p-tv/mixer.h index ddb422e23550..b671e20e9318 100644 --- a/drivers/media/platform/s5p-tv/mixer.h +++ b/drivers/media/platform/s5p-tv/mixer.h | |||
| @@ -290,7 +290,7 @@ static inline struct v4l2_subdev *to_outsd(struct mxr_device *mdev) | |||
| 290 | struct mxr_platform_data; | 290 | struct mxr_platform_data; |
| 291 | 291 | ||
| 292 | /** acquiring common video resources */ | 292 | /** acquiring common video resources */ |
| 293 | int __devinit mxr_acquire_video(struct mxr_device *mdev, | 293 | int mxr_acquire_video(struct mxr_device *mdev, |
| 294 | struct mxr_output_conf *output_cont, int output_count); | 294 | struct mxr_output_conf *output_cont, int output_count); |
| 295 | 295 | ||
| 296 | /** releasing common video resources */ | 296 | /** releasing common video resources */ |
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c index ca0f29717448..02faea03aa7d 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c | |||
| @@ -151,8 +151,8 @@ void mxr_power_put(struct mxr_device *mdev) | |||
| 151 | 151 | ||
| 152 | /* --------- RESOURCE MANAGEMENT -------------*/ | 152 | /* --------- RESOURCE MANAGEMENT -------------*/ |
| 153 | 153 | ||
| 154 | static int __devinit mxr_acquire_plat_resources(struct mxr_device *mdev, | 154 | static int mxr_acquire_plat_resources(struct mxr_device *mdev, |
| 155 | struct platform_device *pdev) | 155 | struct platform_device *pdev) |
| 156 | { | 156 | { |
| 157 | struct resource *res; | 157 | struct resource *res; |
| 158 | int ret; | 158 | int ret; |
| @@ -271,8 +271,8 @@ fail: | |||
| 271 | return -ENODEV; | 271 | return -ENODEV; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | static int __devinit mxr_acquire_resources(struct mxr_device *mdev, | 274 | static int mxr_acquire_resources(struct mxr_device *mdev, |
| 275 | struct platform_device *pdev) | 275 | struct platform_device *pdev) |
| 276 | { | 276 | { |
| 277 | int ret; | 277 | int ret; |
| 278 | ret = mxr_acquire_plat_resources(mdev, pdev); | 278 | ret = mxr_acquire_plat_resources(mdev, pdev); |
| @@ -310,8 +310,8 @@ static void mxr_release_layers(struct mxr_device *mdev) | |||
| 310 | mxr_layer_release(mdev->layer[i]); | 310 | mxr_layer_release(mdev->layer[i]); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | static int __devinit mxr_acquire_layers(struct mxr_device *mdev, | 313 | static int mxr_acquire_layers(struct mxr_device *mdev, |
| 314 | struct mxr_platform_data *pdata) | 314 | struct mxr_platform_data *pdata) |
| 315 | { | 315 | { |
| 316 | mdev->layer[0] = mxr_graph_layer_create(mdev, 0); | 316 | mdev->layer[0] = mxr_graph_layer_create(mdev, 0); |
| 317 | mdev->layer[1] = mxr_graph_layer_create(mdev, 1); | 317 | mdev->layer[1] = mxr_graph_layer_create(mdev, 1); |
| @@ -372,7 +372,7 @@ static const struct dev_pm_ops mxr_pm_ops = { | |||
| 372 | 372 | ||
| 373 | /* --------- DRIVER INITIALIZATION ---------- */ | 373 | /* --------- DRIVER INITIALIZATION ---------- */ |
| 374 | 374 | ||
| 375 | static int __devinit mxr_probe(struct platform_device *pdev) | 375 | static int mxr_probe(struct platform_device *pdev) |
| 376 | { | 376 | { |
| 377 | struct device *dev = &pdev->dev; | 377 | struct device *dev = &pdev->dev; |
| 378 | struct mxr_platform_data *pdata = dev->platform_data; | 378 | struct mxr_platform_data *pdata = dev->platform_data; |
| @@ -431,7 +431,7 @@ fail: | |||
| 431 | return ret; | 431 | return ret; |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | static int __devexit mxr_remove(struct platform_device *pdev) | 434 | static int mxr_remove(struct platform_device *pdev) |
| 435 | { | 435 | { |
| 436 | struct device *dev = &pdev->dev; | 436 | struct device *dev = &pdev->dev; |
| 437 | struct mxr_device *mdev = to_mdev(dev); | 437 | struct mxr_device *mdev = to_mdev(dev); |
| @@ -450,7 +450,7 @@ static int __devexit mxr_remove(struct platform_device *pdev) | |||
| 450 | 450 | ||
| 451 | static struct platform_driver mxr_driver __refdata = { | 451 | static struct platform_driver mxr_driver __refdata = { |
| 452 | .probe = mxr_probe, | 452 | .probe = mxr_probe, |
| 453 | .remove = __devexit_p(mxr_remove), | 453 | .remove = mxr_remove, |
| 454 | .driver = { | 454 | .driver = { |
| 455 | .name = MXR_DRIVER_NAME, | 455 | .name = MXR_DRIVER_NAME, |
| 456 | .owner = THIS_MODULE, | 456 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c index 0c1cd895ff66..1f3b7436511c 100644 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ b/drivers/media/platform/s5p-tv/mixer_video.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
| 20 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/version.h> | ||
| 23 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
| 24 | #include <media/videobuf2-dma-contig.h> | 23 | #include <media/videobuf2-dma-contig.h> |
| 25 | 24 | ||
| @@ -63,8 +62,8 @@ done: | |||
| 63 | return sd; | 62 | return sd; |
| 64 | } | 63 | } |
| 65 | 64 | ||
| 66 | int __devinit mxr_acquire_video(struct mxr_device *mdev, | 65 | int mxr_acquire_video(struct mxr_device *mdev, |
| 67 | struct mxr_output_conf *output_conf, int output_count) | 66 | struct mxr_output_conf *output_conf, int output_count) |
| 68 | { | 67 | { |
| 69 | struct device *dev = mdev->dev; | 68 | struct device *dev = mdev->dev; |
| 70 | struct v4l2_device *v4l2_dev = &mdev->v4l2_dev; | 69 | struct v4l2_device *v4l2_dev = &mdev->v4l2_dev; |
| @@ -698,6 +697,15 @@ static int mxr_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) | |||
| 698 | return vb2_dqbuf(&layer->vb_queue, p, file->f_flags & O_NONBLOCK); | 697 | return vb2_dqbuf(&layer->vb_queue, p, file->f_flags & O_NONBLOCK); |
| 699 | } | 698 | } |
| 700 | 699 | ||
| 700 | static int mxr_expbuf(struct file *file, void *priv, | ||
| 701 | struct v4l2_exportbuffer *eb) | ||
| 702 | { | ||
| 703 | struct mxr_layer *layer = video_drvdata(file); | ||
| 704 | |||
| 705 | mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); | ||
| 706 | return vb2_expbuf(&layer->vb_queue, eb); | ||
| 707 | } | ||
| 708 | |||
| 701 | static int mxr_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | 709 | static int mxr_streamon(struct file *file, void *priv, enum v4l2_buf_type i) |
| 702 | { | 710 | { |
| 703 | struct mxr_layer *layer = video_drvdata(file); | 711 | struct mxr_layer *layer = video_drvdata(file); |
| @@ -725,6 +733,7 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = { | |||
| 725 | .vidioc_querybuf = mxr_querybuf, | 733 | .vidioc_querybuf = mxr_querybuf, |
| 726 | .vidioc_qbuf = mxr_qbuf, | 734 | .vidioc_qbuf = mxr_qbuf, |
| 727 | .vidioc_dqbuf = mxr_dqbuf, | 735 | .vidioc_dqbuf = mxr_dqbuf, |
| 736 | .vidioc_expbuf = mxr_expbuf, | ||
| 728 | /* Streaming control */ | 737 | /* Streaming control */ |
| 729 | .vidioc_streamon = mxr_streamon, | 738 | .vidioc_streamon = mxr_streamon, |
| 730 | .vidioc_streamoff = mxr_streamoff, | 739 | .vidioc_streamoff = mxr_streamoff, |
| @@ -1093,7 +1102,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev, | |||
| 1093 | 1102 | ||
| 1094 | layer->vb_queue = (struct vb2_queue) { | 1103 | layer->vb_queue = (struct vb2_queue) { |
| 1095 | .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, | 1104 | .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, |
| 1096 | .io_modes = VB2_MMAP | VB2_USERPTR, | 1105 | .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF, |
| 1097 | .drv_priv = layer, | 1106 | .drv_priv = layer, |
| 1098 | .buf_struct_size = sizeof(struct mxr_buffer), | 1107 | .buf_struct_size = sizeof(struct mxr_buffer), |
| 1099 | .ops = &mxr_video_qops, | 1108 | .ops = &mxr_video_qops, |
diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c index ad68bbed014e..91a6939a270a 100644 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ b/drivers/media/platform/s5p-tv/sdo_drv.c | |||
| @@ -292,7 +292,7 @@ static const struct dev_pm_ops sdo_pm_ops = { | |||
| 292 | .runtime_resume = sdo_runtime_resume, | 292 | .runtime_resume = sdo_runtime_resume, |
| 293 | }; | 293 | }; |
| 294 | 294 | ||
| 295 | static int __devinit sdo_probe(struct platform_device *pdev) | 295 | static int sdo_probe(struct platform_device *pdev) |
| 296 | { | 296 | { |
| 297 | struct device *dev = &pdev->dev; | 297 | struct device *dev = &pdev->dev; |
| 298 | struct sdo_device *sdev; | 298 | struct sdo_device *sdev; |
| @@ -419,7 +419,7 @@ fail: | |||
| 419 | return ret; | 419 | return ret; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static int __devexit sdo_remove(struct platform_device *pdev) | 422 | static int sdo_remove(struct platform_device *pdev) |
| 423 | { | 423 | { |
| 424 | struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev); | 424 | struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev); |
| 425 | struct sdo_device *sdev = sd_to_sdev(sd); | 425 | struct sdo_device *sdev = sd_to_sdev(sd); |
| @@ -437,7 +437,7 @@ static int __devexit sdo_remove(struct platform_device *pdev) | |||
| 437 | 437 | ||
| 438 | static struct platform_driver sdo_driver __refdata = { | 438 | static struct platform_driver sdo_driver __refdata = { |
| 439 | .probe = sdo_probe, | 439 | .probe = sdo_probe, |
| 440 | .remove = __devexit_p(sdo_remove), | 440 | .remove = sdo_remove, |
| 441 | .driver = { | 441 | .driver = { |
| 442 | .name = "s5p-sdo", | 442 | .name = "s5p-sdo", |
| 443 | .owner = THIS_MODULE, | 443 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c index 716d4846f8bd..49191aac9634 100644 --- a/drivers/media/platform/s5p-tv/sii9234_drv.c +++ b/drivers/media/platform/s5p-tv/sii9234_drv.c | |||
| @@ -315,8 +315,8 @@ static const struct v4l2_subdev_ops sii9234_ops = { | |||
| 315 | .video = &sii9234_video_ops, | 315 | .video = &sii9234_video_ops, |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | static int __devinit sii9234_probe(struct i2c_client *client, | 318 | static int sii9234_probe(struct i2c_client *client, |
| 319 | const struct i2c_device_id *id) | 319 | const struct i2c_device_id *id) |
| 320 | { | 320 | { |
| 321 | struct device *dev = &client->dev; | 321 | struct device *dev = &client->dev; |
| 322 | struct sii9234_platform_data *pdata = dev->platform_data; | 322 | struct sii9234_platform_data *pdata = dev->platform_data; |
| @@ -378,7 +378,7 @@ fail: | |||
| 378 | return ret; | 378 | return ret; |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | static int __devexit sii9234_remove(struct i2c_client *client) | 381 | static int sii9234_remove(struct i2c_client *client) |
| 382 | { | 382 | { |
| 383 | struct device *dev = &client->dev; | 383 | struct device *dev = &client->dev; |
| 384 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 384 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| @@ -406,7 +406,7 @@ static struct i2c_driver sii9234_driver = { | |||
| 406 | .pm = &sii9234_pm_ops, | 406 | .pm = &sii9234_pm_ops, |
| 407 | }, | 407 | }, |
| 408 | .probe = sii9234_probe, | 408 | .probe = sii9234_probe, |
| 409 | .remove = __devexit_p(sii9234_remove), | 409 | .remove = sii9234_remove, |
| 410 | .id_table = sii9234_id, | 410 | .id_table = sii9234_id, |
| 411 | }; | 411 | }; |
| 412 | 412 | ||
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 85fd312f0a82..f3c4571ac01e 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
| @@ -935,9 +935,10 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) | |||
| 935 | /* Assume a dull encoder, do all the work ourselves. */ | 935 | /* Assume a dull encoder, do all the work ourselves. */ |
| 936 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) | 936 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) |
| 937 | { | 937 | { |
| 938 | struct v4l2_crop a_writable = *a; | ||
| 938 | struct video_device *vdev = video_devdata(file); | 939 | struct video_device *vdev = video_devdata(file); |
| 939 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | 940 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); |
| 940 | struct v4l2_rect *rect = &a->c; | 941 | struct v4l2_rect *rect = &a_writable.c; |
| 941 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; | 942 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; |
| 942 | struct v4l2_pix_format *pix = &vou_dev->pix; | 943 | struct v4l2_pix_format *pix = &vou_dev->pix; |
| 943 | struct sh_vou_geometry geo; | 944 | struct sh_vou_geometry geo; |
| @@ -1325,7 +1326,7 @@ static const struct video_device sh_vou_video_template = { | |||
| 1325 | .vfl_dir = VFL_DIR_TX, | 1326 | .vfl_dir = VFL_DIR_TX, |
| 1326 | }; | 1327 | }; |
| 1327 | 1328 | ||
| 1328 | static int __devinit sh_vou_probe(struct platform_device *pdev) | 1329 | static int sh_vou_probe(struct platform_device *pdev) |
| 1329 | { | 1330 | { |
| 1330 | struct sh_vou_pdata *vou_pdata = pdev->dev.platform_data; | 1331 | struct sh_vou_pdata *vou_pdata = pdev->dev.platform_data; |
| 1331 | struct v4l2_rect *rect; | 1332 | struct v4l2_rect *rect; |
| @@ -1460,7 +1461,7 @@ ereqmemreg: | |||
| 1460 | return ret; | 1461 | return ret; |
| 1461 | } | 1462 | } |
| 1462 | 1463 | ||
| 1463 | static int __devexit sh_vou_remove(struct platform_device *pdev) | 1464 | static int sh_vou_remove(struct platform_device *pdev) |
| 1464 | { | 1465 | { |
| 1465 | int irq = platform_get_irq(pdev, 0); | 1466 | int irq = platform_get_irq(pdev, 0); |
| 1466 | struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); | 1467 | struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); |
| @@ -1486,7 +1487,7 @@ static int __devexit sh_vou_remove(struct platform_device *pdev) | |||
| 1486 | } | 1487 | } |
| 1487 | 1488 | ||
| 1488 | static struct platform_driver __refdata sh_vou = { | 1489 | static struct platform_driver __refdata sh_vou = { |
| 1489 | .remove = __devexit_p(sh_vou_remove), | 1490 | .remove = sh_vou_remove, |
| 1490 | .driver = { | 1491 | .driver = { |
| 1491 | .name = "sh-vou", | 1492 | .name = "sh-vou", |
| 1492 | .owner = THIS_MODULE, | 1493 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 9afe1e7bde74..cb6791e62bd4 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig | |||
| @@ -19,6 +19,7 @@ config MX1_VIDEO | |||
| 19 | 19 | ||
| 20 | config VIDEO_MX1 | 20 | config VIDEO_MX1 |
| 21 | tristate "i.MX1/i.MXL CMOS Sensor Interface driver" | 21 | tristate "i.MX1/i.MXL CMOS Sensor Interface driver" |
| 22 | depends on BROKEN | ||
| 22 | depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA | 23 | depends on VIDEO_DEV && ARCH_MX1 && SOC_CAMERA |
| 23 | select FIQ | 24 | select FIQ |
| 24 | select VIDEOBUF_DMA_CONTIG | 25 | select VIDEOBUF_DMA_CONTIG |
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 6274a91c25c7..d96c8c7e01d9 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c | |||
| @@ -897,7 +897,7 @@ static struct soc_camera_host_ops isi_soc_camera_host_ops = { | |||
| 897 | }; | 897 | }; |
| 898 | 898 | ||
| 899 | /* -----------------------------------------------------------------------*/ | 899 | /* -----------------------------------------------------------------------*/ |
| 900 | static int __devexit atmel_isi_remove(struct platform_device *pdev) | 900 | static int atmel_isi_remove(struct platform_device *pdev) |
| 901 | { | 901 | { |
| 902 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); | 902 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
| 903 | struct atmel_isi *isi = container_of(soc_host, | 903 | struct atmel_isi *isi = container_of(soc_host, |
| @@ -921,7 +921,7 @@ static int __devexit atmel_isi_remove(struct platform_device *pdev) | |||
| 921 | return 0; | 921 | return 0; |
| 922 | } | 922 | } |
| 923 | 923 | ||
| 924 | static int __devinit atmel_isi_probe(struct platform_device *pdev) | 924 | static int atmel_isi_probe(struct platform_device *pdev) |
| 925 | { | 925 | { |
| 926 | unsigned int irq; | 926 | unsigned int irq; |
| 927 | struct atmel_isi *isi; | 927 | struct atmel_isi *isi; |
| @@ -1074,7 +1074,7 @@ err_clk_prepare_pclk: | |||
| 1074 | 1074 | ||
| 1075 | static struct platform_driver atmel_isi_driver = { | 1075 | static struct platform_driver atmel_isi_driver = { |
| 1076 | .probe = atmel_isi_probe, | 1076 | .probe = atmel_isi_probe, |
| 1077 | .remove = __devexit_p(atmel_isi_remove), | 1077 | .remove = atmel_isi_remove, |
| 1078 | .driver = { | 1078 | .driver = { |
| 1079 | .name = "atmel_isi", | 1079 | .name = "atmel_isi", |
| 1080 | .owner = THIS_MODULE, | 1080 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/soc_camera/mx1_camera.c b/drivers/media/platform/soc_camera/mx1_camera.c index bbe70991d30b..032b8c9097f9 100644 --- a/drivers/media/platform/soc_camera/mx1_camera.c +++ b/drivers/media/platform/soc_camera/mx1_camera.c | |||
| @@ -470,14 +470,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd) | |||
| 470 | pcdev->icd = NULL; | 470 | pcdev->icd = NULL; |
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | static int mx1_camera_set_crop(struct soc_camera_device *icd, | ||
| 474 | struct v4l2_crop *a) | ||
| 475 | { | ||
| 476 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | ||
| 477 | |||
| 478 | return v4l2_subdev_call(sd, video, s_crop, a); | ||
| 479 | } | ||
| 480 | |||
| 481 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd) | 473 | static int mx1_camera_set_bus_param(struct soc_camera_device *icd) |
| 482 | { | 474 | { |
| 483 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 475 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| @@ -689,7 +681,6 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = { | |||
| 689 | .add = mx1_camera_add_device, | 681 | .add = mx1_camera_add_device, |
| 690 | .remove = mx1_camera_remove_device, | 682 | .remove = mx1_camera_remove_device, |
| 691 | .set_bus_param = mx1_camera_set_bus_param, | 683 | .set_bus_param = mx1_camera_set_bus_param, |
| 692 | .set_crop = mx1_camera_set_crop, | ||
| 693 | .set_fmt = mx1_camera_set_fmt, | 684 | .set_fmt = mx1_camera_set_fmt, |
| 694 | .try_fmt = mx1_camera_try_fmt, | 685 | .try_fmt = mx1_camera_try_fmt, |
| 695 | .init_videobuf = mx1_camera_init_videobuf, | 686 | .init_videobuf = mx1_camera_init_videobuf, |
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 9fd9d1c5b218..8bda2c908aba 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | #include <linux/videodev2.h> | 41 | #include <linux/videodev2.h> |
| 42 | 42 | ||
| 43 | #include <linux/platform_data/camera-mx2.h> | 43 | #include <linux/platform_data/camera-mx2.h> |
| 44 | #include <mach/hardware.h> | ||
| 45 | 44 | ||
| 46 | #include <asm/dma.h> | 45 | #include <asm/dma.h> |
| 47 | 46 | ||
| @@ -121,11 +120,13 @@ | |||
| 121 | 120 | ||
| 122 | #define CSICR1 0x00 | 121 | #define CSICR1 0x00 |
| 123 | #define CSICR2 0x04 | 122 | #define CSICR2 0x04 |
| 124 | #define CSISR (cpu_is_mx27() ? 0x08 : 0x18) | 123 | #define CSISR_IMX25 0x18 |
| 124 | #define CSISR_IMX27 0x08 | ||
| 125 | #define CSISTATFIFO 0x0c | 125 | #define CSISTATFIFO 0x0c |
| 126 | #define CSIRFIFO 0x10 | 126 | #define CSIRFIFO 0x10 |
| 127 | #define CSIRXCNT 0x14 | 127 | #define CSIRXCNT 0x14 |
| 128 | #define CSICR3 (cpu_is_mx27() ? 0x1C : 0x08) | 128 | #define CSICR3_IMX25 0x08 |
| 129 | #define CSICR3_IMX27 0x1c | ||
| 129 | #define CSIDMASA_STATFIFO 0x20 | 130 | #define CSIDMASA_STATFIFO 0x20 |
| 130 | #define CSIDMATA_STATFIFO 0x24 | 131 | #define CSIDMATA_STATFIFO 0x24 |
| 131 | #define CSIDMASA_FB1 0x28 | 132 | #define CSIDMASA_FB1 0x28 |
| @@ -268,11 +269,17 @@ struct mx2_buffer { | |||
| 268 | struct mx2_buf_internal internal; | 269 | struct mx2_buf_internal internal; |
| 269 | }; | 270 | }; |
| 270 | 271 | ||
| 272 | enum mx2_camera_type { | ||
| 273 | IMX25_CAMERA, | ||
| 274 | IMX27_CAMERA, | ||
| 275 | }; | ||
| 276 | |||
| 271 | struct mx2_camera_dev { | 277 | struct mx2_camera_dev { |
| 272 | struct device *dev; | 278 | struct device *dev; |
| 273 | struct soc_camera_host soc_host; | 279 | struct soc_camera_host soc_host; |
| 274 | struct soc_camera_device *icd; | 280 | struct soc_camera_device *icd; |
| 275 | struct clk *clk_csi, *clk_emma_ahb, *clk_emma_ipg; | 281 | struct clk *clk_emma_ahb, *clk_emma_ipg; |
| 282 | struct clk *clk_csi_ahb, *clk_csi_per; | ||
| 276 | 283 | ||
| 277 | void __iomem *base_csi, *base_emma; | 284 | void __iomem *base_csi, *base_emma; |
| 278 | 285 | ||
| @@ -291,6 +298,9 @@ struct mx2_camera_dev { | |||
| 291 | struct mx2_buffer *fb2_active; | 298 | struct mx2_buffer *fb2_active; |
| 292 | 299 | ||
| 293 | u32 csicr1; | 300 | u32 csicr1; |
| 301 | u32 reg_csisr; | ||
| 302 | u32 reg_csicr3; | ||
| 303 | enum mx2_camera_type devtype; | ||
| 294 | 304 | ||
| 295 | struct mx2_buf_internal buf_discard[2]; | 305 | struct mx2_buf_internal buf_discard[2]; |
| 296 | void *discard_buffer; | 306 | void *discard_buffer; |
| @@ -303,6 +313,29 @@ struct mx2_camera_dev { | |||
| 303 | struct vb2_alloc_ctx *alloc_ctx; | 313 | struct vb2_alloc_ctx *alloc_ctx; |
| 304 | }; | 314 | }; |
| 305 | 315 | ||
| 316 | static struct platform_device_id mx2_camera_devtype[] = { | ||
| 317 | { | ||
| 318 | .name = "imx25-camera", | ||
| 319 | .driver_data = IMX25_CAMERA, | ||
| 320 | }, { | ||
| 321 | .name = "imx27-camera", | ||
| 322 | .driver_data = IMX27_CAMERA, | ||
| 323 | }, { | ||
| 324 | /* sentinel */ | ||
| 325 | } | ||
| 326 | }; | ||
| 327 | MODULE_DEVICE_TABLE(platform, mx2_camera_devtype); | ||
| 328 | |||
| 329 | static inline int is_imx25_camera(struct mx2_camera_dev *pcdev) | ||
| 330 | { | ||
| 331 | return pcdev->devtype == IMX25_CAMERA; | ||
| 332 | } | ||
| 333 | |||
| 334 | static inline int is_imx27_camera(struct mx2_camera_dev *pcdev) | ||
| 335 | { | ||
| 336 | return pcdev->devtype == IMX27_CAMERA; | ||
| 337 | } | ||
| 338 | |||
| 306 | static struct mx2_buffer *mx2_ibuf_to_buf(struct mx2_buf_internal *int_buf) | 339 | static struct mx2_buffer *mx2_ibuf_to_buf(struct mx2_buf_internal *int_buf) |
| 307 | { | 340 | { |
| 308 | return container_of(int_buf, struct mx2_buffer, internal); | 341 | return container_of(int_buf, struct mx2_buffer, internal); |
| @@ -432,11 +465,12 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) | |||
| 432 | { | 465 | { |
| 433 | unsigned long flags; | 466 | unsigned long flags; |
| 434 | 467 | ||
| 435 | clk_disable_unprepare(pcdev->clk_csi); | 468 | clk_disable_unprepare(pcdev->clk_csi_ahb); |
| 469 | clk_disable_unprepare(pcdev->clk_csi_per); | ||
| 436 | writel(0, pcdev->base_csi + CSICR1); | 470 | writel(0, pcdev->base_csi + CSICR1); |
| 437 | if (cpu_is_mx27()) { | 471 | if (is_imx27_camera(pcdev)) { |
| 438 | writel(0, pcdev->base_emma + PRP_CNTL); | 472 | writel(0, pcdev->base_emma + PRP_CNTL); |
| 439 | } else if (cpu_is_mx25()) { | 473 | } else if (is_imx25_camera(pcdev)) { |
| 440 | spin_lock_irqsave(&pcdev->lock, flags); | 474 | spin_lock_irqsave(&pcdev->lock, flags); |
| 441 | pcdev->fb1_active = NULL; | 475 | pcdev->fb1_active = NULL; |
| 442 | pcdev->fb2_active = NULL; | 476 | pcdev->fb2_active = NULL; |
| @@ -460,13 +494,17 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) | |||
| 460 | if (pcdev->icd) | 494 | if (pcdev->icd) |
| 461 | return -EBUSY; | 495 | return -EBUSY; |
| 462 | 496 | ||
| 463 | ret = clk_prepare_enable(pcdev->clk_csi); | 497 | ret = clk_prepare_enable(pcdev->clk_csi_ahb); |
| 464 | if (ret < 0) | 498 | if (ret < 0) |
| 465 | return ret; | 499 | return ret; |
| 466 | 500 | ||
| 501 | ret = clk_prepare_enable(pcdev->clk_csi_per); | ||
| 502 | if (ret < 0) | ||
| 503 | goto exit_csi_ahb; | ||
| 504 | |||
| 467 | csicr1 = CSICR1_MCLKEN; | 505 | csicr1 = CSICR1_MCLKEN; |
| 468 | 506 | ||
| 469 | if (cpu_is_mx27()) | 507 | if (is_imx27_camera(pcdev)) |
| 470 | csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC | | 508 | csicr1 |= CSICR1_PRP_IF_EN | CSICR1_FCC | |
| 471 | CSICR1_RXFF_LEVEL(0); | 509 | CSICR1_RXFF_LEVEL(0); |
| 472 | 510 | ||
| @@ -480,6 +518,11 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) | |||
| 480 | icd->devnum); | 518 | icd->devnum); |
| 481 | 519 | ||
| 482 | return 0; | 520 | return 0; |
| 521 | |||
| 522 | exit_csi_ahb: | ||
| 523 | clk_disable_unprepare(pcdev->clk_csi_ahb); | ||
| 524 | |||
| 525 | return ret; | ||
| 483 | } | 526 | } |
| 484 | 527 | ||
| 485 | static void mx2_camera_remove_device(struct soc_camera_device *icd) | 528 | static void mx2_camera_remove_device(struct soc_camera_device *icd) |
| @@ -542,7 +585,7 @@ out: | |||
| 542 | static irqreturn_t mx25_camera_irq(int irq_csi, void *data) | 585 | static irqreturn_t mx25_camera_irq(int irq_csi, void *data) |
| 543 | { | 586 | { |
| 544 | struct mx2_camera_dev *pcdev = data; | 587 | struct mx2_camera_dev *pcdev = data; |
| 545 | u32 status = readl(pcdev->base_csi + CSISR); | 588 | u32 status = readl(pcdev->base_csi + pcdev->reg_csisr); |
| 546 | 589 | ||
| 547 | if (status & CSISR_DMA_TSF_FB1_INT) | 590 | if (status & CSISR_DMA_TSF_FB1_INT) |
| 548 | mx25_camera_frame_done(pcdev, 1, MX2_STATE_DONE); | 591 | mx25_camera_frame_done(pcdev, 1, MX2_STATE_DONE); |
| @@ -551,7 +594,7 @@ static irqreturn_t mx25_camera_irq(int irq_csi, void *data) | |||
| 551 | 594 | ||
| 552 | /* FIXME: handle CSISR_RFF_OR_INT */ | 595 | /* FIXME: handle CSISR_RFF_OR_INT */ |
| 553 | 596 | ||
| 554 | writel(status, pcdev->base_csi + CSISR); | 597 | writel(status, pcdev->base_csi + pcdev->reg_csisr); |
| 555 | 598 | ||
| 556 | return IRQ_HANDLED; | 599 | return IRQ_HANDLED; |
| 557 | } | 600 | } |
| @@ -636,7 +679,7 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb) | |||
| 636 | buf->state = MX2_STATE_QUEUED; | 679 | buf->state = MX2_STATE_QUEUED; |
| 637 | list_add_tail(&buf->internal.queue, &pcdev->capture); | 680 | list_add_tail(&buf->internal.queue, &pcdev->capture); |
| 638 | 681 | ||
| 639 | if (cpu_is_mx25()) { | 682 | if (is_imx25_camera(pcdev)) { |
| 640 | u32 csicr3, dma_inten = 0; | 683 | u32 csicr3, dma_inten = 0; |
| 641 | 684 | ||
| 642 | if (pcdev->fb1_active == NULL) { | 685 | if (pcdev->fb1_active == NULL) { |
| @@ -655,20 +698,20 @@ static void mx2_videobuf_queue(struct vb2_buffer *vb) | |||
| 655 | list_del(&buf->internal.queue); | 698 | list_del(&buf->internal.queue); |
| 656 | buf->state = MX2_STATE_ACTIVE; | 699 | buf->state = MX2_STATE_ACTIVE; |
| 657 | 700 | ||
| 658 | csicr3 = readl(pcdev->base_csi + CSICR3); | 701 | csicr3 = readl(pcdev->base_csi + pcdev->reg_csicr3); |
| 659 | 702 | ||
| 660 | /* Reflash DMA */ | 703 | /* Reflash DMA */ |
| 661 | writel(csicr3 | CSICR3_DMA_REFLASH_RFF, | 704 | writel(csicr3 | CSICR3_DMA_REFLASH_RFF, |
| 662 | pcdev->base_csi + CSICR3); | 705 | pcdev->base_csi + pcdev->reg_csicr3); |
| 663 | 706 | ||
| 664 | /* clear & enable interrupts */ | 707 | /* clear & enable interrupts */ |
| 665 | writel(dma_inten, pcdev->base_csi + CSISR); | 708 | writel(dma_inten, pcdev->base_csi + pcdev->reg_csisr); |
| 666 | pcdev->csicr1 |= dma_inten; | 709 | pcdev->csicr1 |= dma_inten; |
| 667 | writel(pcdev->csicr1, pcdev->base_csi + CSICR1); | 710 | writel(pcdev->csicr1, pcdev->base_csi + CSICR1); |
| 668 | 711 | ||
| 669 | /* enable DMA */ | 712 | /* enable DMA */ |
| 670 | csicr3 |= CSICR3_DMA_REQ_EN_RFF | CSICR3_RXFF_LEVEL(1); | 713 | csicr3 |= CSICR3_DMA_REQ_EN_RFF | CSICR3_RXFF_LEVEL(1); |
| 671 | writel(csicr3, pcdev->base_csi + CSICR3); | 714 | writel(csicr3, pcdev->base_csi + pcdev->reg_csicr3); |
| 672 | } | 715 | } |
| 673 | } | 716 | } |
| 674 | 717 | ||
| @@ -712,7 +755,7 @@ static void mx2_videobuf_release(struct vb2_buffer *vb) | |||
| 712 | */ | 755 | */ |
| 713 | 756 | ||
| 714 | spin_lock_irqsave(&pcdev->lock, flags); | 757 | spin_lock_irqsave(&pcdev->lock, flags); |
| 715 | if (cpu_is_mx25() && buf->state == MX2_STATE_ACTIVE) { | 758 | if (is_imx25_camera(pcdev) && buf->state == MX2_STATE_ACTIVE) { |
| 716 | if (pcdev->fb1_active == buf) { | 759 | if (pcdev->fb1_active == buf) { |
| 717 | pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN; | 760 | pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN; |
| 718 | writel(0, pcdev->base_csi + CSIDMASA_FB1); | 761 | writel(0, pcdev->base_csi + CSIDMASA_FB1); |
| @@ -835,7 +878,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) | |||
| 835 | unsigned long phys; | 878 | unsigned long phys; |
| 836 | int bytesperline; | 879 | int bytesperline; |
| 837 | 880 | ||
| 838 | if (cpu_is_mx27()) { | 881 | if (is_imx27_camera(pcdev)) { |
| 839 | unsigned long flags; | 882 | unsigned long flags; |
| 840 | if (count < 2) | 883 | if (count < 2) |
| 841 | return -EINVAL; | 884 | return -EINVAL; |
| @@ -864,8 +907,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) | |||
| 864 | 907 | ||
| 865 | bytesperline = soc_mbus_bytes_per_line(icd->user_width, | 908 | bytesperline = soc_mbus_bytes_per_line(icd->user_width, |
| 866 | icd->current_fmt->host_fmt); | 909 | icd->current_fmt->host_fmt); |
| 867 | if (bytesperline < 0) | 910 | if (bytesperline < 0) { |
| 911 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
| 868 | return bytesperline; | 912 | return bytesperline; |
| 913 | } | ||
| 869 | 914 | ||
| 870 | /* | 915 | /* |
| 871 | * I didn't manage to properly enable/disable the prp | 916 | * I didn't manage to properly enable/disable the prp |
| @@ -878,8 +923,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count) | |||
| 878 | pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, | 923 | pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, |
| 879 | pcdev->discard_size, &pcdev->discard_buffer_dma, | 924 | pcdev->discard_size, &pcdev->discard_buffer_dma, |
| 880 | GFP_KERNEL); | 925 | GFP_KERNEL); |
| 881 | if (!pcdev->discard_buffer) | 926 | if (!pcdev->discard_buffer) { |
| 927 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
| 882 | return -ENOMEM; | 928 | return -ENOMEM; |
| 929 | } | ||
| 883 | 930 | ||
| 884 | pcdev->buf_discard[0].discard = true; | 931 | pcdev->buf_discard[0].discard = true; |
| 885 | list_add_tail(&pcdev->buf_discard[0].queue, | 932 | list_add_tail(&pcdev->buf_discard[0].queue, |
| @@ -930,7 +977,7 @@ static int mx2_stop_streaming(struct vb2_queue *q) | |||
| 930 | void *b; | 977 | void *b; |
| 931 | u32 cntl; | 978 | u32 cntl; |
| 932 | 979 | ||
| 933 | if (cpu_is_mx27()) { | 980 | if (is_imx27_camera(pcdev)) { |
| 934 | spin_lock_irqsave(&pcdev->lock, flags); | 981 | spin_lock_irqsave(&pcdev->lock, flags); |
| 935 | 982 | ||
| 936 | cntl = readl(pcdev->base_emma + PRP_CNTL); | 983 | cntl = readl(pcdev->base_emma + PRP_CNTL); |
| @@ -1082,11 +1129,11 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 1082 | if (bytesperline < 0) | 1129 | if (bytesperline < 0) |
| 1083 | return bytesperline; | 1130 | return bytesperline; |
| 1084 | 1131 | ||
| 1085 | if (cpu_is_mx27()) { | 1132 | if (is_imx27_camera(pcdev)) { |
| 1086 | ret = mx27_camera_emma_prp_reset(pcdev); | 1133 | ret = mx27_camera_emma_prp_reset(pcdev); |
| 1087 | if (ret) | 1134 | if (ret) |
| 1088 | return ret; | 1135 | return ret; |
| 1089 | } else if (cpu_is_mx25()) { | 1136 | } else if (is_imx25_camera(pcdev)) { |
| 1090 | writel((bytesperline * icd->user_height) >> 2, | 1137 | writel((bytesperline * icd->user_height) >> 2, |
| 1091 | pcdev->base_csi + CSIRXCNT); | 1138 | pcdev->base_csi + CSIRXCNT); |
| 1092 | writel((bytesperline << 16) | icd->user_height, | 1139 | writel((bytesperline << 16) | icd->user_height, |
| @@ -1099,9 +1146,10 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 1099 | } | 1146 | } |
| 1100 | 1147 | ||
| 1101 | static int mx2_camera_set_crop(struct soc_camera_device *icd, | 1148 | static int mx2_camera_set_crop(struct soc_camera_device *icd, |
| 1102 | struct v4l2_crop *a) | 1149 | const struct v4l2_crop *a) |
| 1103 | { | 1150 | { |
| 1104 | struct v4l2_rect *rect = &a->c; | 1151 | struct v4l2_crop a_writable = *a; |
| 1152 | struct v4l2_rect *rect = &a_writable.c; | ||
| 1105 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1153 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| 1106 | struct v4l2_mbus_framefmt mf; | 1154 | struct v4l2_mbus_framefmt mf; |
| 1107 | int ret; | 1155 | int ret; |
| @@ -1392,7 +1440,7 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd, | |||
| 1392 | /* FIXME: implement MX27 limits */ | 1440 | /* FIXME: implement MX27 limits */ |
| 1393 | 1441 | ||
| 1394 | /* limit to MX25 hardware capabilities */ | 1442 | /* limit to MX25 hardware capabilities */ |
| 1395 | if (cpu_is_mx25()) { | 1443 | if (is_imx25_camera(pcdev)) { |
| 1396 | if (xlate->host_fmt->bits_per_sample <= 8) | 1444 | if (xlate->host_fmt->bits_per_sample <= 8) |
| 1397 | width_limit = 0xffff * 4; | 1445 | width_limit = 0xffff * 4; |
| 1398 | else | 1446 | else |
| @@ -1644,7 +1692,7 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data) | |||
| 1644 | return IRQ_HANDLED; | 1692 | return IRQ_HANDLED; |
| 1645 | } | 1693 | } |
| 1646 | 1694 | ||
| 1647 | static int __devinit mx27_camera_emma_init(struct platform_device *pdev) | 1695 | static int mx27_camera_emma_init(struct platform_device *pdev) |
| 1648 | { | 1696 | { |
| 1649 | struct mx2_camera_dev *pcdev = platform_get_drvdata(pdev); | 1697 | struct mx2_camera_dev *pcdev = platform_get_drvdata(pdev); |
| 1650 | struct resource *res_emma; | 1698 | struct resource *res_emma; |
| @@ -1702,7 +1750,7 @@ out: | |||
| 1702 | return err; | 1750 | return err; |
| 1703 | } | 1751 | } |
| 1704 | 1752 | ||
| 1705 | static int __devinit mx2_camera_probe(struct platform_device *pdev) | 1753 | static int mx2_camera_probe(struct platform_device *pdev) |
| 1706 | { | 1754 | { |
| 1707 | struct mx2_camera_dev *pcdev; | 1755 | struct mx2_camera_dev *pcdev; |
| 1708 | struct resource *res_csi; | 1756 | struct resource *res_csi; |
| @@ -1726,10 +1774,31 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1726 | goto exit; | 1774 | goto exit; |
| 1727 | } | 1775 | } |
| 1728 | 1776 | ||
| 1729 | pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb"); | 1777 | pcdev->devtype = pdev->id_entry->driver_data; |
| 1730 | if (IS_ERR(pcdev->clk_csi)) { | 1778 | switch (pcdev->devtype) { |
| 1731 | dev_err(&pdev->dev, "Could not get csi clock\n"); | 1779 | case IMX25_CAMERA: |
| 1732 | err = PTR_ERR(pcdev->clk_csi); | 1780 | pcdev->reg_csisr = CSISR_IMX25; |
| 1781 | pcdev->reg_csicr3 = CSICR3_IMX25; | ||
| 1782 | break; | ||
| 1783 | case IMX27_CAMERA: | ||
| 1784 | pcdev->reg_csisr = CSISR_IMX27; | ||
| 1785 | pcdev->reg_csicr3 = CSICR3_IMX27; | ||
| 1786 | break; | ||
| 1787 | default: | ||
| 1788 | break; | ||
| 1789 | } | ||
| 1790 | |||
| 1791 | pcdev->clk_csi_ahb = devm_clk_get(&pdev->dev, "ahb"); | ||
| 1792 | if (IS_ERR(pcdev->clk_csi_ahb)) { | ||
| 1793 | dev_err(&pdev->dev, "Could not get csi ahb clock\n"); | ||
| 1794 | err = PTR_ERR(pcdev->clk_csi_ahb); | ||
| 1795 | goto exit; | ||
| 1796 | } | ||
| 1797 | |||
| 1798 | pcdev->clk_csi_per = devm_clk_get(&pdev->dev, "per"); | ||
| 1799 | if (IS_ERR(pcdev->clk_csi_per)) { | ||
| 1800 | dev_err(&pdev->dev, "Could not get csi per clock\n"); | ||
| 1801 | err = PTR_ERR(pcdev->clk_csi_per); | ||
| 1733 | goto exit; | 1802 | goto exit; |
| 1734 | } | 1803 | } |
| 1735 | 1804 | ||
| @@ -1739,12 +1808,13 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1739 | 1808 | ||
| 1740 | pcdev->platform_flags = pcdev->pdata->flags; | 1809 | pcdev->platform_flags = pcdev->pdata->flags; |
| 1741 | 1810 | ||
| 1742 | rate = clk_round_rate(pcdev->clk_csi, pcdev->pdata->clk * 2); | 1811 | rate = clk_round_rate(pcdev->clk_csi_per, |
| 1812 | pcdev->pdata->clk * 2); | ||
| 1743 | if (rate <= 0) { | 1813 | if (rate <= 0) { |
| 1744 | err = -ENODEV; | 1814 | err = -ENODEV; |
| 1745 | goto exit; | 1815 | goto exit; |
| 1746 | } | 1816 | } |
| 1747 | err = clk_set_rate(pcdev->clk_csi, rate); | 1817 | err = clk_set_rate(pcdev->clk_csi_per, rate); |
| 1748 | if (err < 0) | 1818 | if (err < 0) |
| 1749 | goto exit; | 1819 | goto exit; |
| 1750 | } | 1820 | } |
| @@ -1763,7 +1833,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1763 | pcdev->dev = &pdev->dev; | 1833 | pcdev->dev = &pdev->dev; |
| 1764 | platform_set_drvdata(pdev, pcdev); | 1834 | platform_set_drvdata(pdev, pcdev); |
| 1765 | 1835 | ||
| 1766 | if (cpu_is_mx25()) { | 1836 | if (is_imx25_camera(pcdev)) { |
| 1767 | err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0, | 1837 | err = devm_request_irq(&pdev->dev, irq_csi, mx25_camera_irq, 0, |
| 1768 | MX2_CAM_DRV_NAME, pcdev); | 1838 | MX2_CAM_DRV_NAME, pcdev); |
| 1769 | if (err) { | 1839 | if (err) { |
| @@ -1772,7 +1842,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1772 | } | 1842 | } |
| 1773 | } | 1843 | } |
| 1774 | 1844 | ||
| 1775 | if (cpu_is_mx27()) { | 1845 | if (is_imx27_camera(pcdev)) { |
| 1776 | err = mx27_camera_emma_init(pdev); | 1846 | err = mx27_camera_emma_init(pdev); |
| 1777 | if (err) | 1847 | if (err) |
| 1778 | goto exit; | 1848 | goto exit; |
| @@ -1789,7 +1859,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1789 | pcdev->soc_host.priv = pcdev; | 1859 | pcdev->soc_host.priv = pcdev; |
| 1790 | pcdev->soc_host.v4l2_dev.dev = &pdev->dev; | 1860 | pcdev->soc_host.v4l2_dev.dev = &pdev->dev; |
| 1791 | pcdev->soc_host.nr = pdev->id; | 1861 | pcdev->soc_host.nr = pdev->id; |
| 1792 | if (cpu_is_mx25()) | 1862 | if (is_imx25_camera(pcdev)) |
| 1793 | pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE; | 1863 | pcdev->soc_host.capabilities = SOCAM_HOST_CAP_STRIDE; |
| 1794 | 1864 | ||
| 1795 | pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); | 1865 | pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); |
| @@ -1802,14 +1872,14 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) | |||
| 1802 | goto exit_free_emma; | 1872 | goto exit_free_emma; |
| 1803 | 1873 | ||
| 1804 | dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n", | 1874 | dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n", |
| 1805 | clk_get_rate(pcdev->clk_csi)); | 1875 | clk_get_rate(pcdev->clk_csi_per)); |
| 1806 | 1876 | ||
| 1807 | return 0; | 1877 | return 0; |
| 1808 | 1878 | ||
| 1809 | exit_free_emma: | 1879 | exit_free_emma: |
| 1810 | vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); | 1880 | vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); |
| 1811 | eallocctx: | 1881 | eallocctx: |
| 1812 | if (cpu_is_mx27()) { | 1882 | if (is_imx27_camera(pcdev)) { |
| 1813 | clk_disable_unprepare(pcdev->clk_emma_ipg); | 1883 | clk_disable_unprepare(pcdev->clk_emma_ipg); |
| 1814 | clk_disable_unprepare(pcdev->clk_emma_ahb); | 1884 | clk_disable_unprepare(pcdev->clk_emma_ahb); |
| 1815 | } | 1885 | } |
| @@ -1817,7 +1887,7 @@ exit: | |||
| 1817 | return err; | 1887 | return err; |
| 1818 | } | 1888 | } |
| 1819 | 1889 | ||
| 1820 | static int __devexit mx2_camera_remove(struct platform_device *pdev) | 1890 | static int mx2_camera_remove(struct platform_device *pdev) |
| 1821 | { | 1891 | { |
| 1822 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); | 1892 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
| 1823 | struct mx2_camera_dev *pcdev = container_of(soc_host, | 1893 | struct mx2_camera_dev *pcdev = container_of(soc_host, |
| @@ -1827,7 +1897,7 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev) | |||
| 1827 | 1897 | ||
| 1828 | vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); | 1898 | vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); |
| 1829 | 1899 | ||
| 1830 | if (cpu_is_mx27()) { | 1900 | if (is_imx27_camera(pcdev)) { |
| 1831 | clk_disable_unprepare(pcdev->clk_emma_ipg); | 1901 | clk_disable_unprepare(pcdev->clk_emma_ipg); |
| 1832 | clk_disable_unprepare(pcdev->clk_emma_ahb); | 1902 | clk_disable_unprepare(pcdev->clk_emma_ahb); |
| 1833 | } | 1903 | } |
| @@ -1841,7 +1911,8 @@ static struct platform_driver mx2_camera_driver = { | |||
| 1841 | .driver = { | 1911 | .driver = { |
| 1842 | .name = MX2_CAM_DRV_NAME, | 1912 | .name = MX2_CAM_DRV_NAME, |
| 1843 | }, | 1913 | }, |
| 1844 | .remove = __devexit_p(mx2_camera_remove), | 1914 | .id_table = mx2_camera_devtype, |
| 1915 | .remove = mx2_camera_remove, | ||
| 1845 | }; | 1916 | }; |
| 1846 | 1917 | ||
| 1847 | 1918 | ||
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 3557ac97e430..45aef1053a49 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
| 18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | #include <linux/dma/ipu-dma.h> | ||
| 20 | 21 | ||
| 21 | #include <media/v4l2-common.h> | 22 | #include <media/v4l2-common.h> |
| 22 | #include <media/v4l2-dev.h> | 23 | #include <media/v4l2-dev.h> |
| @@ -24,7 +25,6 @@ | |||
| 24 | #include <media/soc_camera.h> | 25 | #include <media/soc_camera.h> |
| 25 | #include <media/soc_mediabus.h> | 26 | #include <media/soc_mediabus.h> |
| 26 | 27 | ||
| 27 | #include <mach/ipu.h> | ||
| 28 | #include <linux/platform_data/camera-mx3.h> | 28 | #include <linux/platform_data/camera-mx3.h> |
| 29 | #include <linux/platform_data/dma-imx.h> | 29 | #include <linux/platform_data/dma-imx.h> |
| 30 | 30 | ||
| @@ -799,9 +799,10 @@ static inline void stride_align(__u32 *width) | |||
| 799 | * default g_crop and cropcap from soc_camera.c | 799 | * default g_crop and cropcap from soc_camera.c |
| 800 | */ | 800 | */ |
| 801 | static int mx3_camera_set_crop(struct soc_camera_device *icd, | 801 | static int mx3_camera_set_crop(struct soc_camera_device *icd, |
| 802 | struct v4l2_crop *a) | 802 | const struct v4l2_crop *a) |
| 803 | { | 803 | { |
| 804 | struct v4l2_rect *rect = &a->c; | 804 | struct v4l2_crop a_writable = *a; |
| 805 | struct v4l2_rect *rect = &a_writable.c; | ||
| 805 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 806 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
| 806 | struct mx3_camera_dev *mx3_cam = ici->priv; | 807 | struct mx3_camera_dev *mx3_cam = ici->priv; |
| 807 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 808 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| @@ -1142,7 +1143,7 @@ static struct soc_camera_host_ops mx3_soc_camera_host_ops = { | |||
| 1142 | .set_bus_param = mx3_camera_set_bus_param, | 1143 | .set_bus_param = mx3_camera_set_bus_param, |
| 1143 | }; | 1144 | }; |
| 1144 | 1145 | ||
| 1145 | static int __devinit mx3_camera_probe(struct platform_device *pdev) | 1146 | static int mx3_camera_probe(struct platform_device *pdev) |
| 1146 | { | 1147 | { |
| 1147 | struct mx3_camera_dev *mx3_cam; | 1148 | struct mx3_camera_dev *mx3_cam; |
| 1148 | struct resource *res; | 1149 | struct resource *res; |
| @@ -1245,7 +1246,7 @@ egetres: | |||
| 1245 | return err; | 1246 | return err; |
| 1246 | } | 1247 | } |
| 1247 | 1248 | ||
| 1248 | static int __devexit mx3_camera_remove(struct platform_device *pdev) | 1249 | static int mx3_camera_remove(struct platform_device *pdev) |
| 1249 | { | 1250 | { |
| 1250 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); | 1251 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
| 1251 | struct mx3_camera_dev *mx3_cam = container_of(soc_host, | 1252 | struct mx3_camera_dev *mx3_cam = container_of(soc_host, |
| @@ -1278,7 +1279,7 @@ static struct platform_driver mx3_camera_driver = { | |||
| 1278 | .name = MX3_CAM_DRV_NAME, | 1279 | .name = MX3_CAM_DRV_NAME, |
| 1279 | }, | 1280 | }, |
| 1280 | .probe = mx3_camera_probe, | 1281 | .probe = mx3_camera_probe, |
| 1281 | .remove = __devexit_p(mx3_camera_remove), | 1282 | .remove = mx3_camera_remove, |
| 1282 | }; | 1283 | }; |
| 1283 | 1284 | ||
| 1284 | module_platform_driver(mx3_camera_driver); | 1285 | module_platform_driver(mx3_camera_driver); |
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c index fa08c7695ccb..39a77f0b8860 100644 --- a/drivers/media/platform/soc_camera/omap1_camera.c +++ b/drivers/media/platform/soc_camera/omap1_camera.c | |||
| @@ -34,12 +34,13 @@ | |||
| 34 | #include <media/videobuf-dma-contig.h> | 34 | #include <media/videobuf-dma-contig.h> |
| 35 | #include <media/videobuf-dma-sg.h> | 35 | #include <media/videobuf-dma-sg.h> |
| 36 | 36 | ||
| 37 | #include <plat/dma.h> | 37 | #include <linux/omap-dma.h> |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | #define DRIVER_NAME "omap1-camera" | 40 | #define DRIVER_NAME "omap1-camera" |
| 41 | #define DRIVER_VERSION "0.0.2" | 41 | #define DRIVER_VERSION "0.0.2" |
| 42 | 42 | ||
| 43 | #define OMAP_DMA_CAMERA_IF_RX 20 | ||
| 43 | 44 | ||
| 44 | /* | 45 | /* |
| 45 | * --------------------------------------------------------------------------- | 46 | * --------------------------------------------------------------------------- |
| @@ -1215,9 +1216,9 @@ static int set_mbus_format(struct omap1_cam_dev *pcdev, struct device *dev, | |||
| 1215 | } | 1216 | } |
| 1216 | 1217 | ||
| 1217 | static int omap1_cam_set_crop(struct soc_camera_device *icd, | 1218 | static int omap1_cam_set_crop(struct soc_camera_device *icd, |
| 1218 | struct v4l2_crop *crop) | 1219 | const struct v4l2_crop *crop) |
| 1219 | { | 1220 | { |
| 1220 | struct v4l2_rect *rect = &crop->c; | 1221 | const struct v4l2_rect *rect = &crop->c; |
| 1221 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; | 1222 | const struct soc_camera_format_xlate *xlate = icd->current_fmt; |
| 1222 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1223 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| 1223 | struct device *dev = icd->parent; | 1224 | struct device *dev = icd->parent; |
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 1e3776d08dac..523330d00dee 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c | |||
| @@ -1337,9 +1337,9 @@ static int pxa_camera_check_frame(u32 width, u32 height) | |||
| 1337 | } | 1337 | } |
| 1338 | 1338 | ||
| 1339 | static int pxa_camera_set_crop(struct soc_camera_device *icd, | 1339 | static int pxa_camera_set_crop(struct soc_camera_device *icd, |
| 1340 | struct v4l2_crop *a) | 1340 | const struct v4l2_crop *a) |
| 1341 | { | 1341 | { |
| 1342 | struct v4l2_rect *rect = &a->c; | 1342 | const struct v4l2_rect *rect = &a->c; |
| 1343 | struct device *dev = icd->parent; | 1343 | struct device *dev = icd->parent; |
| 1344 | struct soc_camera_host *ici = to_soc_camera_host(dev); | 1344 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
| 1345 | struct pxa_camera_dev *pcdev = ici->priv; | 1345 | struct pxa_camera_dev *pcdev = ici->priv; |
| @@ -1651,7 +1651,7 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | |||
| 1651 | .set_bus_param = pxa_camera_set_bus_param, | 1651 | .set_bus_param = pxa_camera_set_bus_param, |
| 1652 | }; | 1652 | }; |
| 1653 | 1653 | ||
| 1654 | static int __devinit pxa_camera_probe(struct platform_device *pdev) | 1654 | static int pxa_camera_probe(struct platform_device *pdev) |
| 1655 | { | 1655 | { |
| 1656 | struct pxa_camera_dev *pcdev; | 1656 | struct pxa_camera_dev *pcdev; |
| 1657 | struct resource *res; | 1657 | struct resource *res; |
| @@ -1801,7 +1801,7 @@ exit: | |||
| 1801 | return err; | 1801 | return err; |
| 1802 | } | 1802 | } |
| 1803 | 1803 | ||
| 1804 | static int __devexit pxa_camera_remove(struct platform_device *pdev) | 1804 | static int pxa_camera_remove(struct platform_device *pdev) |
| 1805 | { | 1805 | { |
| 1806 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); | 1806 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
| 1807 | struct pxa_camera_dev *pcdev = container_of(soc_host, | 1807 | struct pxa_camera_dev *pcdev = container_of(soc_host, |
| @@ -1840,7 +1840,7 @@ static struct platform_driver pxa_camera_driver = { | |||
| 1840 | .pm = &pxa_camera_pm, | 1840 | .pm = &pxa_camera_pm, |
| 1841 | }, | 1841 | }, |
| 1842 | .probe = pxa_camera_probe, | 1842 | .probe = pxa_camera_probe, |
| 1843 | .remove = __devexit_p(pxa_camera_remove), | 1843 | .remove = pxa_camera_remove, |
| 1844 | }; | 1844 | }; |
| 1845 | 1845 | ||
| 1846 | module_platform_driver(pxa_camera_driver); | 1846 | module_platform_driver(pxa_camera_driver); |
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 0a24253dcda2..ebbc126e71a6 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | |||
| @@ -1182,13 +1182,13 @@ static void sh_mobile_ceu_put_formats(struct soc_camera_device *icd) | |||
| 1182 | } | 1182 | } |
| 1183 | 1183 | ||
| 1184 | /* Check if any dimension of r1 is smaller than respective one of r2 */ | 1184 | /* Check if any dimension of r1 is smaller than respective one of r2 */ |
| 1185 | static bool is_smaller(struct v4l2_rect *r1, struct v4l2_rect *r2) | 1185 | static bool is_smaller(const struct v4l2_rect *r1, const struct v4l2_rect *r2) |
| 1186 | { | 1186 | { |
| 1187 | return r1->width < r2->width || r1->height < r2->height; | 1187 | return r1->width < r2->width || r1->height < r2->height; |
| 1188 | } | 1188 | } |
| 1189 | 1189 | ||
| 1190 | /* Check if r1 fails to cover r2 */ | 1190 | /* Check if r1 fails to cover r2 */ |
| 1191 | static bool is_inside(struct v4l2_rect *r1, struct v4l2_rect *r2) | 1191 | static bool is_inside(const struct v4l2_rect *r1, const struct v4l2_rect *r2) |
| 1192 | { | 1192 | { |
| 1193 | return r1->left > r2->left || r1->top > r2->top || | 1193 | return r1->left > r2->left || r1->top > r2->top || |
| 1194 | r1->left + r1->width < r2->left + r2->width || | 1194 | r1->left + r1->width < r2->left + r2->width || |
| @@ -1263,7 +1263,7 @@ static void update_subrect(struct sh_mobile_ceu_cam *cam) | |||
| 1263 | * 3. if (2) failed, try to request the maximum image | 1263 | * 3. if (2) failed, try to request the maximum image |
| 1264 | */ | 1264 | */ |
| 1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, | 1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, |
| 1266 | const struct v4l2_crop *cam_crop) | 1266 | struct v4l2_crop *cam_crop) |
| 1267 | { | 1267 | { |
| 1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| 1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; | 1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; |
| @@ -1519,7 +1519,8 @@ static int client_scale(struct soc_camera_device *icd, | |||
| 1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | 1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, |
| 1520 | const struct v4l2_crop *a) | 1520 | const struct v4l2_crop *a) |
| 1521 | { | 1521 | { |
| 1522 | struct v4l2_rect *rect = &a->c; | 1522 | struct v4l2_crop a_writable = *a; |
| 1523 | const struct v4l2_rect *rect = &a_writable.c; | ||
| 1523 | struct device *dev = icd->parent; | 1524 | struct device *dev = icd->parent; |
| 1524 | struct soc_camera_host *ici = to_soc_camera_host(dev); | 1525 | struct soc_camera_host *ici = to_soc_camera_host(dev); |
| 1525 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 1526 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
| @@ -1545,7 +1546,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | |||
| 1545 | * 1. - 2. Apply iterative camera S_CROP for new input window, read back | 1546 | * 1. - 2. Apply iterative camera S_CROP for new input window, read back |
| 1546 | * actual camera rectangle. | 1547 | * actual camera rectangle. |
| 1547 | */ | 1548 | */ |
| 1548 | ret = client_s_crop(icd, a, &cam_crop); | 1549 | ret = client_s_crop(icd, &a_writable, &cam_crop); |
| 1549 | if (ret < 0) | 1550 | if (ret < 0) |
| 1550 | return ret; | 1551 | return ret; |
| 1551 | 1552 | ||
| @@ -1946,7 +1947,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
| 1946 | } | 1947 | } |
| 1947 | 1948 | ||
| 1948 | static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, | 1949 | static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, |
| 1949 | struct v4l2_crop *a) | 1950 | const struct v4l2_crop *a) |
| 1950 | { | 1951 | { |
| 1951 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1952 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
| 1952 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 1953 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
| @@ -2070,7 +2071,7 @@ static int bus_notify(struct notifier_block *nb, | |||
| 2070 | return NOTIFY_DONE; | 2071 | return NOTIFY_DONE; |
| 2071 | } | 2072 | } |
| 2072 | 2073 | ||
| 2073 | static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) | 2074 | static int sh_mobile_ceu_probe(struct platform_device *pdev) |
| 2074 | { | 2075 | { |
| 2075 | struct sh_mobile_ceu_dev *pcdev; | 2076 | struct sh_mobile_ceu_dev *pcdev; |
| 2076 | struct resource *res; | 2077 | struct resource *res; |
| @@ -2257,7 +2258,7 @@ exit: | |||
| 2257 | return err; | 2258 | return err; |
| 2258 | } | 2259 | } |
| 2259 | 2260 | ||
| 2260 | static int __devexit sh_mobile_ceu_remove(struct platform_device *pdev) | 2261 | static int sh_mobile_ceu_remove(struct platform_device *pdev) |
| 2261 | { | 2262 | { |
| 2262 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); | 2263 | struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); |
| 2263 | struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, | 2264 | struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, |
| @@ -2306,7 +2307,7 @@ static struct platform_driver sh_mobile_ceu_driver = { | |||
| 2306 | .pm = &sh_mobile_ceu_dev_pm_ops, | 2307 | .pm = &sh_mobile_ceu_dev_pm_ops, |
| 2307 | }, | 2308 | }, |
| 2308 | .probe = sh_mobile_ceu_probe, | 2309 | .probe = sh_mobile_ceu_probe, |
| 2309 | .remove = __devexit_p(sh_mobile_ceu_remove), | 2310 | .remove = sh_mobile_ceu_remove, |
| 2310 | }; | 2311 | }; |
| 2311 | 2312 | ||
| 2312 | static int __init sh_mobile_ceu_init(void) | 2313 | static int __init sh_mobile_ceu_init(void) |
diff --git a/drivers/media/platform/soc_camera/sh_mobile_csi2.c b/drivers/media/platform/soc_camera/sh_mobile_csi2.c index 05286500b4d4..a17aba9a0104 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_csi2.c +++ b/drivers/media/platform/soc_camera/sh_mobile_csi2.c | |||
| @@ -294,7 +294,7 @@ static struct v4l2_subdev_ops sh_csi2_subdev_ops = { | |||
| 294 | .video = &sh_csi2_subdev_video_ops, | 294 | .video = &sh_csi2_subdev_video_ops, |
| 295 | }; | 295 | }; |
| 296 | 296 | ||
| 297 | static __devinit int sh_csi2_probe(struct platform_device *pdev) | 297 | static int sh_csi2_probe(struct platform_device *pdev) |
| 298 | { | 298 | { |
| 299 | struct resource *res; | 299 | struct resource *res; |
| 300 | unsigned int irq; | 300 | unsigned int irq; |
| @@ -366,7 +366,7 @@ ereqreg: | |||
| 366 | return ret; | 366 | return ret; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | static __devexit int sh_csi2_remove(struct platform_device *pdev) | 369 | static int sh_csi2_remove(struct platform_device *pdev) |
| 370 | { | 370 | { |
| 371 | struct sh_csi2 *priv = platform_get_drvdata(pdev); | 371 | struct sh_csi2 *priv = platform_get_drvdata(pdev); |
| 372 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 372 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -382,7 +382,7 @@ static __devexit int sh_csi2_remove(struct platform_device *pdev) | |||
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | static struct platform_driver __refdata sh_csi2_pdrv = { | 384 | static struct platform_driver __refdata sh_csi2_pdrv = { |
| 385 | .remove = __devexit_p(sh_csi2_remove), | 385 | .remove = sh_csi2_remove, |
| 386 | .probe = sh_csi2_probe, | 386 | .probe = sh_csi2_probe, |
| 387 | .driver = { | 387 | .driver = { |
| 388 | .name = "sh-mobile-csi2", | 388 | .name = "sh-mobile-csi2", |
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index d3f0b84e2d70..2ec90eae6ba0 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
| @@ -645,11 +645,17 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, | |||
| 645 | size_t count, loff_t *ppos) | 645 | size_t count, loff_t *ppos) |
| 646 | { | 646 | { |
| 647 | struct soc_camera_device *icd = file->private_data; | 647 | struct soc_camera_device *icd = file->private_data; |
| 648 | int err = -EINVAL; | 648 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
| 649 | |||
| 650 | dev_dbg(icd->pdev, "read called, buf %p\n", buf); | ||
| 651 | |||
| 652 | if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) | ||
| 653 | return vb2_read(&icd->vb2_vidq, buf, count, ppos, | ||
| 654 | file->f_flags & O_NONBLOCK); | ||
| 649 | 655 | ||
| 650 | dev_err(icd->pdev, "camera device read not implemented\n"); | 656 | dev_err(icd->pdev, "camera device read not implemented\n"); |
| 651 | 657 | ||
| 652 | return err; | 658 | return -EINVAL; |
| 653 | } | 659 | } |
| 654 | 660 | ||
| 655 | static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) | 661 | static int soc_camera_mmap(struct file *file, struct vm_area_struct *vma) |
| @@ -1048,10 +1054,8 @@ static void scan_add_host(struct soc_camera_host *ici) | |||
| 1048 | 1054 | ||
| 1049 | list_for_each_entry(icd, &devices, list) { | 1055 | list_for_each_entry(icd, &devices, list) { |
| 1050 | if (icd->iface == ici->nr) { | 1056 | if (icd->iface == ici->nr) { |
| 1051 | int ret; | ||
| 1052 | |||
| 1053 | icd->parent = ici->v4l2_dev.dev; | 1057 | icd->parent = ici->v4l2_dev.dev; |
| 1054 | ret = soc_camera_probe(icd); | 1058 | soc_camera_probe(icd); |
| 1055 | } | 1059 | } |
| 1056 | } | 1060 | } |
| 1057 | 1061 | ||
| @@ -1526,7 +1530,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) | |||
| 1526 | return 0; | 1530 | return 0; |
| 1527 | } | 1531 | } |
| 1528 | 1532 | ||
| 1529 | static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | 1533 | static int soc_camera_pdrv_probe(struct platform_device *pdev) |
| 1530 | { | 1534 | { |
| 1531 | struct soc_camera_link *icl = pdev->dev.platform_data; | 1535 | struct soc_camera_link *icl = pdev->dev.platform_data; |
| 1532 | struct soc_camera_device *icd; | 1536 | struct soc_camera_device *icd; |
| @@ -1554,7 +1558,7 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) | |||
| 1554 | * hot-pluggable. Now we know, that all our users - hosts and devices have | 1558 | * hot-pluggable. Now we know, that all our users - hosts and devices have |
| 1555 | * been unloaded already | 1559 | * been unloaded already |
| 1556 | */ | 1560 | */ |
| 1557 | static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev) | 1561 | static int soc_camera_pdrv_remove(struct platform_device *pdev) |
| 1558 | { | 1562 | { |
| 1559 | struct soc_camera_device *icd = platform_get_drvdata(pdev); | 1563 | struct soc_camera_device *icd = platform_get_drvdata(pdev); |
| 1560 | 1564 | ||
| @@ -1568,7 +1572,7 @@ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev) | |||
| 1568 | 1572 | ||
| 1569 | static struct platform_driver __refdata soc_camera_pdrv = { | 1573 | static struct platform_driver __refdata soc_camera_pdrv = { |
| 1570 | .probe = soc_camera_pdrv_probe, | 1574 | .probe = soc_camera_pdrv_probe, |
| 1571 | .remove = __devexit_p(soc_camera_pdrv_remove), | 1575 | .remove = soc_camera_pdrv_remove, |
| 1572 | .driver = { | 1576 | .driver = { |
| 1573 | .name = "soc-camera-pdrv", | 1577 | .name = "soc-camera-pdrv", |
| 1574 | .owner = THIS_MODULE, | 1578 | .owner = THIS_MODULE, |
diff --git a/drivers/media/platform/timblogiw.c b/drivers/media/platform/timblogiw.c index 02194c056b00..d854d08a6c7f 100644 --- a/drivers/media/platform/timblogiw.c +++ b/drivers/media/platform/timblogiw.c | |||
| @@ -745,7 +745,7 @@ static int timblogiw_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 745 | 745 | ||
| 746 | /* Platform device functions */ | 746 | /* Platform device functions */ |
| 747 | 747 | ||
| 748 | static __devinitconst struct v4l2_ioctl_ops timblogiw_ioctl_ops = { | 748 | static struct v4l2_ioctl_ops timblogiw_ioctl_ops = { |
| 749 | .vidioc_querycap = timblogiw_querycap, | 749 | .vidioc_querycap = timblogiw_querycap, |
| 750 | .vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt, | 750 | .vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt, |
| 751 | .vidioc_g_fmt_vid_cap = timblogiw_g_fmt, | 751 | .vidioc_g_fmt_vid_cap = timblogiw_g_fmt, |
| @@ -767,7 +767,7 @@ static __devinitconst struct v4l2_ioctl_ops timblogiw_ioctl_ops = { | |||
| 767 | .vidioc_enum_framesizes = timblogiw_enum_framesizes, | 767 | .vidioc_enum_framesizes = timblogiw_enum_framesizes, |
| 768 | }; | 768 | }; |
| 769 | 769 | ||
| 770 | static __devinitconst struct v4l2_file_operations timblogiw_fops = { | 770 | static struct v4l2_file_operations timblogiw_fops = { |
| 771 | .owner = THIS_MODULE, | 771 | .owner = THIS_MODULE, |
| 772 | .open = timblogiw_open, | 772 | .open = timblogiw_open, |
| 773 | .release = timblogiw_close, | 773 | .release = timblogiw_close, |
| @@ -777,7 +777,7 @@ static __devinitconst struct v4l2_file_operations timblogiw_fops = { | |||
| 777 | .poll = timblogiw_poll, | 777 | .poll = timblogiw_poll, |
| 778 | }; | 778 | }; |
| 779 | 779 | ||
| 780 | static __devinitconst struct video_device timblogiw_template = { | 780 | static struct video_device timblogiw_template = { |
| 781 | .name = TIMBLOGIWIN_NAME, | 781 | .name = TIMBLOGIWIN_NAME, |
| 782 | .fops = &timblogiw_fops, | 782 | .fops = &timblogiw_fops, |
| 783 | .ioctl_ops = &timblogiw_ioctl_ops, | 783 | .ioctl_ops = &timblogiw_ioctl_ops, |
| @@ -786,7 +786,7 @@ static __devinitconst struct video_device timblogiw_template = { | |||
| 786 | .tvnorms = V4L2_STD_PAL | V4L2_STD_NTSC | 786 | .tvnorms = V4L2_STD_PAL | V4L2_STD_NTSC |
| 787 | }; | 787 | }; |
| 788 | 788 | ||
| 789 | static int __devinit timblogiw_probe(struct platform_device *pdev) | 789 | static int timblogiw_probe(struct platform_device *pdev) |
| 790 | { | 790 | { |
| 791 | int err; | 791 | int err; |
| 792 | struct timblogiw *lw = NULL; | 792 | struct timblogiw *lw = NULL; |
| @@ -848,7 +848,7 @@ err: | |||
| 848 | return err; | 848 | return err; |
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | static int __devexit timblogiw_remove(struct platform_device *pdev) | 851 | static int timblogiw_remove(struct platform_device *pdev) |
| 852 | { | 852 | { |
| 853 | struct timblogiw *lw = platform_get_drvdata(pdev); | 853 | struct timblogiw *lw = platform_get_drvdata(pdev); |
| 854 | 854 | ||
| @@ -869,7 +869,7 @@ static struct platform_driver timblogiw_platform_driver = { | |||
| 869 | .owner = THIS_MODULE, | 869 | .owner = THIS_MODULE, |
| 870 | }, | 870 | }, |
| 871 | .probe = timblogiw_probe, | 871 | .probe = timblogiw_probe, |
| 872 | .remove = __devexit_p(timblogiw_remove), | 872 | .remove = timblogiw_remove, |
| 873 | }; | 873 | }; |
| 874 | 874 | ||
| 875 | module_platform_driver(timblogiw_platform_driver); | 875 | module_platform_driver(timblogiw_platform_driver); |
diff --git a/drivers/media/platform/via-camera.c b/drivers/media/platform/via-camera.c index eb404c2ce270..63e8c3461239 100644 --- a/drivers/media/platform/via-camera.c +++ b/drivers/media/platform/via-camera.c | |||
| @@ -1324,7 +1324,7 @@ static struct video_device viacam_v4l_template = { | |||
| 1324 | #define VIACAM_SERIAL_CREG 0x46 | 1324 | #define VIACAM_SERIAL_CREG 0x46 |
| 1325 | #define VIACAM_SERIAL_BIT 0x40 | 1325 | #define VIACAM_SERIAL_BIT 0x40 |
| 1326 | 1326 | ||
| 1327 | static __devinit bool viacam_serial_is_enabled(void) | 1327 | static bool viacam_serial_is_enabled(void) |
| 1328 | { | 1328 | { |
| 1329 | struct pci_bus *pbus = pci_find_bus(0, 0); | 1329 | struct pci_bus *pbus = pci_find_bus(0, 0); |
| 1330 | u8 cbyte; | 1330 | u8 cbyte; |
| @@ -1353,7 +1353,7 @@ static struct ov7670_config sensor_cfg = { | |||
| 1353 | .clock_speed = 90, | 1353 | .clock_speed = 90, |
| 1354 | }; | 1354 | }; |
| 1355 | 1355 | ||
| 1356 | static __devinit int viacam_probe(struct platform_device *pdev) | 1356 | static int viacam_probe(struct platform_device *pdev) |
| 1357 | { | 1357 | { |
| 1358 | int ret; | 1358 | int ret; |
| 1359 | struct i2c_adapter *sensor_adapter; | 1359 | struct i2c_adapter *sensor_adapter; |
| @@ -1490,7 +1490,7 @@ out_unregister: | |||
| 1490 | return ret; | 1490 | return ret; |
| 1491 | } | 1491 | } |
| 1492 | 1492 | ||
| 1493 | static __devexit int viacam_remove(struct platform_device *pdev) | 1493 | static int viacam_remove(struct platform_device *pdev) |
| 1494 | { | 1494 | { |
| 1495 | struct via_camera *cam = via_cam_info; | 1495 | struct via_camera *cam = via_cam_info; |
| 1496 | struct viafb_dev *viadev = pdev->dev.platform_data; | 1496 | struct viafb_dev *viadev = pdev->dev.platform_data; |
diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c index b366b050a3dd..0d59b9db83cb 100644 --- a/drivers/media/platform/vivi.c +++ b/drivers/media/platform/vivi.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | /* Wake up at about 30 fps */ | 39 | /* Wake up at about 30 fps */ |
| 40 | #define WAKE_NUMERATOR 30 | 40 | #define WAKE_NUMERATOR 30 |
| 41 | #define WAKE_DENOMINATOR 1001 | 41 | #define WAKE_DENOMINATOR 1001 |
| 42 | #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ | ||
| 43 | 42 | ||
| 44 | #define MAX_WIDTH 1920 | 43 | #define MAX_WIDTH 1920 |
| 45 | #define MAX_HEIGHT 1200 | 44 | #define MAX_HEIGHT 1200 |
| @@ -352,11 +351,6 @@ static void precalculate_bars(struct vivi_dev *dev) | |||
| 352 | } | 351 | } |
| 353 | } | 352 | } |
| 354 | 353 | ||
| 355 | #define TSTAMP_MIN_Y 24 | ||
| 356 | #define TSTAMP_MAX_Y (TSTAMP_MIN_Y + 15) | ||
| 357 | #define TSTAMP_INPUT_X 10 | ||
| 358 | #define TSTAMP_MIN_X (54 + TSTAMP_INPUT_X) | ||
| 359 | |||
| 360 | /* 'odd' is true for pixels 1, 3, 5, etc. and false for pixels 0, 2, 4, etc. */ | 354 | /* 'odd' is true for pixels 1, 3, 5, etc. and false for pixels 0, 2, 4, etc. */ |
| 361 | static void gen_twopix(struct vivi_dev *dev, u8 *buf, int colorpos, bool odd) | 355 | static void gen_twopix(struct vivi_dev *dev, u8 *buf, int colorpos, bool odd) |
| 362 | { | 356 | { |
| @@ -1308,7 +1302,7 @@ static int __init vivi_create_instance(int inst) | |||
| 1308 | /* initialize queue */ | 1302 | /* initialize queue */ |
| 1309 | q = &dev->vb_vidq; | 1303 | q = &dev->vb_vidq; |
| 1310 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1304 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
| 1311 | q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; | 1305 | q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ; |
| 1312 | q->drv_priv = dev; | 1306 | q->drv_priv = dev; |
| 1313 | q->buf_struct_size = sizeof(struct vivi_buffer); | 1307 | q->buf_struct_size = sizeof(struct vivi_buffer); |
| 1314 | q->ops = &vivi_video_qops; | 1308 | q->ops = &vivi_video_qops; |
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 12c70e876f58..a739ad492e7b 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
| @@ -82,7 +82,7 @@ static struct radio_isa_card *rtrack_alloc(void) | |||
| 82 | #define AIMS_BIT_VOL_UP (1 << 6) /* active low */ | 82 | #define AIMS_BIT_VOL_UP (1 << 6) /* active low */ |
| 83 | #define AIMS_BIT_VOL_DN (1 << 7) /* active low */ | 83 | #define AIMS_BIT_VOL_DN (1 << 7) /* active low */ |
| 84 | 84 | ||
| 85 | void rtrack_set_pins(void *handle, u8 pins) | 85 | static void rtrack_set_pins(void *handle, u8 pins) |
| 86 | { | 86 | { |
| 87 | struct radio_isa_card *isa = handle; | 87 | struct radio_isa_card *isa = handle; |
| 88 | struct rtrack *rt = container_of(isa, struct rtrack, isa); | 88 | struct rtrack *rt = container_of(isa, struct rtrack, isa); |
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 697a421c9940..643d80ac28fb 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
| @@ -645,7 +645,8 @@ static int __init cadet_init(void) | |||
| 645 | set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags); | 645 | set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags); |
| 646 | video_set_drvdata(&dev->vdev, dev); | 646 | video_set_drvdata(&dev->vdev, dev); |
| 647 | 647 | ||
| 648 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) | 648 | res = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); |
| 649 | if (res < 0) | ||
| 649 | goto err_hdl; | 650 | goto err_hdl; |
| 650 | v4l2_info(v4l2_dev, "ADS Cadet Radio Card at 0x%x\n", dev->io); | 651 | v4l2_info(v4l2_dev, "ADS Cadet Radio Card at 0x%x\n", dev->io); |
| 651 | return 0; | 652 | return 0; |
diff --git a/drivers/media/radio/radio-isa.c b/drivers/media/radio/radio-isa.c index 3c0067de4324..84b7b9f4385e 100644 --- a/drivers/media/radio/radio-isa.c +++ b/drivers/media/radio/radio-isa.c | |||
| @@ -191,7 +191,7 @@ static bool radio_isa_valid_io(const struct radio_isa_driver *drv, int io) | |||
| 191 | return false; | 191 | return false; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | struct radio_isa_card *radio_isa_alloc(struct radio_isa_driver *drv, | 194 | static struct radio_isa_card *radio_isa_alloc(struct radio_isa_driver *drv, |
| 195 | struct device *pdev) | 195 | struct device *pdev) |
| 196 | { | 196 | { |
| 197 | struct v4l2_device *v4l2_dev; | 197 | struct v4l2_device *v4l2_dev; |
| @@ -207,8 +207,9 @@ struct radio_isa_card *radio_isa_alloc(struct radio_isa_driver *drv, | |||
| 207 | return isa; | 207 | return isa; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | int radio_isa_common_probe(struct radio_isa_card *isa, struct device *pdev, | 210 | static int radio_isa_common_probe(struct radio_isa_card *isa, |
| 211 | int radio_nr, unsigned region_size) | 211 | struct device *pdev, |
| 212 | int radio_nr, unsigned region_size) | ||
| 212 | { | 213 | { |
| 213 | const struct radio_isa_driver *drv = isa->drv; | 214 | const struct radio_isa_driver *drv = isa->drv; |
| 214 | const struct radio_isa_ops *ops = drv->ops; | 215 | const struct radio_isa_ops *ops = drv->ops; |
| @@ -287,7 +288,8 @@ err_dev_reg: | |||
| 287 | return res; | 288 | return res; |
| 288 | } | 289 | } |
| 289 | 290 | ||
| 290 | int radio_isa_common_remove(struct radio_isa_card *isa, unsigned region_size) | 291 | static int radio_isa_common_remove(struct radio_isa_card *isa, |
| 292 | unsigned region_size) | ||
| 291 | { | 293 | { |
| 292 | const struct radio_isa_ops *ops = isa->drv->ops; | 294 | const struct radio_isa_ops *ops = isa->drv->ops; |
| 293 | 295 | ||
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index b415211d0c4b..bd4d3a7cdadd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
| @@ -114,7 +114,8 @@ static struct snd_tea575x_ops maxiradio_tea_ops = { | |||
| 114 | .set_direction = maxiradio_tea575x_set_direction, | 114 | .set_direction = maxiradio_tea575x_set_direction, |
| 115 | }; | 115 | }; |
| 116 | 116 | ||
| 117 | static int __devinit maxiradio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 117 | static int maxiradio_probe(struct pci_dev *pdev, |
| 118 | const struct pci_device_id *ent) | ||
| 118 | { | 119 | { |
| 119 | struct maxiradio *dev; | 120 | struct maxiradio *dev; |
| 120 | struct v4l2_device *v4l2_dev; | 121 | struct v4l2_device *v4l2_dev; |
| @@ -172,7 +173,7 @@ errfr: | |||
| 172 | return retval; | 173 | return retval; |
| 173 | } | 174 | } |
| 174 | 175 | ||
| 175 | static void __devexit maxiradio_remove(struct pci_dev *pdev) | 176 | static void maxiradio_remove(struct pci_dev *pdev) |
| 176 | { | 177 | { |
| 177 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); | 178 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); |
| 178 | struct maxiradio *dev = to_maxiradio(v4l2_dev); | 179 | struct maxiradio *dev = to_maxiradio(v4l2_dev); |
| @@ -196,7 +197,7 @@ static struct pci_driver maxiradio_driver = { | |||
| 196 | .name = "radio-maxiradio", | 197 | .name = "radio-maxiradio", |
| 197 | .id_table = maxiradio_pci_tbl, | 198 | .id_table = maxiradio_pci_tbl, |
| 198 | .probe = maxiradio_probe, | 199 | .probe = maxiradio_probe, |
| 199 | .remove = __devexit_p(maxiradio_remove), | 200 | .remove = maxiradio_remove, |
| 200 | }; | 201 | }; |
| 201 | 202 | ||
| 202 | static int __init maxiradio_init(void) | 203 | static int __init maxiradio_init(void) |
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 227dcdb54df3..637a55564958 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
| @@ -64,7 +64,7 @@ bool pnp_attached; | |||
| 64 | #define FMI_BIT_VOL_SW (1 << 3) | 64 | #define FMI_BIT_VOL_SW (1 << 3) |
| 65 | #define FMI_BIT_TUN_STRQ (1 << 4) | 65 | #define FMI_BIT_TUN_STRQ (1 << 4) |
| 66 | 66 | ||
| 67 | void fmi_set_pins(void *handle, u8 pins) | 67 | static void fmi_set_pins(void *handle, u8 pins) |
| 68 | { | 68 | { |
| 69 | struct fmi *fmi = handle; | 69 | struct fmi *fmi = handle; |
| 70 | u8 bits = FMI_BIT_TUN_STRQ; | 70 | u8 bits = FMI_BIT_TUN_STRQ; |
| @@ -265,7 +265,7 @@ static const struct v4l2_ioctl_ops fmi_ioctl_ops = { | |||
| 265 | }; | 265 | }; |
| 266 | 266 | ||
| 267 | /* ladis: this is my card. does any other types exist? */ | 267 | /* ladis: this is my card. does any other types exist? */ |
| 268 | static struct isapnp_device_id id_table[] __devinitdata = { | 268 | static struct isapnp_device_id id_table[] = { |
| 269 | /* SF16-FMI */ | 269 | /* SF16-FMI */ |
| 270 | { ISAPNP_ANY_ID, ISAPNP_ANY_ID, | 270 | { ISAPNP_ANY_ID, ISAPNP_ANY_ID, |
| 271 | ISAPNP_VENDOR('M','F','R'), ISAPNP_FUNCTION(0xad10), 0}, | 271 | ISAPNP_VENDOR('M','F','R'), ISAPNP_FUNCTION(0xad10), 0}, |
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 4efcbec74c52..9c0990457a7c 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
| @@ -197,13 +197,13 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea) | |||
| 197 | return 0; | 197 | return 0; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static struct pnp_device_id fmr2_pnp_ids[] __devinitdata = { | 200 | static struct pnp_device_id fmr2_pnp_ids[] = { |
| 201 | { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */ | 201 | { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */ |
| 202 | { .id = "" } | 202 | { .id = "" } |
| 203 | }; | 203 | }; |
| 204 | MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids); | 204 | MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids); |
| 205 | 205 | ||
| 206 | static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) | 206 | static int fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) |
| 207 | { | 207 | { |
| 208 | int err, i; | 208 | int err, i; |
| 209 | char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2"; | 209 | char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2"; |
| @@ -249,7 +249,7 @@ static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) | |||
| 249 | return 0; | 249 | return 0; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | static int __devinit fmr2_isa_match(struct device *pdev, unsigned int ndev) | 252 | static int fmr2_isa_match(struct device *pdev, unsigned int ndev) |
| 253 | { | 253 | { |
| 254 | struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); | 254 | struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); |
| 255 | if (!fmr2) | 255 | if (!fmr2) |
| @@ -265,8 +265,7 @@ static int __devinit fmr2_isa_match(struct device *pdev, unsigned int ndev) | |||
| 265 | return 1; | 265 | return 1; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static int __devinit fmr2_pnp_probe(struct pnp_dev *pdev, | 268 | static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id) |
| 269 | const struct pnp_device_id *id) | ||
| 270 | { | 269 | { |
| 271 | int ret; | 270 | int ret; |
| 272 | struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); | 271 | struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); |
| @@ -285,7 +284,7 @@ static int __devinit fmr2_pnp_probe(struct pnp_dev *pdev, | |||
| 285 | return 0; | 284 | return 0; |
| 286 | } | 285 | } |
| 287 | 286 | ||
| 288 | static void __devexit fmr2_remove(struct fmr2 *fmr2) | 287 | static void fmr2_remove(struct fmr2 *fmr2) |
| 289 | { | 288 | { |
| 290 | snd_tea575x_exit(&fmr2->tea); | 289 | snd_tea575x_exit(&fmr2->tea); |
| 291 | release_region(fmr2->io, 2); | 290 | release_region(fmr2->io, 2); |
| @@ -293,7 +292,7 @@ static void __devexit fmr2_remove(struct fmr2 *fmr2) | |||
| 293 | kfree(fmr2); | 292 | kfree(fmr2); |
| 294 | } | 293 | } |
| 295 | 294 | ||
| 296 | static int __devexit fmr2_isa_remove(struct device *pdev, unsigned int ndev) | 295 | static int fmr2_isa_remove(struct device *pdev, unsigned int ndev) |
| 297 | { | 296 | { |
| 298 | fmr2_remove(dev_get_drvdata(pdev)); | 297 | fmr2_remove(dev_get_drvdata(pdev)); |
| 299 | dev_set_drvdata(pdev, NULL); | 298 | dev_set_drvdata(pdev, NULL); |
| @@ -301,7 +300,7 @@ static int __devexit fmr2_isa_remove(struct device *pdev, unsigned int ndev) | |||
| 301 | return 0; | 300 | return 0; |
| 302 | } | 301 | } |
| 303 | 302 | ||
| 304 | static void __devexit fmr2_pnp_remove(struct pnp_dev *pdev) | 303 | static void fmr2_pnp_remove(struct pnp_dev *pdev) |
| 305 | { | 304 | { |
| 306 | fmr2_remove(pnp_get_drvdata(pdev)); | 305 | fmr2_remove(pnp_get_drvdata(pdev)); |
| 307 | pnp_set_drvdata(pdev, NULL); | 306 | pnp_set_drvdata(pdev, NULL); |
| @@ -309,7 +308,7 @@ static void __devexit fmr2_pnp_remove(struct pnp_dev *pdev) | |||
| 309 | 308 | ||
| 310 | struct isa_driver fmr2_isa_driver = { | 309 | struct isa_driver fmr2_isa_driver = { |
| 311 | .match = fmr2_isa_match, | 310 | .match = fmr2_isa_match, |
| 312 | .remove = __devexit_p(fmr2_isa_remove), | 311 | .remove = fmr2_isa_remove, |
| 313 | .driver = { | 312 | .driver = { |
| 314 | .name = "radio-sf16fmr2", | 313 | .name = "radio-sf16fmr2", |
| 315 | }, | 314 | }, |
| @@ -319,7 +318,7 @@ struct pnp_driver fmr2_pnp_driver = { | |||
| 319 | .name = "radio-sf16fmr2", | 318 | .name = "radio-sf16fmr2", |
| 320 | .id_table = fmr2_pnp_ids, | 319 | .id_table = fmr2_pnp_ids, |
| 321 | .probe = fmr2_pnp_probe, | 320 | .probe = fmr2_pnp_probe, |
| 322 | .remove = __devexit_p(fmr2_pnp_remove), | 321 | .remove = fmr2_pnp_remove, |
| 323 | }; | 322 | }; |
| 324 | 323 | ||
| 325 | static int __init fmr2_init(void) | 324 | static int __init fmr2_init(void) |
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index d0c905310071..1978516af67e 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
| @@ -145,7 +145,7 @@ struct tea5764_device { | |||
| 145 | }; | 145 | }; |
| 146 | 146 | ||
| 147 | /* I2C code related */ | 147 | /* I2C code related */ |
| 148 | int tea5764_i2c_read(struct tea5764_device *radio) | 148 | static int tea5764_i2c_read(struct tea5764_device *radio) |
| 149 | { | 149 | { |
| 150 | int i; | 150 | int i; |
| 151 | u16 *p = (u16 *) &radio->regs; | 151 | u16 *p = (u16 *) &radio->regs; |
| @@ -165,7 +165,7 @@ int tea5764_i2c_read(struct tea5764_device *radio) | |||
| 165 | return 0; | 165 | return 0; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | int tea5764_i2c_write(struct tea5764_device *radio) | 168 | static int tea5764_i2c_write(struct tea5764_device *radio) |
| 169 | { | 169 | { |
| 170 | struct tea5764_write_regs wr; | 170 | struct tea5764_write_regs wr; |
| 171 | struct tea5764_regs *r = &radio->regs; | 171 | struct tea5764_regs *r = &radio->regs; |
| @@ -493,8 +493,8 @@ static struct video_device tea5764_radio_template = { | |||
| 493 | }; | 493 | }; |
| 494 | 494 | ||
| 495 | /* I2C probe: check if the device exists and register with v4l if it is */ | 495 | /* I2C probe: check if the device exists and register with v4l if it is */ |
| 496 | static int __devinit tea5764_i2c_probe(struct i2c_client *client, | 496 | static int tea5764_i2c_probe(struct i2c_client *client, |
| 497 | const struct i2c_device_id *id) | 497 | const struct i2c_device_id *id) |
| 498 | { | 498 | { |
| 499 | struct tea5764_device *radio; | 499 | struct tea5764_device *radio; |
| 500 | struct tea5764_regs *r; | 500 | struct tea5764_regs *r; |
| @@ -552,7 +552,7 @@ errfr: | |||
| 552 | return ret; | 552 | return ret; |
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | static int __devexit tea5764_i2c_remove(struct i2c_client *client) | 555 | static int tea5764_i2c_remove(struct i2c_client *client) |
| 556 | { | 556 | { |
| 557 | struct tea5764_device *radio = i2c_get_clientdata(client); | 557 | struct tea5764_device *radio = i2c_get_clientdata(client); |
| 558 | 558 | ||
| @@ -578,7 +578,7 @@ static struct i2c_driver tea5764_i2c_driver = { | |||
| 578 | .owner = THIS_MODULE, | 578 | .owner = THIS_MODULE, |
| 579 | }, | 579 | }, |
| 580 | .probe = tea5764_i2c_probe, | 580 | .probe = tea5764_i2c_probe, |
| 581 | .remove = __devexit_p(tea5764_i2c_remove), | 581 | .remove = tea5764_i2c_remove, |
| 582 | .id_table = tea5764_id, | 582 | .id_table = tea5764_id, |
| 583 | }; | 583 | }; |
| 584 | 584 | ||
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index 5cf07779f4bb..b87effeb5dc6 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c | |||
| @@ -145,7 +145,7 @@ static const struct v4l2_file_operations timbradio_fops = { | |||
| 145 | .unlocked_ioctl = video_ioctl2, | 145 | .unlocked_ioctl = video_ioctl2, |
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | static int __devinit timbradio_probe(struct platform_device *pdev) | 148 | static int timbradio_probe(struct platform_device *pdev) |
| 149 | { | 149 | { |
| 150 | struct timb_radio_platform_data *pdata = pdev->dev.platform_data; | 150 | struct timb_radio_platform_data *pdata = pdev->dev.platform_data; |
| 151 | struct timbradio *tr; | 151 | struct timbradio *tr; |
| @@ -201,7 +201,7 @@ err: | |||
| 201 | return err; | 201 | return err; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static int __devexit timbradio_remove(struct platform_device *pdev) | 204 | static int timbradio_remove(struct platform_device *pdev) |
| 205 | { | 205 | { |
| 206 | struct timbradio *tr = platform_get_drvdata(pdev); | 206 | struct timbradio *tr = platform_get_drvdata(pdev); |
| 207 | 207 | ||
| @@ -219,7 +219,7 @@ static struct platform_driver timbradio_platform_driver = { | |||
| 219 | .owner = THIS_MODULE, | 219 | .owner = THIS_MODULE, |
| 220 | }, | 220 | }, |
| 221 | .probe = timbradio_probe, | 221 | .probe = timbradio_probe, |
| 222 | .remove = __devexit_p(timbradio_remove), | 222 | .remove = timbradio_remove, |
| 223 | }; | 223 | }; |
| 224 | 224 | ||
| 225 | module_platform_driver(timbradio_platform_driver); | 225 | module_platform_driver(timbradio_platform_driver); |
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index 9b0c9fa0beb8..c48be195bbad 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c | |||
| @@ -1990,7 +1990,7 @@ static int wl1273_fm_radio_remove(struct platform_device *pdev) | |||
| 1990 | return 0; | 1990 | return 0; |
| 1991 | } | 1991 | } |
| 1992 | 1992 | ||
| 1993 | static int __devinit wl1273_fm_radio_probe(struct platform_device *pdev) | 1993 | static int wl1273_fm_radio_probe(struct platform_device *pdev) |
| 1994 | { | 1994 | { |
| 1995 | struct wl1273_core **core = pdev->dev.platform_data; | 1995 | struct wl1273_core **core = pdev->dev.platform_data; |
| 1996 | struct wl1273_device *radio; | 1996 | struct wl1273_device *radio; |
| @@ -2145,7 +2145,7 @@ pdata_err: | |||
| 2145 | 2145 | ||
| 2146 | static struct platform_driver wl1273_fm_radio_driver = { | 2146 | static struct platform_driver wl1273_fm_radio_driver = { |
| 2147 | .probe = wl1273_fm_radio_probe, | 2147 | .probe = wl1273_fm_radio_probe, |
| 2148 | .remove = __devexit_p(wl1273_fm_radio_remove), | 2148 | .remove = wl1273_fm_radio_remove, |
| 2149 | .driver = { | 2149 | .driver = { |
| 2150 | .name = "wl1273_fm_radio", | 2150 | .name = "wl1273_fm_radio", |
| 2151 | .owner = THIS_MODULE, | 2151 | .owner = THIS_MODULE, |
diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c index 54db36ccb9ee..06c06cc9ff25 100644 --- a/drivers/media/radio/saa7706h.c +++ b/drivers/media/radio/saa7706h.c | |||
| @@ -373,8 +373,8 @@ static const struct v4l2_subdev_ops saa7706h_ops = { | |||
| 373 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 373 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
| 374 | */ | 374 | */ |
| 375 | 375 | ||
| 376 | static int __devinit saa7706h_probe(struct i2c_client *client, | 376 | static int saa7706h_probe(struct i2c_client *client, |
| 377 | const struct i2c_device_id *id) | 377 | const struct i2c_device_id *id) |
| 378 | { | 378 | { |
| 379 | struct saa7706h_state *state; | 379 | struct saa7706h_state *state; |
| 380 | struct v4l2_subdev *sd; | 380 | struct v4l2_subdev *sd; |
| @@ -418,7 +418,7 @@ err: | |||
| 418 | return err; | 418 | return err; |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | static int __devexit saa7706h_remove(struct i2c_client *client) | 421 | static int saa7706h_remove(struct i2c_client *client) |
| 422 | { | 422 | { |
| 423 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 423 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 424 | 424 | ||
| @@ -441,7 +441,7 @@ static struct i2c_driver saa7706h_driver = { | |||
| 441 | .name = DRIVER_NAME, | 441 | .name = DRIVER_NAME, |
| 442 | }, | 442 | }, |
| 443 | .probe = saa7706h_probe, | 443 | .probe = saa7706h_probe, |
| 444 | .remove = __devexit_p(saa7706h_remove), | 444 | .remove = saa7706h_remove, |
| 445 | .id_table = saa7706h_id, | 445 | .id_table = saa7706h_id, |
| 446 | }; | 446 | }; |
| 447 | 447 | ||
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 4ef55ec8045e..e5fc9acd0c4f 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | |||
| @@ -347,8 +347,8 @@ end: | |||
| 347 | /* | 347 | /* |
| 348 | * si470x_i2c_probe - probe for the device | 348 | * si470x_i2c_probe - probe for the device |
| 349 | */ | 349 | */ |
| 350 | static int __devinit si470x_i2c_probe(struct i2c_client *client, | 350 | static int si470x_i2c_probe(struct i2c_client *client, |
| 351 | const struct i2c_device_id *id) | 351 | const struct i2c_device_id *id) |
| 352 | { | 352 | { |
| 353 | struct si470x_device *radio; | 353 | struct si470x_device *radio; |
| 354 | int retval = 0; | 354 | int retval = 0; |
| @@ -451,7 +451,7 @@ err_initial: | |||
| 451 | /* | 451 | /* |
| 452 | * si470x_i2c_remove - remove the device | 452 | * si470x_i2c_remove - remove the device |
| 453 | */ | 453 | */ |
| 454 | static __devexit int si470x_i2c_remove(struct i2c_client *client) | 454 | static int si470x_i2c_remove(struct i2c_client *client) |
| 455 | { | 455 | { |
| 456 | struct si470x_device *radio = i2c_get_clientdata(client); | 456 | struct si470x_device *radio = i2c_get_clientdata(client); |
| 457 | 457 | ||
| @@ -514,7 +514,7 @@ static struct i2c_driver si470x_i2c_driver = { | |||
| 514 | #endif | 514 | #endif |
| 515 | }, | 515 | }, |
| 516 | .probe = si470x_i2c_probe, | 516 | .probe = si470x_i2c_probe, |
| 517 | .remove = __devexit_p(si470x_i2c_remove), | 517 | .remove = si470x_i2c_remove, |
| 518 | .id_table = si470x_i2c_id, | 518 | .id_table = si470x_i2c_id, |
| 519 | }; | 519 | }; |
| 520 | 520 | ||
diff --git a/drivers/media/radio/si4713-i2c.c b/drivers/media/radio/si4713-i2c.c index e3079c142c5f..bd61b3bd0ca3 100644 --- a/drivers/media/radio/si4713-i2c.c +++ b/drivers/media/radio/si4713-i2c.c | |||
| @@ -1769,7 +1769,7 @@ exit: | |||
| 1769 | } | 1769 | } |
| 1770 | 1770 | ||
| 1771 | /* si4713_ioctl - deal with private ioctls (only rnl for now) */ | 1771 | /* si4713_ioctl - deal with private ioctls (only rnl for now) */ |
| 1772 | long si4713_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) | 1772 | static long si4713_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) |
| 1773 | { | 1773 | { |
| 1774 | struct si4713_device *sdev = to_si4713_device(sd); | 1774 | struct si4713_device *sdev = to_si4713_device(sd); |
| 1775 | struct si4713_rnl *rnl = arg; | 1775 | struct si4713_rnl *rnl = arg; |
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index 06d47e5cce9f..b18c2dc268ba 100644 --- a/drivers/media/radio/tef6862.c +++ b/drivers/media/radio/tef6862.c | |||
| @@ -165,8 +165,8 @@ static const struct v4l2_subdev_ops tef6862_ops = { | |||
| 165 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 165 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
| 166 | */ | 166 | */ |
| 167 | 167 | ||
| 168 | static int __devinit tef6862_probe(struct i2c_client *client, | 168 | static int tef6862_probe(struct i2c_client *client, |
| 169 | const struct i2c_device_id *id) | 169 | const struct i2c_device_id *id) |
| 170 | { | 170 | { |
| 171 | struct tef6862_state *state; | 171 | struct tef6862_state *state; |
| 172 | struct v4l2_subdev *sd; | 172 | struct v4l2_subdev *sd; |
| @@ -189,7 +189,7 @@ static int __devinit tef6862_probe(struct i2c_client *client, | |||
| 189 | return 0; | 189 | return 0; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static int __devexit tef6862_remove(struct i2c_client *client) | 192 | static int tef6862_remove(struct i2c_client *client) |
| 193 | { | 193 | { |
| 194 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 194 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 195 | 195 | ||
| @@ -211,7 +211,7 @@ static struct i2c_driver tef6862_driver = { | |||
| 211 | .name = DRIVER_NAME, | 211 | .name = DRIVER_NAME, |
| 212 | }, | 212 | }, |
| 213 | .probe = tef6862_probe, | 213 | .probe = tef6862_probe, |
| 214 | .remove = __devexit_p(tef6862_remove), | 214 | .remove = tef6862_remove, |
| 215 | .id_table = tef6862_id, | 215 | .id_table = tef6862_id, |
| 216 | }; | 216 | }; |
| 217 | 217 | ||
diff --git a/drivers/media/radio/wl128x/fmdrv.h b/drivers/media/radio/wl128x/fmdrv.h index d84ad9dad323..aac0f025f767 100644 --- a/drivers/media/radio/wl128x/fmdrv.h +++ b/drivers/media/radio/wl128x/fmdrv.h | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | #define fmdbg(format, ...) \ | 60 | #define fmdbg(format, ...) \ |
| 61 | printk(KERN_DEBUG "fmdrv: " format, ## __VA_ARGS__) | 61 | printk(KERN_DEBUG "fmdrv: " format, ## __VA_ARGS__) |
| 62 | #else /* DEBUG */ | 62 | #else /* DEBUG */ |
| 63 | #define fmdbg(format, ...) | 63 | #define fmdbg(format, ...) do {} while(0) |
| 64 | #endif | 64 | #endif |
| 65 | enum { | 65 | enum { |
| 66 | FM_MODE_OFF, | 66 | FM_MODE_OFF, |
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index bf867a6b5ea0..602ef7ac8c24 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c | |||
| @@ -742,7 +742,7 @@ static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev) | |||
| 742 | if ((meta_data & FM_RDS_STATUS_ERR_MASK) != 0) | 742 | if ((meta_data & FM_RDS_STATUS_ERR_MASK) != 0) |
| 743 | break; | 743 | break; |
| 744 | 744 | ||
| 745 | if (blk_idx < FM_RDS_BLK_IDX_A || blk_idx > FM_RDS_BLK_IDX_D) { | 745 | if (blk_idx > FM_RDS_BLK_IDX_D) { |
| 746 | fmdbg("Block sequence mismatch\n"); | 746 | fmdbg("Block sequence mismatch\n"); |
| 747 | rds->last_blk_idx = -1; | 747 | rds->last_blk_idx = -1; |
| 748 | break; | 748 | break; |
diff --git a/drivers/media/radio/wl128x/fmdrv_rx.c b/drivers/media/radio/wl128x/fmdrv_rx.c index 3dd9fc097c47..ebf09a3927de 100644 --- a/drivers/media/radio/wl128x/fmdrv_rx.c +++ b/drivers/media/radio/wl128x/fmdrv_rx.c | |||
| @@ -305,7 +305,7 @@ int fm_rx_set_volume(struct fmdev *fmdev, u16 vol_to_set) | |||
| 305 | if (fmdev->curr_fmmode != FM_MODE_RX) | 305 | if (fmdev->curr_fmmode != FM_MODE_RX) |
| 306 | return -EPERM; | 306 | return -EPERM; |
| 307 | 307 | ||
| 308 | if (vol_to_set < FM_RX_VOLUME_MIN || vol_to_set > FM_RX_VOLUME_MAX) { | 308 | if (vol_to_set > FM_RX_VOLUME_MAX) { |
| 309 | fmerr("Volume is not within(%d-%d) range\n", | 309 | fmerr("Volume is not within(%d-%d) range\n", |
| 310 | FM_RX_VOLUME_MIN, FM_RX_VOLUME_MAX); | 310 | FM_RX_VOLUME_MIN, FM_RX_VOLUME_MAX); |
| 311 | return -EINVAL; | 311 | return -EINVAL; |
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 49bb356ed14c..2d6fb26a0170 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c | |||
| @@ -784,7 +784,7 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote) | |||
| 784 | 784 | ||
| 785 | rdev->priv = ati_remote; | 785 | rdev->priv = ati_remote; |
| 786 | rdev->driver_type = RC_DRIVER_SCANCODE; | 786 | rdev->driver_type = RC_DRIVER_SCANCODE; |
| 787 | rdev->allowed_protos = RC_TYPE_OTHER; | 787 | rdev->allowed_protos = RC_BIT_OTHER; |
| 788 | rdev->driver_name = "ati_remote"; | 788 | rdev->driver_name = "ati_remote"; |
| 789 | 789 | ||
| 790 | rdev->open = ati_remote_rc_open; | 790 | rdev->open = ati_remote_rc_open; |
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index d05ac15b5de4..cef04786b52f 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c | |||
| @@ -329,7 +329,7 @@ static int ene_rx_get_sample_reg(struct ene_device *dev) | |||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | /* Sense current received carrier */ | 331 | /* Sense current received carrier */ |
| 332 | void ene_rx_sense_carrier(struct ene_device *dev) | 332 | static void ene_rx_sense_carrier(struct ene_device *dev) |
| 333 | { | 333 | { |
| 334 | DEFINE_IR_RAW_EVENT(ev); | 334 | DEFINE_IR_RAW_EVENT(ev); |
| 335 | 335 | ||
| @@ -1003,7 +1003,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1003 | dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); | 1003 | dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); |
| 1004 | rdev = rc_allocate_device(); | 1004 | rdev = rc_allocate_device(); |
| 1005 | if (!dev || !rdev) | 1005 | if (!dev || !rdev) |
| 1006 | goto error1; | 1006 | goto failure; |
| 1007 | 1007 | ||
| 1008 | /* validate resources */ | 1008 | /* validate resources */ |
| 1009 | error = -ENODEV; | 1009 | error = -ENODEV; |
| @@ -1014,10 +1014,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1014 | 1014 | ||
| 1015 | if (!pnp_port_valid(pnp_dev, 0) || | 1015 | if (!pnp_port_valid(pnp_dev, 0) || |
| 1016 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) | 1016 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) |
| 1017 | goto error; | 1017 | goto failure; |
| 1018 | 1018 | ||
| 1019 | if (!pnp_irq_valid(pnp_dev, 0)) | 1019 | if (!pnp_irq_valid(pnp_dev, 0)) |
| 1020 | goto error; | 1020 | goto failure; |
| 1021 | 1021 | ||
| 1022 | spin_lock_init(&dev->hw_lock); | 1022 | spin_lock_init(&dev->hw_lock); |
| 1023 | 1023 | ||
| @@ -1033,7 +1033,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1033 | /* detect hardware version and features */ | 1033 | /* detect hardware version and features */ |
| 1034 | error = ene_hw_detect(dev); | 1034 | error = ene_hw_detect(dev); |
| 1035 | if (error) | 1035 | if (error) |
| 1036 | goto error; | 1036 | goto failure; |
| 1037 | 1037 | ||
| 1038 | if (!dev->hw_learning_and_tx_capable && txsim) { | 1038 | if (!dev->hw_learning_and_tx_capable && txsim) { |
| 1039 | dev->hw_learning_and_tx_capable = true; | 1039 | dev->hw_learning_and_tx_capable = true; |
| @@ -1046,7 +1046,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1046 | learning_mode_force = false; | 1046 | learning_mode_force = false; |
| 1047 | 1047 | ||
| 1048 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1048 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 1049 | rdev->allowed_protos = RC_TYPE_ALL; | 1049 | rdev->allowed_protos = RC_BIT_ALL; |
| 1050 | rdev->priv = dev; | 1050 | rdev->priv = dev; |
| 1051 | rdev->open = ene_open; | 1051 | rdev->open = ene_open; |
| 1052 | rdev->close = ene_close; | 1052 | rdev->close = ene_close; |
| @@ -1078,30 +1078,27 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1078 | /* claim the resources */ | 1078 | /* claim the resources */ |
| 1079 | error = -EBUSY; | 1079 | error = -EBUSY; |
| 1080 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { | 1080 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { |
| 1081 | dev->hw_io = -1; | 1081 | goto failure; |
| 1082 | dev->irq = -1; | ||
| 1083 | goto error; | ||
| 1084 | } | 1082 | } |
| 1085 | 1083 | ||
| 1086 | dev->irq = pnp_irq(pnp_dev, 0); | 1084 | dev->irq = pnp_irq(pnp_dev, 0); |
| 1087 | if (request_irq(dev->irq, ene_isr, | 1085 | if (request_irq(dev->irq, ene_isr, |
| 1088 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { | 1086 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { |
| 1089 | dev->irq = -1; | 1087 | goto failure2; |
| 1090 | goto error; | ||
| 1091 | } | 1088 | } |
| 1092 | 1089 | ||
| 1093 | error = rc_register_device(rdev); | 1090 | error = rc_register_device(rdev); |
| 1094 | if (error < 0) | 1091 | if (error < 0) |
| 1095 | goto error; | 1092 | goto failure3; |
| 1096 | 1093 | ||
| 1097 | pr_notice("driver has been successfully loaded\n"); | 1094 | pr_notice("driver has been successfully loaded\n"); |
| 1098 | return 0; | 1095 | return 0; |
| 1099 | error: | 1096 | |
| 1100 | if (dev && dev->irq >= 0) | 1097 | failure3: |
| 1101 | free_irq(dev->irq, dev); | 1098 | free_irq(dev->irq, dev); |
| 1102 | if (dev && dev->hw_io >= 0) | 1099 | failure2: |
| 1103 | release_region(dev->hw_io, ENE_IO_SIZE); | 1100 | release_region(dev->hw_io, ENE_IO_SIZE); |
| 1104 | error1: | 1101 | failure: |
| 1105 | rc_free_device(rdev); | 1102 | rc_free_device(rdev); |
| 1106 | kfree(dev); | 1103 | kfree(dev); |
| 1107 | return error; | 1104 | return error; |
| @@ -1175,7 +1172,7 @@ static struct pnp_driver ene_driver = { | |||
| 1175 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | 1172 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, |
| 1176 | 1173 | ||
| 1177 | .probe = ene_probe, | 1174 | .probe = ene_probe, |
| 1178 | .remove = __devexit_p(ene_remove), | 1175 | .remove = ene_remove, |
| 1179 | #ifdef CONFIG_PM | 1176 | #ifdef CONFIG_PM |
| 1180 | .suspend = ene_suspend, | 1177 | .suspend = ene_suspend, |
| 1181 | .resume = ene_resume, | 1178 | .resume = ene_resume, |
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 52fd7696b1ba..1df410e13688 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c | |||
| @@ -541,7 +541,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id | |||
| 541 | /* Set up the rc device */ | 541 | /* Set up the rc device */ |
| 542 | rdev->priv = fintek; | 542 | rdev->priv = fintek; |
| 543 | rdev->driver_type = RC_DRIVER_IR_RAW; | 543 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 544 | rdev->allowed_protos = RC_TYPE_ALL; | 544 | rdev->allowed_protos = RC_BIT_ALL; |
| 545 | rdev->open = fintek_open; | 545 | rdev->open = fintek_open; |
| 546 | rdev->close = fintek_close; | 546 | rdev->close = fintek_close; |
| 547 | rdev->input_name = FINTEK_DESCRIPTION; | 547 | rdev->input_name = FINTEK_DESCRIPTION; |
| @@ -590,7 +590,7 @@ failure: | |||
| 590 | return ret; | 590 | return ret; |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | static void __devexit fintek_remove(struct pnp_dev *pdev) | 593 | static void fintek_remove(struct pnp_dev *pdev) |
| 594 | { | 594 | { |
| 595 | struct fintek_dev *fintek = pnp_get_drvdata(pdev); | 595 | struct fintek_dev *fintek = pnp_get_drvdata(pdev); |
| 596 | unsigned long flags; | 596 | unsigned long flags; |
| @@ -678,18 +678,18 @@ static struct pnp_driver fintek_driver = { | |||
| 678 | .id_table = fintek_ids, | 678 | .id_table = fintek_ids, |
| 679 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | 679 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, |
| 680 | .probe = fintek_probe, | 680 | .probe = fintek_probe, |
| 681 | .remove = __devexit_p(fintek_remove), | 681 | .remove = fintek_remove, |
| 682 | .suspend = fintek_suspend, | 682 | .suspend = fintek_suspend, |
| 683 | .resume = fintek_resume, | 683 | .resume = fintek_resume, |
| 684 | .shutdown = fintek_shutdown, | 684 | .shutdown = fintek_shutdown, |
| 685 | }; | 685 | }; |
| 686 | 686 | ||
| 687 | int fintek_init(void) | 687 | static int fintek_init(void) |
| 688 | { | 688 | { |
| 689 | return pnp_register_driver(&fintek_driver); | 689 | return pnp_register_driver(&fintek_driver); |
| 690 | } | 690 | } |
| 691 | 691 | ||
| 692 | void fintek_exit(void) | 692 | static void fintek_exit(void) |
| 693 | { | 693 | { |
| 694 | pnp_unregister_driver(&fintek_driver); | 694 | pnp_unregister_driver(&fintek_driver); |
| 695 | } | 695 | } |
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 04cb272db16a..4f71a7d1f019 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c | |||
| @@ -58,7 +58,7 @@ err_get_value: | |||
| 58 | return IRQ_HANDLED; | 58 | return IRQ_HANDLED; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static int __devinit gpio_ir_recv_probe(struct platform_device *pdev) | 61 | static int gpio_ir_recv_probe(struct platform_device *pdev) |
| 62 | { | 62 | { |
| 63 | struct gpio_rc_dev *gpio_dev; | 63 | struct gpio_rc_dev *gpio_dev; |
| 64 | struct rc_dev *rcdev; | 64 | struct rc_dev *rcdev; |
| @@ -95,7 +95,7 @@ static int __devinit gpio_ir_recv_probe(struct platform_device *pdev) | |||
| 95 | if (pdata->allowed_protos) | 95 | if (pdata->allowed_protos) |
| 96 | rcdev->allowed_protos = pdata->allowed_protos; | 96 | rcdev->allowed_protos = pdata->allowed_protos; |
| 97 | else | 97 | else |
| 98 | rcdev->allowed_protos = RC_TYPE_ALL; | 98 | rcdev->allowed_protos = RC_BIT_ALL; |
| 99 | rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; | 99 | rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; |
| 100 | 100 | ||
| 101 | gpio_dev->rcdev = rcdev; | 101 | gpio_dev->rcdev = rcdev; |
| @@ -140,7 +140,7 @@ err_allocate_device: | |||
| 140 | return rc; | 140 | return rc; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static int __devexit gpio_ir_recv_remove(struct platform_device *pdev) | 143 | static int gpio_ir_recv_remove(struct platform_device *pdev) |
| 144 | { | 144 | { |
| 145 | struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev); | 145 | struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev); |
| 146 | 146 | ||
| @@ -188,7 +188,7 @@ static const struct dev_pm_ops gpio_ir_recv_pm_ops = { | |||
| 188 | 188 | ||
| 189 | static struct platform_driver gpio_ir_recv_driver = { | 189 | static struct platform_driver gpio_ir_recv_driver = { |
| 190 | .probe = gpio_ir_recv_probe, | 190 | .probe = gpio_ir_recv_probe, |
| 191 | .remove = __devexit_p(gpio_ir_recv_remove), | 191 | .remove = gpio_ir_recv_remove, |
| 192 | .driver = { | 192 | .driver = { |
| 193 | .name = GPIO_IR_DRIVER_NAME, | 193 | .name = GPIO_IR_DRIVER_NAME, |
| 194 | .owner = THIS_MODULE, | 194 | .owner = THIS_MODULE, |
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 51d7057aca04..b99b096d8a8f 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c | |||
| @@ -425,8 +425,8 @@ static void iguanair_close(struct rc_dev *rdev) | |||
| 425 | mutex_unlock(&ir->lock); | 425 | mutex_unlock(&ir->lock); |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | static int __devinit iguanair_probe(struct usb_interface *intf, | 428 | static int iguanair_probe(struct usb_interface *intf, |
| 429 | const struct usb_device_id *id) | 429 | const struct usb_device_id *id) |
| 430 | { | 430 | { |
| 431 | struct usb_device *udev = interface_to_usbdev(intf); | 431 | struct usb_device *udev = interface_to_usbdev(intf); |
| 432 | struct iguanair *ir; | 432 | struct iguanair *ir; |
| @@ -499,7 +499,7 @@ static int __devinit iguanair_probe(struct usb_interface *intf, | |||
| 499 | usb_to_input_id(ir->udev, &rc->input_id); | 499 | usb_to_input_id(ir->udev, &rc->input_id); |
| 500 | rc->dev.parent = &intf->dev; | 500 | rc->dev.parent = &intf->dev; |
| 501 | rc->driver_type = RC_DRIVER_IR_RAW; | 501 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 502 | rc->allowed_protos = RC_TYPE_ALL; | 502 | rc->allowed_protos = RC_BIT_ALL; |
| 503 | rc->priv = ir; | 503 | rc->priv = ir; |
| 504 | rc->open = iguanair_open; | 504 | rc->open = iguanair_open; |
| 505 | rc->close = iguanair_close; | 505 | rc->close = iguanair_close; |
| @@ -538,7 +538,7 @@ out: | |||
| 538 | return ret; | 538 | return ret; |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | static void __devexit iguanair_disconnect(struct usb_interface *intf) | 541 | static void iguanair_disconnect(struct usb_interface *intf) |
| 542 | { | 542 | { |
| 543 | struct iguanair *ir = usb_get_intfdata(intf); | 543 | struct iguanair *ir = usb_get_intfdata(intf); |
| 544 | 544 | ||
| @@ -604,7 +604,7 @@ static const struct usb_device_id iguanair_table[] = { | |||
| 604 | static struct usb_driver iguanair_driver = { | 604 | static struct usb_driver iguanair_driver = { |
| 605 | .name = DRIVER_NAME, | 605 | .name = DRIVER_NAME, |
| 606 | .probe = iguanair_probe, | 606 | .probe = iguanair_probe, |
| 607 | .disconnect = __devexit_p(iguanair_disconnect), | 607 | .disconnect = iguanair_disconnect, |
| 608 | .suspend = iguanair_suspend, | 608 | .suspend = iguanair_suspend, |
| 609 | .resume = iguanair_resume, | 609 | .resume = iguanair_resume, |
| 610 | .reset_resume = iguanair_resume, | 610 | .reset_resume = iguanair_resume, |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 5dd0386604f0..78d109b978dd 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
| @@ -255,7 +255,7 @@ static struct usb_device_id imon_usb_id_table[] = { | |||
| 255 | static struct usb_driver imon_driver = { | 255 | static struct usb_driver imon_driver = { |
| 256 | .name = MOD_NAME, | 256 | .name = MOD_NAME, |
| 257 | .probe = imon_probe, | 257 | .probe = imon_probe, |
| 258 | .disconnect = __devexit_p(imon_disconnect), | 258 | .disconnect = imon_disconnect, |
| 259 | .suspend = imon_suspend, | 259 | .suspend = imon_suspend, |
| 260 | .resume = imon_resume, | 260 | .resume = imon_resume, |
| 261 | .id_table = imon_usb_id_table, | 261 | .id_table = imon_usb_id_table, |
| @@ -1001,7 +1001,7 @@ static void imon_touch_display_timeout(unsigned long data) | |||
| 1001 | * it is not, so we must acquire it prior to calling send_packet, which | 1001 | * it is not, so we must acquire it prior to calling send_packet, which |
| 1002 | * requires that the lock is held. | 1002 | * requires that the lock is held. |
| 1003 | */ | 1003 | */ |
| 1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | 1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type) |
| 1005 | { | 1005 | { |
| 1006 | int retval; | 1006 | int retval; |
| 1007 | struct imon_context *ictx = rc->priv; | 1007 | struct imon_context *ictx = rc->priv; |
| @@ -1010,31 +1010,27 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
| 1010 | unsigned char ir_proto_packet[] = { | 1010 | unsigned char ir_proto_packet[] = { |
| 1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
| 1012 | 1012 | ||
| 1013 | if (rc_type && !(rc_type & rc->allowed_protos)) | 1013 | if (*rc_type && !(*rc_type & rc->allowed_protos)) |
| 1014 | dev_warn(dev, "Looks like you're trying to use an IR protocol " | 1014 | dev_warn(dev, "Looks like you're trying to use an IR protocol " |
| 1015 | "this device does not support\n"); | 1015 | "this device does not support\n"); |
| 1016 | 1016 | ||
| 1017 | switch (rc_type) { | 1017 | if (*rc_type & RC_BIT_RC6_MCE) { |
| 1018 | case RC_TYPE_RC6: | ||
| 1019 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); | 1018 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); |
| 1020 | ir_proto_packet[0] = 0x01; | 1019 | ir_proto_packet[0] = 0x01; |
| 1021 | break; | 1020 | *rc_type = RC_BIT_RC6_MCE; |
| 1022 | case RC_TYPE_UNKNOWN: | 1021 | } else if (*rc_type & RC_BIT_OTHER) { |
| 1023 | case RC_TYPE_OTHER: | ||
| 1024 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); | 1022 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); |
| 1025 | if (!pad_stabilize) | 1023 | if (!pad_stabilize) |
| 1026 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1024 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
| 1027 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1025 | /* ir_proto_packet[0] = 0x00; // already the default */ |
| 1028 | rc_type = RC_TYPE_OTHER; | 1026 | *rc_type = RC_BIT_OTHER; |
| 1029 | break; | 1027 | } else { |
| 1030 | default: | ||
| 1031 | dev_warn(dev, "Unsupported IR protocol specified, overriding " | 1028 | dev_warn(dev, "Unsupported IR protocol specified, overriding " |
| 1032 | "to iMON IR protocol\n"); | 1029 | "to iMON IR protocol\n"); |
| 1033 | if (!pad_stabilize) | 1030 | if (!pad_stabilize) |
| 1034 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1031 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
| 1035 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1032 | /* ir_proto_packet[0] = 0x00; // already the default */ |
| 1036 | rc_type = RC_TYPE_OTHER; | 1033 | *rc_type = RC_BIT_OTHER; |
| 1037 | break; | ||
| 1038 | } | 1034 | } |
| 1039 | 1035 | ||
| 1040 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); | 1036 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); |
| @@ -1048,7 +1044,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
| 1048 | if (retval) | 1044 | if (retval) |
| 1049 | goto out; | 1045 | goto out; |
| 1050 | 1046 | ||
| 1051 | ictx->rc_type = rc_type; | 1047 | ictx->rc_type = *rc_type; |
| 1052 | ictx->pad_mouse = false; | 1048 | ictx->pad_mouse = false; |
| 1053 | 1049 | ||
| 1054 | out: | 1050 | out: |
| @@ -1323,7 +1319,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | |||
| 1323 | rel_x = buf[2]; | 1319 | rel_x = buf[2]; |
| 1324 | rel_y = buf[3]; | 1320 | rel_y = buf[3]; |
| 1325 | 1321 | ||
| 1326 | if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { | 1322 | if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) { |
| 1327 | if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { | 1323 | if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { |
| 1328 | dir = stabilize((int)rel_x, (int)rel_y, | 1324 | dir = stabilize((int)rel_x, (int)rel_y, |
| 1329 | timeout, threshold); | 1325 | timeout, threshold); |
| @@ -1390,7 +1386,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | |||
| 1390 | buf[0] = 0x01; | 1386 | buf[0] = 0x01; |
| 1391 | buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; | 1387 | buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; |
| 1392 | 1388 | ||
| 1393 | if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { | 1389 | if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) { |
| 1394 | dir = stabilize((int)rel_x, (int)rel_y, | 1390 | dir = stabilize((int)rel_x, (int)rel_y, |
| 1395 | timeout, threshold); | 1391 | timeout, threshold); |
| 1396 | if (!dir) { | 1392 | if (!dir) { |
| @@ -1511,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
| 1511 | kc = imon_panel_key_lookup(scancode); | 1507 | kc = imon_panel_key_lookup(scancode); |
| 1512 | } else { | 1508 | } else { |
| 1513 | scancode = be32_to_cpu(*((u32 *)buf)); | 1509 | scancode = be32_to_cpu(*((u32 *)buf)); |
| 1514 | if (ictx->rc_type == RC_TYPE_RC6) { | 1510 | if (ictx->rc_type == RC_BIT_RC6_MCE) { |
| 1515 | ktype = IMON_KEY_IMON; | 1511 | ktype = IMON_KEY_IMON; |
| 1516 | if (buf[0] == 0x80) | 1512 | if (buf[0] == 0x80) |
| 1517 | ktype = IMON_KEY_MCE; | 1513 | ktype = IMON_KEY_MCE; |
| @@ -1744,7 +1740,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
| 1744 | { | 1740 | { |
| 1745 | u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; | 1741 | u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; |
| 1746 | u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; | 1742 | u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; |
| 1747 | u64 allowed_protos = RC_TYPE_OTHER; | 1743 | u64 allowed_protos = RC_BIT_OTHER; |
| 1748 | 1744 | ||
| 1749 | switch (ffdc_cfg_byte) { | 1745 | switch (ffdc_cfg_byte) { |
| 1750 | /* iMON Knob, no display, iMON IR + vol knob */ | 1746 | /* iMON Knob, no display, iMON IR + vol knob */ |
| @@ -1775,13 +1771,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
| 1775 | case 0x9e: | 1771 | case 0x9e: |
| 1776 | dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); | 1772 | dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); |
| 1777 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | 1773 | detected_display_type = IMON_DISPLAY_TYPE_VFD; |
| 1778 | allowed_protos = RC_TYPE_RC6; | 1774 | allowed_protos = RC_BIT_RC6_MCE; |
| 1779 | break; | 1775 | break; |
| 1780 | /* iMON LCD, MCE IR */ | 1776 | /* iMON LCD, MCE IR */ |
| 1781 | case 0x9f: | 1777 | case 0x9f: |
| 1782 | dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); | 1778 | dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); |
| 1783 | detected_display_type = IMON_DISPLAY_TYPE_LCD; | 1779 | detected_display_type = IMON_DISPLAY_TYPE_LCD; |
| 1784 | allowed_protos = RC_TYPE_RC6; | 1780 | allowed_protos = RC_BIT_RC6_MCE; |
| 1785 | break; | 1781 | break; |
| 1786 | default: | 1782 | default: |
| 1787 | dev_info(ictx->dev, "Unknown 0xffdc device, " | 1783 | dev_info(ictx->dev, "Unknown 0xffdc device, " |
| @@ -1789,7 +1785,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
| 1789 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | 1785 | detected_display_type = IMON_DISPLAY_TYPE_VFD; |
| 1790 | /* We don't know which one it is, allow user to set the | 1786 | /* We don't know which one it is, allow user to set the |
| 1791 | * RC6 one from userspace if OTHER wasn't correct. */ | 1787 | * RC6 one from userspace if OTHER wasn't correct. */ |
| 1792 | allowed_protos |= RC_TYPE_RC6; | 1788 | allowed_protos |= RC_BIT_RC6_MCE; |
| 1793 | break; | 1789 | break; |
| 1794 | } | 1790 | } |
| 1795 | 1791 | ||
| @@ -1875,7 +1871,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
| 1875 | 1871 | ||
| 1876 | rdev->priv = ictx; | 1872 | rdev->priv = ictx; |
| 1877 | rdev->driver_type = RC_DRIVER_SCANCODE; | 1873 | rdev->driver_type = RC_DRIVER_SCANCODE; |
| 1878 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ | 1874 | rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */ |
| 1879 | rdev->change_protocol = imon_ir_change_protocol; | 1875 | rdev->change_protocol = imon_ir_change_protocol; |
| 1880 | rdev->driver_name = MOD_NAME; | 1876 | rdev->driver_name = MOD_NAME; |
| 1881 | 1877 | ||
| @@ -1893,7 +1889,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
| 1893 | 1889 | ||
| 1894 | imon_set_display_type(ictx); | 1890 | imon_set_display_type(ictx); |
| 1895 | 1891 | ||
| 1896 | if (ictx->rc_type == RC_TYPE_RC6) | 1892 | if (ictx->rc_type == RC_BIT_RC6_MCE) |
| 1897 | rdev->map_name = RC_MAP_IMON_MCE; | 1893 | rdev->map_name = RC_MAP_IMON_MCE; |
| 1898 | else | 1894 | else |
| 1899 | rdev->map_name = RC_MAP_IMON_PAD; | 1895 | rdev->map_name = RC_MAP_IMON_PAD; |
| @@ -2292,8 +2288,8 @@ static void imon_init_display(struct imon_context *ictx, | |||
| 2292 | /** | 2288 | /** |
| 2293 | * Callback function for USB core API: Probe | 2289 | * Callback function for USB core API: Probe |
| 2294 | */ | 2290 | */ |
| 2295 | static int __devinit imon_probe(struct usb_interface *interface, | 2291 | static int imon_probe(struct usb_interface *interface, |
| 2296 | const struct usb_device_id *id) | 2292 | const struct usb_device_id *id) |
| 2297 | { | 2293 | { |
| 2298 | struct usb_device *usbdev = NULL; | 2294 | struct usb_device *usbdev = NULL; |
| 2299 | struct usb_host_interface *iface_desc = NULL; | 2295 | struct usb_host_interface *iface_desc = NULL; |
| @@ -2376,7 +2372,7 @@ fail: | |||
| 2376 | /** | 2372 | /** |
| 2377 | * Callback function for USB core API: disconnect | 2373 | * Callback function for USB core API: disconnect |
| 2378 | */ | 2374 | */ |
| 2379 | static void __devexit imon_disconnect(struct usb_interface *interface) | 2375 | static void imon_disconnect(struct usb_interface *interface) |
| 2380 | { | 2376 | { |
| 2381 | struct imon_context *ictx; | 2377 | struct imon_context *ictx; |
| 2382 | struct device *dev; | 2378 | struct device *dev; |
diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index 035668e27f6b..69edffb9fe9a 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c | |||
| @@ -47,7 +47,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 47 | { | 47 | { |
| 48 | struct jvc_dec *data = &dev->raw->jvc; | 48 | struct jvc_dec *data = &dev->raw->jvc; |
| 49 | 49 | ||
| 50 | if (!(dev->raw->enabled_protocols & RC_TYPE_JVC)) | 50 | if (!(dev->raw->enabled_protocols & RC_BIT_JVC)) |
| 51 | return 0; | 51 | return 0; |
| 52 | 52 | ||
| 53 | if (!is_timing_event(ev)) { | 53 | if (!is_timing_event(ev)) { |
| @@ -174,7 +174,7 @@ out: | |||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static struct ir_raw_handler jvc_handler = { | 176 | static struct ir_raw_handler jvc_handler = { |
| 177 | .protocols = RC_TYPE_JVC, | 177 | .protocols = RC_BIT_JVC, |
| 178 | .decode = ir_jvc_decode, | 178 | .decode = ir_jvc_decode, |
| 179 | }; | 179 | }; |
| 180 | 180 | ||
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 870c93052fd0..9945e5e7f61a 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c | |||
| @@ -35,7 +35,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 35 | struct lirc_codec *lirc = &dev->raw->lirc; | 35 | struct lirc_codec *lirc = &dev->raw->lirc; |
| 36 | int sample; | 36 | int sample; |
| 37 | 37 | ||
| 38 | if (!(dev->raw->enabled_protocols & RC_TYPE_LIRC)) | 38 | if (!(dev->raw->enabled_protocols & RC_BIT_LIRC)) |
| 39 | return 0; | 39 | return 0; |
| 40 | 40 | ||
| 41 | if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) | 41 | if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) |
| @@ -408,7 +408,7 @@ static int ir_lirc_unregister(struct rc_dev *dev) | |||
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | static struct ir_raw_handler lirc_handler = { | 410 | static struct ir_raw_handler lirc_handler = { |
| 411 | .protocols = RC_TYPE_LIRC, | 411 | .protocols = RC_BIT_LIRC, |
| 412 | .decode = ir_lirc_decode, | 412 | .decode = ir_lirc_decode, |
| 413 | .raw_register = ir_lirc_register, | 413 | .raw_register = ir_lirc_register, |
| 414 | .raw_unregister = ir_lirc_unregister, | 414 | .raw_unregister = ir_lirc_unregister, |
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c index 3784ebf80ec7..33fafa4cf7cb 100644 --- a/drivers/media/rc/ir-mce_kbd-decoder.c +++ b/drivers/media/rc/ir-mce_kbd-decoder.c | |||
| @@ -216,7 +216,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 216 | u32 scancode; | 216 | u32 scancode; |
| 217 | unsigned long delay; | 217 | unsigned long delay; |
| 218 | 218 | ||
| 219 | if (!(dev->raw->enabled_protocols & RC_TYPE_MCE_KBD)) | 219 | if (!(dev->raw->enabled_protocols & RC_BIT_MCE_KBD)) |
| 220 | return 0; | 220 | return 0; |
| 221 | 221 | ||
| 222 | if (!is_timing_event(ev)) { | 222 | if (!is_timing_event(ev)) { |
| @@ -422,7 +422,7 @@ static int ir_mce_kbd_unregister(struct rc_dev *dev) | |||
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static struct ir_raw_handler mce_kbd_handler = { | 424 | static struct ir_raw_handler mce_kbd_handler = { |
| 425 | .protocols = RC_TYPE_MCE_KBD, | 425 | .protocols = RC_BIT_MCE_KBD, |
| 426 | .decode = ir_mce_kbd_decode, | 426 | .decode = ir_mce_kbd_decode, |
| 427 | .raw_register = ir_mce_kbd_register, | 427 | .raw_register = ir_mce_kbd_register, |
| 428 | .raw_unregister = ir_mce_kbd_unregister, | 428 | .raw_unregister = ir_mce_kbd_unregister, |
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 2ca509e6e16b..a47ee3634969 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c | |||
| @@ -52,7 +52,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 52 | u8 address, not_address, command, not_command; | 52 | u8 address, not_address, command, not_command; |
| 53 | bool send_32bits = false; | 53 | bool send_32bits = false; |
| 54 | 54 | ||
| 55 | if (!(dev->raw->enabled_protocols & RC_TYPE_NEC)) | 55 | if (!(dev->raw->enabled_protocols & RC_BIT_NEC)) |
| 56 | return 0; | 56 | return 0; |
| 57 | 57 | ||
| 58 | if (!is_timing_event(ev)) { | 58 | if (!is_timing_event(ev)) { |
| @@ -201,7 +201,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static struct ir_raw_handler nec_handler = { | 203 | static struct ir_raw_handler nec_handler = { |
| 204 | .protocols = RC_TYPE_NEC, | 204 | .protocols = RC_BIT_NEC, |
| 205 | .decode = ir_nec_decode, | 205 | .decode = ir_nec_decode, |
| 206 | }; | 206 | }; |
| 207 | 207 | ||
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index 9ab663a507a4..5b4d1ddeac4e 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c | |||
| @@ -52,8 +52,8 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 52 | u8 toggle; | 52 | u8 toggle; |
| 53 | u32 scancode; | 53 | u32 scancode; |
| 54 | 54 | ||
| 55 | if (!(dev->raw->enabled_protocols & RC_TYPE_RC5)) | 55 | if (!(dev->raw->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X))) |
| 56 | return 0; | 56 | return 0; |
| 57 | 57 | ||
| 58 | if (!is_timing_event(ev)) { | 58 | if (!is_timing_event(ev)) { |
| 59 | if (ev.reset) | 59 | if (ev.reset) |
| @@ -128,6 +128,10 @@ again: | |||
| 128 | if (data->wanted_bits == RC5X_NBITS) { | 128 | if (data->wanted_bits == RC5X_NBITS) { |
| 129 | /* RC5X */ | 129 | /* RC5X */ |
| 130 | u8 xdata, command, system; | 130 | u8 xdata, command, system; |
| 131 | if (!(dev->raw->enabled_protocols & RC_BIT_RC5X)) { | ||
| 132 | data->state = STATE_INACTIVE; | ||
| 133 | return 0; | ||
| 134 | } | ||
| 131 | xdata = (data->bits & 0x0003F) >> 0; | 135 | xdata = (data->bits & 0x0003F) >> 0; |
| 132 | command = (data->bits & 0x00FC0) >> 6; | 136 | command = (data->bits & 0x00FC0) >> 6; |
| 133 | system = (data->bits & 0x1F000) >> 12; | 137 | system = (data->bits & 0x1F000) >> 12; |
| @@ -141,6 +145,10 @@ again: | |||
| 141 | } else { | 145 | } else { |
| 142 | /* RC5 */ | 146 | /* RC5 */ |
| 143 | u8 command, system; | 147 | u8 command, system; |
| 148 | if (!(dev->raw->enabled_protocols & RC_BIT_RC5)) { | ||
| 149 | data->state = STATE_INACTIVE; | ||
| 150 | return 0; | ||
| 151 | } | ||
| 144 | command = (data->bits & 0x0003F) >> 0; | 152 | command = (data->bits & 0x0003F) >> 0; |
| 145 | system = (data->bits & 0x007C0) >> 6; | 153 | system = (data->bits & 0x007C0) >> 6; |
| 146 | toggle = (data->bits & 0x00800) ? 1 : 0; | 154 | toggle = (data->bits & 0x00800) ? 1 : 0; |
| @@ -164,7 +172,7 @@ out: | |||
| 164 | } | 172 | } |
| 165 | 173 | ||
| 166 | static struct ir_raw_handler rc5_handler = { | 174 | static struct ir_raw_handler rc5_handler = { |
| 167 | .protocols = RC_TYPE_RC5, | 175 | .protocols = RC_BIT_RC5 | RC_BIT_RC5X, |
| 168 | .decode = ir_rc5_decode, | 176 | .decode = ir_rc5_decode, |
| 169 | }; | 177 | }; |
| 170 | 178 | ||
diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c index ec8d4a2e2c5a..fd807a8308d8 100644 --- a/drivers/media/rc/ir-rc5-sz-decoder.c +++ b/drivers/media/rc/ir-rc5-sz-decoder.c | |||
| @@ -48,8 +48,8 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 48 | u8 toggle, command, system; | 48 | u8 toggle, command, system; |
| 49 | u32 scancode; | 49 | u32 scancode; |
| 50 | 50 | ||
| 51 | if (!(dev->raw->enabled_protocols & RC_TYPE_RC5_SZ)) | 51 | if (!(dev->raw->enabled_protocols & RC_BIT_RC5_SZ)) |
| 52 | return 0; | 52 | return 0; |
| 53 | 53 | ||
| 54 | if (!is_timing_event(ev)) { | 54 | if (!is_timing_event(ev)) { |
| 55 | if (ev.reset) | 55 | if (ev.reset) |
| @@ -128,7 +128,7 @@ out: | |||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static struct ir_raw_handler rc5_sz_handler = { | 130 | static struct ir_raw_handler rc5_sz_handler = { |
| 131 | .protocols = RC_TYPE_RC5_SZ, | 131 | .protocols = RC_BIT_RC5_SZ, |
| 132 | .decode = ir_rc5_sz_decode, | 132 | .decode = ir_rc5_sz_decode, |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 4cfdd7fa4bbd..e19072ffb36c 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c | |||
| @@ -89,7 +89,9 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 89 | u32 scancode; | 89 | u32 scancode; |
| 90 | u8 toggle; | 90 | u8 toggle; |
| 91 | 91 | ||
| 92 | if (!(dev->raw->enabled_protocols & RC_TYPE_RC6)) | 92 | if (!(dev->raw->enabled_protocols & |
| 93 | (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | | ||
| 94 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE))) | ||
| 93 | return 0; | 95 | return 0; |
| 94 | 96 | ||
| 95 | if (!is_timing_event(ev)) { | 97 | if (!is_timing_event(ev)) { |
| @@ -271,7 +273,9 @@ out: | |||
| 271 | } | 273 | } |
| 272 | 274 | ||
| 273 | static struct ir_raw_handler rc6_handler = { | 275 | static struct ir_raw_handler rc6_handler = { |
| 274 | .protocols = RC_TYPE_RC6, | 276 | .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | |
| 277 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | | ||
| 278 | RC_BIT_RC6_MCE, | ||
| 275 | .decode = ir_rc6_decode, | 279 | .decode = ir_rc6_decode, |
| 276 | }; | 280 | }; |
| 277 | 281 | ||
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c index 546199e9ccc7..8ead492d03aa 100644 --- a/drivers/media/rc/ir-rx51.c +++ b/drivers/media/rc/ir-rx51.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | #include <plat/dmtimer.h> | 29 | #include <plat/dmtimer.h> |
| 30 | #include <plat/clock.h> | 30 | #include <plat/clock.h> |
| 31 | #include <plat/omap-pm.h> | ||
| 32 | 31 | ||
| 33 | #include <media/lirc.h> | 32 | #include <media/lirc.h> |
| 34 | #include <media/lirc_dev.h> | 33 | #include <media/lirc_dev.h> |
| @@ -444,7 +443,7 @@ static int lirc_rx51_resume(struct platform_device *dev) | |||
| 444 | 443 | ||
| 445 | #endif /* CONFIG_PM */ | 444 | #endif /* CONFIG_PM */ |
| 446 | 445 | ||
| 447 | static int __devinit lirc_rx51_probe(struct platform_device *dev) | 446 | static int lirc_rx51_probe(struct platform_device *dev) |
| 448 | { | 447 | { |
| 449 | lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES; | 448 | lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES; |
| 450 | lirc_rx51.pdata = dev->dev.platform_data; | 449 | lirc_rx51.pdata = dev->dev.platform_data; |
| @@ -480,18 +479,7 @@ struct platform_driver lirc_rx51_platform_driver = { | |||
| 480 | .owner = THIS_MODULE, | 479 | .owner = THIS_MODULE, |
| 481 | }, | 480 | }, |
| 482 | }; | 481 | }; |
| 483 | 482 | module_platform_driver(lirc_rx51_platform_driver); | |
| 484 | static int __init lirc_rx51_init(void) | ||
| 485 | { | ||
| 486 | return platform_driver_register(&lirc_rx51_platform_driver); | ||
| 487 | } | ||
| 488 | module_init(lirc_rx51_init); | ||
| 489 | |||
| 490 | static void __exit lirc_rx51_exit(void) | ||
| 491 | { | ||
| 492 | platform_driver_unregister(&lirc_rx51_platform_driver); | ||
| 493 | } | ||
| 494 | module_exit(lirc_rx51_exit); | ||
| 495 | 483 | ||
| 496 | MODULE_DESCRIPTION("LIRC TX driver for Nokia RX51"); | 484 | MODULE_DESCRIPTION("LIRC TX driver for Nokia RX51"); |
| 497 | MODULE_AUTHOR("Nokia Corporation"); | 485 | MODULE_AUTHOR("Nokia Corporation"); |
diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c index 7e54ec57bcf9..7e69a3b65370 100644 --- a/drivers/media/rc/ir-sanyo-decoder.c +++ b/drivers/media/rc/ir-sanyo-decoder.c | |||
| @@ -58,7 +58,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 58 | u32 scancode; | 58 | u32 scancode; |
| 59 | u8 address, command, not_command; | 59 | u8 address, command, not_command; |
| 60 | 60 | ||
| 61 | if (!(dev->raw->enabled_protocols & RC_TYPE_SANYO)) | 61 | if (!(dev->raw->enabled_protocols & RC_BIT_SANYO)) |
| 62 | return 0; | 62 | return 0; |
| 63 | 63 | ||
| 64 | if (!is_timing_event(ev)) { | 64 | if (!is_timing_event(ev)) { |
| @@ -179,7 +179,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | static struct ir_raw_handler sanyo_handler = { | 181 | static struct ir_raw_handler sanyo_handler = { |
| 182 | .protocols = RC_TYPE_SANYO, | 182 | .protocols = RC_BIT_SANYO, |
| 183 | .decode = ir_sanyo_decode, | 183 | .decode = ir_sanyo_decode, |
| 184 | }; | 184 | }; |
| 185 | 185 | ||
diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index dab98b37621a..fb914342cf4d 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c | |||
| @@ -45,7 +45,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 45 | u32 scancode; | 45 | u32 scancode; |
| 46 | u8 device, subdevice, function; | 46 | u8 device, subdevice, function; |
| 47 | 47 | ||
| 48 | if (!(dev->raw->enabled_protocols & RC_TYPE_SONY)) | 48 | if (!(dev->raw->enabled_protocols & |
| 49 | (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20))) | ||
| 49 | return 0; | 50 | return 0; |
| 50 | 51 | ||
| 51 | if (!is_timing_event(ev)) { | 52 | if (!is_timing_event(ev)) { |
| @@ -123,16 +124,28 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
| 123 | 124 | ||
| 124 | switch (data->count) { | 125 | switch (data->count) { |
| 125 | case 12: | 126 | case 12: |
| 127 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY12)) { | ||
| 128 | data->state = STATE_INACTIVE; | ||
| 129 | return 0; | ||
| 130 | } | ||
| 126 | device = bitrev8((data->bits << 3) & 0xF8); | 131 | device = bitrev8((data->bits << 3) & 0xF8); |
| 127 | subdevice = 0; | 132 | subdevice = 0; |
| 128 | function = bitrev8((data->bits >> 4) & 0xFE); | 133 | function = bitrev8((data->bits >> 4) & 0xFE); |
| 129 | break; | 134 | break; |
| 130 | case 15: | 135 | case 15: |
| 136 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY15)) { | ||
| 137 | data->state = STATE_INACTIVE; | ||
| 138 | return 0; | ||
| 139 | } | ||
| 131 | device = bitrev8((data->bits >> 0) & 0xFF); | 140 | device = bitrev8((data->bits >> 0) & 0xFF); |
| 132 | subdevice = 0; | 141 | subdevice = 0; |
| 133 | function = bitrev8((data->bits >> 7) & 0xFE); | 142 | function = bitrev8((data->bits >> 7) & 0xFE); |
| 134 | break; | 143 | break; |
| 135 | case 20: | 144 | case 20: |
| 145 | if (!(dev->raw->enabled_protocols & RC_BIT_SONY20)) { | ||
| 146 | data->state = STATE_INACTIVE; | ||
| 147 | return 0; | ||
| 148 | } | ||
| 136 | device = bitrev8((data->bits >> 5) & 0xF8); | 149 | device = bitrev8((data->bits >> 5) & 0xF8); |
| 137 | subdevice = bitrev8((data->bits >> 0) & 0xFF); | 150 | subdevice = bitrev8((data->bits >> 0) & 0xFF); |
| 138 | function = bitrev8((data->bits >> 12) & 0xFE); | 151 | function = bitrev8((data->bits >> 12) & 0xFE); |
| @@ -157,7 +170,7 @@ out: | |||
| 157 | } | 170 | } |
| 158 | 171 | ||
| 159 | static struct ir_raw_handler sony_handler = { | 172 | static struct ir_raw_handler sony_handler = { |
| 160 | .protocols = RC_TYPE_SONY, | 173 | .protocols = RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20, |
| 161 | .decode = ir_sony_decode, | 174 | .decode = ir_sony_decode, |
| 162 | }; | 175 | }; |
| 163 | 176 | ||
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 24c77a42fc36..1b8669b6d042 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c | |||
| @@ -1563,7 +1563,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id | |||
| 1563 | /* set up ir-core props */ | 1563 | /* set up ir-core props */ |
| 1564 | rdev->priv = itdev; | 1564 | rdev->priv = itdev; |
| 1565 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1565 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 1566 | rdev->allowed_protos = RC_TYPE_ALL; | 1566 | rdev->allowed_protos = RC_BIT_ALL; |
| 1567 | rdev->open = ite_open; | 1567 | rdev->open = ite_open; |
| 1568 | rdev->close = ite_close; | 1568 | rdev->close = ite_close; |
| 1569 | rdev->s_idle = ite_s_idle; | 1569 | rdev->s_idle = ite_s_idle; |
| @@ -1620,7 +1620,7 @@ failure: | |||
| 1620 | return ret; | 1620 | return ret; |
| 1621 | } | 1621 | } |
| 1622 | 1622 | ||
| 1623 | static void __devexit ite_remove(struct pnp_dev *pdev) | 1623 | static void ite_remove(struct pnp_dev *pdev) |
| 1624 | { | 1624 | { |
| 1625 | struct ite_dev *dev = pnp_get_drvdata(pdev); | 1625 | struct ite_dev *dev = pnp_get_drvdata(pdev); |
| 1626 | unsigned long flags; | 1626 | unsigned long flags; |
| @@ -1702,18 +1702,18 @@ static struct pnp_driver ite_driver = { | |||
| 1702 | .name = ITE_DRIVER_NAME, | 1702 | .name = ITE_DRIVER_NAME, |
| 1703 | .id_table = ite_ids, | 1703 | .id_table = ite_ids, |
| 1704 | .probe = ite_probe, | 1704 | .probe = ite_probe, |
| 1705 | .remove = __devexit_p(ite_remove), | 1705 | .remove = ite_remove, |
| 1706 | .suspend = ite_suspend, | 1706 | .suspend = ite_suspend, |
| 1707 | .resume = ite_resume, | 1707 | .resume = ite_resume, |
| 1708 | .shutdown = ite_shutdown, | 1708 | .shutdown = ite_shutdown, |
| 1709 | }; | 1709 | }; |
| 1710 | 1710 | ||
| 1711 | int ite_init(void) | 1711 | static int ite_init(void) |
| 1712 | { | 1712 | { |
| 1713 | return pnp_register_driver(&ite_driver); | 1713 | return pnp_register_driver(&ite_driver); |
| 1714 | } | 1714 | } |
| 1715 | 1715 | ||
| 1716 | void ite_exit(void) | 1716 | static void ite_exit(void) |
| 1717 | { | 1717 | { |
| 1718 | pnp_unregister_driver(&ite_driver); | 1718 | pnp_unregister_driver(&ite_driver); |
| 1719 | } | 1719 | } |
diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c index 124c7228ba8c..f0da960560b0 100644 --- a/drivers/media/rc/keymaps/rc-imon-mce.c +++ b/drivers/media/rc/keymaps/rc-imon-mce.c | |||
| @@ -121,7 +121,7 @@ static struct rc_map_list imon_mce_map = { | |||
| 121 | .scan = imon_mce, | 121 | .scan = imon_mce, |
| 122 | .size = ARRAY_SIZE(imon_mce), | 122 | .size = ARRAY_SIZE(imon_mce), |
| 123 | /* its RC6, but w/a hardware decoder */ | 123 | /* its RC6, but w/a hardware decoder */ |
| 124 | .rc_type = RC_TYPE_RC6, | 124 | .rc_type = RC_TYPE_RC6_MCE, |
| 125 | .name = RC_MAP_IMON_MCE, | 125 | .name = RC_MAP_IMON_MCE, |
| 126 | } | 126 | } |
| 127 | }; | 127 | }; |
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 753e43ec787b..ef4006fe4de0 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c | |||
| @@ -97,7 +97,7 @@ static struct rc_map_list rc6_mce_map = { | |||
| 97 | .map = { | 97 | .map = { |
| 98 | .scan = rc6_mce, | 98 | .scan = rc6_mce, |
| 99 | .size = ARRAY_SIZE(rc6_mce), | 99 | .size = ARRAY_SIZE(rc6_mce), |
| 100 | .rc_type = RC_TYPE_RC6, | 100 | .rc_type = RC_TYPE_RC6_MCE, |
| 101 | .name = RC_MAP_RC6_MCE, | 101 | .name = RC_MAP_RC6_MCE, |
| 102 | } | 102 | } |
| 103 | }; | 103 | }; |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 850547fe711c..9afb9331217d 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
| @@ -1205,7 +1205,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) | |||
| 1205 | rc->dev.parent = dev; | 1205 | rc->dev.parent = dev; |
| 1206 | rc->priv = ir; | 1206 | rc->priv = ir; |
| 1207 | rc->driver_type = RC_DRIVER_IR_RAW; | 1207 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 1208 | rc->allowed_protos = RC_TYPE_ALL; | 1208 | rc->allowed_protos = RC_BIT_ALL; |
| 1209 | rc->timeout = MS_TO_NS(100); | 1209 | rc->timeout = MS_TO_NS(100); |
| 1210 | if (!ir->flags.no_tx) { | 1210 | if (!ir->flags.no_tx) { |
| 1211 | rc->s_tx_mask = mceusb_set_tx_mask; | 1211 | rc->s_tx_mask = mceusb_set_tx_mask; |
| @@ -1229,8 +1229,8 @@ out: | |||
| 1229 | return NULL; | 1229 | return NULL; |
| 1230 | } | 1230 | } |
| 1231 | 1231 | ||
| 1232 | static int __devinit mceusb_dev_probe(struct usb_interface *intf, | 1232 | static int mceusb_dev_probe(struct usb_interface *intf, |
| 1233 | const struct usb_device_id *id) | 1233 | const struct usb_device_id *id) |
| 1234 | { | 1234 | { |
| 1235 | struct usb_device *dev = interface_to_usbdev(intf); | 1235 | struct usb_device *dev = interface_to_usbdev(intf); |
| 1236 | struct usb_host_interface *idesc; | 1236 | struct usb_host_interface *idesc; |
| @@ -1393,7 +1393,7 @@ mem_alloc_fail: | |||
| 1393 | } | 1393 | } |
| 1394 | 1394 | ||
| 1395 | 1395 | ||
| 1396 | static void __devexit mceusb_dev_disconnect(struct usb_interface *intf) | 1396 | static void mceusb_dev_disconnect(struct usb_interface *intf) |
| 1397 | { | 1397 | { |
| 1398 | struct usb_device *dev = interface_to_usbdev(intf); | 1398 | struct usb_device *dev = interface_to_usbdev(intf); |
| 1399 | struct mceusb_dev *ir = usb_get_intfdata(intf); | 1399 | struct mceusb_dev *ir = usb_get_intfdata(intf); |
| @@ -1432,7 +1432,7 @@ static int mceusb_dev_resume(struct usb_interface *intf) | |||
| 1432 | static struct usb_driver mceusb_dev_driver = { | 1432 | static struct usb_driver mceusb_dev_driver = { |
| 1433 | .name = DRIVER_NAME, | 1433 | .name = DRIVER_NAME, |
| 1434 | .probe = mceusb_dev_probe, | 1434 | .probe = mceusb_dev_probe, |
| 1435 | .disconnect = __devexit_p(mceusb_dev_disconnect), | 1435 | .disconnect = mceusb_dev_disconnect, |
| 1436 | .suspend = mceusb_dev_suspend, | 1436 | .suspend = mceusb_dev_suspend, |
| 1437 | .resume = mceusb_dev_resume, | 1437 | .resume = mceusb_dev_resume, |
| 1438 | .reset_resume = mceusb_dev_resume, | 1438 | .reset_resume = mceusb_dev_resume, |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 2ea913a44ae8..b8aa9abb31ff 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
| @@ -472,6 +472,7 @@ static void nvt_enable_wake(struct nvt_dev *nvt) | |||
| 472 | nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); | 472 | nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN); |
| 473 | } | 473 | } |
| 474 | 474 | ||
| 475 | #if 0 /* Currently unused */ | ||
| 475 | /* rx carrier detect only works in learning mode, must be called w/nvt_lock */ | 476 | /* rx carrier detect only works in learning mode, must be called w/nvt_lock */ |
| 476 | static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | 477 | static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) |
| 477 | { | 478 | { |
| @@ -504,7 +505,7 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | |||
| 504 | 505 | ||
| 505 | return carrier; | 506 | return carrier; |
| 506 | } | 507 | } |
| 507 | 508 | #endif | |
| 508 | /* | 509 | /* |
| 509 | * set carrier frequency | 510 | * set carrier frequency |
| 510 | * | 511 | * |
| @@ -620,7 +621,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt) | |||
| 620 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | 621 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) |
| 621 | { | 622 | { |
| 622 | DEFINE_IR_RAW_EVENT(rawir); | 623 | DEFINE_IR_RAW_EVENT(rawir); |
| 623 | u32 carrier; | ||
| 624 | u8 sample; | 624 | u8 sample; |
| 625 | int i; | 625 | int i; |
| 626 | 626 | ||
| @@ -629,9 +629,6 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
| 629 | if (debug) | 629 | if (debug) |
| 630 | nvt_dump_rx_buf(nvt); | 630 | nvt_dump_rx_buf(nvt); |
| 631 | 631 | ||
| 632 | if (nvt->carrier_detect_enabled) | ||
| 633 | carrier = nvt_rx_carrier_detect(nvt); | ||
| 634 | |||
| 635 | nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts); | 632 | nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts); |
| 636 | 633 | ||
| 637 | init_ir_raw_event(&rawir); | 634 | init_ir_raw_event(&rawir); |
| @@ -1045,7 +1042,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
| 1045 | /* Set up the rc device */ | 1042 | /* Set up the rc device */ |
| 1046 | rdev->priv = nvt; | 1043 | rdev->priv = nvt; |
| 1047 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1044 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 1048 | rdev->allowed_protos = RC_TYPE_ALL; | 1045 | rdev->allowed_protos = RC_BIT_ALL; |
| 1049 | rdev->open = nvt_open; | 1046 | rdev->open = nvt_open; |
| 1050 | rdev->close = nvt_close; | 1047 | rdev->close = nvt_close; |
| 1051 | rdev->tx_ir = nvt_tx_ir; | 1048 | rdev->tx_ir = nvt_tx_ir; |
| @@ -1116,7 +1113,7 @@ failure: | |||
| 1116 | return ret; | 1113 | return ret; |
| 1117 | } | 1114 | } |
| 1118 | 1115 | ||
| 1119 | static void __devexit nvt_remove(struct pnp_dev *pdev) | 1116 | static void nvt_remove(struct pnp_dev *pdev) |
| 1120 | { | 1117 | { |
| 1121 | struct nvt_dev *nvt = pnp_get_drvdata(pdev); | 1118 | struct nvt_dev *nvt = pnp_get_drvdata(pdev); |
| 1122 | unsigned long flags; | 1119 | unsigned long flags; |
| @@ -1214,18 +1211,18 @@ static struct pnp_driver nvt_driver = { | |||
| 1214 | .id_table = nvt_ids, | 1211 | .id_table = nvt_ids, |
| 1215 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | 1212 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, |
| 1216 | .probe = nvt_probe, | 1213 | .probe = nvt_probe, |
| 1217 | .remove = __devexit_p(nvt_remove), | 1214 | .remove = nvt_remove, |
| 1218 | .suspend = nvt_suspend, | 1215 | .suspend = nvt_suspend, |
| 1219 | .resume = nvt_resume, | 1216 | .resume = nvt_resume, |
| 1220 | .shutdown = nvt_shutdown, | 1217 | .shutdown = nvt_shutdown, |
| 1221 | }; | 1218 | }; |
| 1222 | 1219 | ||
| 1223 | int nvt_init(void) | 1220 | static int nvt_init(void) |
| 1224 | { | 1221 | { |
| 1225 | return pnp_register_driver(&nvt_driver); | 1222 | return pnp_register_driver(&nvt_driver); |
| 1226 | } | 1223 | } |
| 1227 | 1224 | ||
| 1228 | void nvt_exit(void) | 1225 | static void nvt_exit(void) |
| 1229 | { | 1226 | { |
| 1230 | pnp_unregister_driver(&nvt_driver); | 1227 | pnp_unregister_driver(&nvt_driver); |
| 1231 | } | 1228 | } |
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 0d5e0872a2ea..7c3674ff5ea2 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h | |||
| @@ -103,7 +103,6 @@ struct nvt_dev { | |||
| 103 | 103 | ||
| 104 | /* rx settings */ | 104 | /* rx settings */ |
| 105 | bool learning_enabled; | 105 | bool learning_enabled; |
| 106 | bool carrier_detect_enabled; | ||
| 107 | 106 | ||
| 108 | /* track cir wake state */ | 107 | /* track cir wake state */ |
| 109 | u8 wake_state; | 108 | u8 wake_state; |
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index f9be68132c67..53d02827a472 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c | |||
| @@ -195,7 +195,7 @@ static int __init loop_init(void) | |||
| 195 | rc->map_name = RC_MAP_EMPTY; | 195 | rc->map_name = RC_MAP_EMPTY; |
| 196 | rc->priv = &loopdev; | 196 | rc->priv = &loopdev; |
| 197 | rc->driver_type = RC_DRIVER_IR_RAW; | 197 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 198 | rc->allowed_protos = RC_TYPE_ALL; | 198 | rc->allowed_protos = RC_BIT_ALL; |
| 199 | rc->timeout = 100 * 1000 * 1000; /* 100 ms */ | 199 | rc->timeout = 100 * 1000 * 1000; /* 100 ms */ |
| 200 | rc->min_timeout = 1; | 200 | rc->min_timeout = 1; |
| 201 | rc->max_timeout = UINT_MAX; | 201 | rc->max_timeout = UINT_MAX; |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index cabc19c10515..601d1ac1c688 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
| @@ -725,25 +725,36 @@ static struct class ir_input_class = { | |||
| 725 | .devnode = ir_devnode, | 725 | .devnode = ir_devnode, |
| 726 | }; | 726 | }; |
| 727 | 727 | ||
| 728 | /* | ||
| 729 | * These are the protocol textual descriptions that are | ||
| 730 | * used by the sysfs protocols file. Note that the order | ||
| 731 | * of the entries is relevant. | ||
| 732 | */ | ||
| 728 | static struct { | 733 | static struct { |
| 729 | u64 type; | 734 | u64 type; |
| 730 | char *name; | 735 | char *name; |
| 731 | } proto_names[] = { | 736 | } proto_names[] = { |
| 732 | { RC_TYPE_UNKNOWN, "unknown" }, | 737 | { RC_BIT_NONE, "none" }, |
| 733 | { RC_TYPE_RC5, "rc-5" }, | 738 | { RC_BIT_OTHER, "other" }, |
| 734 | { RC_TYPE_NEC, "nec" }, | 739 | { RC_BIT_UNKNOWN, "unknown" }, |
| 735 | { RC_TYPE_RC6, "rc-6" }, | 740 | { RC_BIT_RC5 | |
| 736 | { RC_TYPE_JVC, "jvc" }, | 741 | RC_BIT_RC5X, "rc-5" }, |
| 737 | { RC_TYPE_SONY, "sony" }, | 742 | { RC_BIT_NEC, "nec" }, |
| 738 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, | 743 | { RC_BIT_RC6_0 | |
| 739 | { RC_TYPE_SANYO, "sanyo" }, | 744 | RC_BIT_RC6_6A_20 | |
| 740 | { RC_TYPE_MCE_KBD, "mce_kbd" }, | 745 | RC_BIT_RC6_6A_24 | |
| 741 | { RC_TYPE_LIRC, "lirc" }, | 746 | RC_BIT_RC6_6A_32 | |
| 742 | { RC_TYPE_OTHER, "other" }, | 747 | RC_BIT_RC6_MCE, "rc-6" }, |
| 748 | { RC_BIT_JVC, "jvc" }, | ||
| 749 | { RC_BIT_SONY12 | | ||
| 750 | RC_BIT_SONY15 | | ||
| 751 | RC_BIT_SONY20, "sony" }, | ||
| 752 | { RC_BIT_RC5_SZ, "rc-5-sz" }, | ||
| 753 | { RC_BIT_SANYO, "sanyo" }, | ||
| 754 | { RC_BIT_MCE_KBD, "mce_kbd" }, | ||
| 755 | { RC_BIT_LIRC, "lirc" }, | ||
| 743 | }; | 756 | }; |
| 744 | 757 | ||
| 745 | #define PROTO_NONE "none" | ||
| 746 | |||
| 747 | /** | 758 | /** |
| 748 | * show_protocols() - shows the current IR protocol(s) | 759 | * show_protocols() - shows the current IR protocol(s) |
| 749 | * @device: the device descriptor | 760 | * @device: the device descriptor |
| @@ -790,6 +801,9 @@ static ssize_t show_protocols(struct device *device, | |||
| 790 | tmp += sprintf(tmp, "[%s] ", proto_names[i].name); | 801 | tmp += sprintf(tmp, "[%s] ", proto_names[i].name); |
| 791 | else if (allowed & proto_names[i].type) | 802 | else if (allowed & proto_names[i].type) |
| 792 | tmp += sprintf(tmp, "%s ", proto_names[i].name); | 803 | tmp += sprintf(tmp, "%s ", proto_names[i].name); |
| 804 | |||
| 805 | if (allowed & proto_names[i].type) | ||
| 806 | allowed &= ~proto_names[i].type; | ||
| 793 | } | 807 | } |
| 794 | 808 | ||
| 795 | if (tmp != buf) | 809 | if (tmp != buf) |
| @@ -867,26 +881,20 @@ static ssize_t store_protocols(struct device *device, | |||
| 867 | disable = false; | 881 | disable = false; |
| 868 | } | 882 | } |
| 869 | 883 | ||
| 870 | if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) { | 884 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { |
| 871 | tmp += sizeof(PROTO_NONE); | 885 | if (!strcasecmp(tmp, proto_names[i].name)) { |
| 872 | mask = 0; | 886 | mask = proto_names[i].type; |
| 873 | count++; | 887 | break; |
| 874 | } else { | ||
| 875 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { | ||
| 876 | if (!strcasecmp(tmp, proto_names[i].name)) { | ||
| 877 | tmp += strlen(proto_names[i].name); | ||
| 878 | mask = proto_names[i].type; | ||
| 879 | break; | ||
| 880 | } | ||
| 881 | } | ||
| 882 | if (i == ARRAY_SIZE(proto_names)) { | ||
| 883 | IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); | ||
| 884 | ret = -EINVAL; | ||
| 885 | goto out; | ||
| 886 | } | 888 | } |
| 887 | count++; | ||
| 888 | } | 889 | } |
| 889 | 890 | ||
| 891 | if (i == ARRAY_SIZE(proto_names)) { | ||
| 892 | IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); | ||
| 893 | return -EINVAL; | ||
| 894 | } | ||
| 895 | |||
| 896 | count++; | ||
| 897 | |||
| 890 | if (enable) | 898 | if (enable) |
| 891 | type |= mask; | 899 | type |= mask; |
| 892 | else if (disable) | 900 | else if (disable) |
| @@ -902,7 +910,7 @@ static ssize_t store_protocols(struct device *device, | |||
| 902 | } | 910 | } |
| 903 | 911 | ||
| 904 | if (dev->change_protocol) { | 912 | if (dev->change_protocol) { |
| 905 | rc = dev->change_protocol(dev, type); | 913 | rc = dev->change_protocol(dev, &type); |
| 906 | if (rc < 0) { | 914 | if (rc < 0) { |
| 907 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", | 915 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", |
| 908 | (long long)type); | 916 | (long long)type); |
| @@ -1117,7 +1125,8 @@ int rc_register_device(struct rc_dev *dev) | |||
| 1117 | } | 1125 | } |
| 1118 | 1126 | ||
| 1119 | if (dev->change_protocol) { | 1127 | if (dev->change_protocol) { |
| 1120 | rc = dev->change_protocol(dev, rc_map->rc_type); | 1128 | u64 rc_type = (1 << rc_map->rc_type); |
| 1129 | rc = dev->change_protocol(dev, &rc_type); | ||
| 1121 | if (rc < 0) | 1130 | if (rc < 0) |
| 1122 | goto out_raw; | 1131 | goto out_raw; |
| 1123 | } | 1132 | } |
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 9f5a17bb5ef5..1800326f93e6 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c | |||
| @@ -1082,7 +1082,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) | |||
| 1082 | rc->dev.parent = dev; | 1082 | rc->dev.parent = dev; |
| 1083 | rc->priv = rr3; | 1083 | rc->priv = rr3; |
| 1084 | rc->driver_type = RC_DRIVER_IR_RAW; | 1084 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 1085 | rc->allowed_protos = RC_TYPE_ALL; | 1085 | rc->allowed_protos = RC_BIT_ALL; |
| 1086 | rc->timeout = US_TO_NS(2750); | 1086 | rc->timeout = US_TO_NS(2750); |
| 1087 | rc->tx_ir = redrat3_transmit_ir; | 1087 | rc->tx_ir = redrat3_transmit_ir; |
| 1088 | rc->s_tx_carrier = redrat3_set_tx_carrier; | 1088 | rc->s_tx_carrier = redrat3_set_tx_carrier; |
| @@ -1102,8 +1102,8 @@ out: | |||
| 1102 | return NULL; | 1102 | return NULL; |
| 1103 | } | 1103 | } |
| 1104 | 1104 | ||
| 1105 | static int __devinit redrat3_dev_probe(struct usb_interface *intf, | 1105 | static int redrat3_dev_probe(struct usb_interface *intf, |
| 1106 | const struct usb_device_id *id) | 1106 | const struct usb_device_id *id) |
| 1107 | { | 1107 | { |
| 1108 | struct usb_device *udev = interface_to_usbdev(intf); | 1108 | struct usb_device *udev = interface_to_usbdev(intf); |
| 1109 | struct device *dev = &intf->dev; | 1109 | struct device *dev = &intf->dev; |
| @@ -1241,7 +1241,7 @@ no_endpoints: | |||
| 1241 | return retval; | 1241 | return retval; |
| 1242 | } | 1242 | } |
| 1243 | 1243 | ||
| 1244 | static void __devexit redrat3_dev_disconnect(struct usb_interface *intf) | 1244 | static void redrat3_dev_disconnect(struct usb_interface *intf) |
| 1245 | { | 1245 | { |
| 1246 | struct usb_device *udev = interface_to_usbdev(intf); | 1246 | struct usb_device *udev = interface_to_usbdev(intf); |
| 1247 | struct redrat3_dev *rr3 = usb_get_intfdata(intf); | 1247 | struct redrat3_dev *rr3 = usb_get_intfdata(intf); |
| @@ -1281,7 +1281,7 @@ static int redrat3_dev_resume(struct usb_interface *intf) | |||
| 1281 | static struct usb_driver redrat3_dev_driver = { | 1281 | static struct usb_driver redrat3_dev_driver = { |
| 1282 | .name = DRIVER_NAME, | 1282 | .name = DRIVER_NAME, |
| 1283 | .probe = redrat3_dev_probe, | 1283 | .probe = redrat3_dev_probe, |
| 1284 | .disconnect = __devexit_p(redrat3_dev_disconnect), | 1284 | .disconnect = redrat3_dev_disconnect, |
| 1285 | .suspend = redrat3_dev_suspend, | 1285 | .suspend = redrat3_dev_suspend, |
| 1286 | .resume = redrat3_dev_resume, | 1286 | .resume = redrat3_dev_resume, |
| 1287 | .reset_resume = redrat3_dev_resume, | 1287 | .reset_resume = redrat3_dev_resume, |
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index d6f4bfe09391..d7b11e6a9982 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c | |||
| @@ -322,7 +322,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) | |||
| 322 | rdev->dev.parent = dev; | 322 | rdev->dev.parent = dev; |
| 323 | rdev->priv = sz; | 323 | rdev->priv = sz; |
| 324 | rdev->driver_type = RC_DRIVER_IR_RAW; | 324 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 325 | rdev->allowed_protos = RC_TYPE_ALL; | 325 | rdev->allowed_protos = RC_BIT_ALL; |
| 326 | rdev->driver_name = DRIVER_NAME; | 326 | rdev->driver_name = DRIVER_NAME; |
| 327 | rdev->map_name = RC_MAP_STREAMZAP; | 327 | rdev->map_name = RC_MAP_STREAMZAP; |
| 328 | 328 | ||
| @@ -346,8 +346,8 @@ out: | |||
| 346 | * On any failure the return value is the ERROR | 346 | * On any failure the return value is the ERROR |
| 347 | * On success return 0 | 347 | * On success return 0 |
| 348 | */ | 348 | */ |
| 349 | static int __devinit streamzap_probe(struct usb_interface *intf, | 349 | static int streamzap_probe(struct usb_interface *intf, |
| 350 | const struct usb_device_id *id) | 350 | const struct usb_device_id *id) |
| 351 | { | 351 | { |
| 352 | struct usb_device *usbdev = interface_to_usbdev(intf); | 352 | struct usb_device *usbdev = interface_to_usbdev(intf); |
| 353 | struct usb_host_interface *iface_host; | 353 | struct usb_host_interface *iface_host; |
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index fef05235234a..78be8a914225 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c | |||
| @@ -194,8 +194,8 @@ static void ttusbir_urb_complete(struct urb *urb) | |||
| 194 | dev_warn(tt->dev, "failed to resubmit urb: %d\n", rc); | 194 | dev_warn(tt->dev, "failed to resubmit urb: %d\n", rc); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | static int __devinit ttusbir_probe(struct usb_interface *intf, | 197 | static int ttusbir_probe(struct usb_interface *intf, |
| 198 | const struct usb_device_id *id) | 198 | const struct usb_device_id *id) |
| 199 | { | 199 | { |
| 200 | struct ttusbir *tt; | 200 | struct ttusbir *tt; |
| 201 | struct usb_interface_descriptor *idesc; | 201 | struct usb_interface_descriptor *idesc; |
| @@ -316,7 +316,7 @@ static int __devinit ttusbir_probe(struct usb_interface *intf, | |||
| 316 | usb_to_input_id(tt->udev, &rc->input_id); | 316 | usb_to_input_id(tt->udev, &rc->input_id); |
| 317 | rc->dev.parent = &intf->dev; | 317 | rc->dev.parent = &intf->dev; |
| 318 | rc->driver_type = RC_DRIVER_IR_RAW; | 318 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 319 | rc->allowed_protos = RC_TYPE_ALL; | 319 | rc->allowed_protos = RC_BIT_ALL; |
| 320 | rc->priv = tt; | 320 | rc->priv = tt; |
| 321 | rc->driver_name = DRIVER_NAME; | 321 | rc->driver_name = DRIVER_NAME; |
| 322 | rc->map_name = RC_MAP_TT_1500; | 322 | rc->map_name = RC_MAP_TT_1500; |
| @@ -367,7 +367,7 @@ out: | |||
| 367 | return ret; | 367 | return ret; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | static void __devexit ttusbir_disconnect(struct usb_interface *intf) | 370 | static void ttusbir_disconnect(struct usb_interface *intf) |
| 371 | { | 371 | { |
| 372 | struct ttusbir *tt = usb_get_intfdata(intf); | 372 | struct ttusbir *tt = usb_get_intfdata(intf); |
| 373 | struct usb_device *udev = tt->udev; | 373 | struct usb_device *udev = tt->udev; |
| @@ -435,7 +435,7 @@ static struct usb_driver ttusbir_driver = { | |||
| 435 | .suspend = ttusbir_suspend, | 435 | .suspend = ttusbir_suspend, |
| 436 | .resume = ttusbir_resume, | 436 | .resume = ttusbir_resume, |
| 437 | .reset_resume = ttusbir_resume, | 437 | .reset_resume = ttusbir_resume, |
| 438 | .disconnect = __devexit_p(ttusbir_disconnect) | 438 | .disconnect = ttusbir_disconnect, |
| 439 | }; | 439 | }; |
| 440 | 440 | ||
| 441 | module_usb_driver(ttusbir_driver); | 441 | module_usb_driver(ttusbir_driver); |
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 7c9b5f33113b..930c61499037 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | * with minor modifications. | 7 | * with minor modifications. |
| 8 | * | 8 | * |
| 9 | * Original Author: David Härdeman <david@hardeman.nu> | 9 | * Original Author: David Härdeman <david@hardeman.nu> |
| 10 | * Copyright (C) 2012 Sean Young <sean@mess.org> | ||
| 10 | * Copyright (C) 2009 - 2011 David Härdeman <david@hardeman.nu> | 11 | * Copyright (C) 2009 - 2011 David Härdeman <david@hardeman.nu> |
| 11 | * | 12 | * |
| 12 | * Dedicated to my daughter Matilda, without whose loving attention this | 13 | * Dedicated to my daughter Matilda, without whose loving attention this |
| @@ -22,9 +23,7 @@ | |||
| 22 | * o IR Receive | 23 | * o IR Receive |
| 23 | * o IR Transmit | 24 | * o IR Transmit |
| 24 | * o Wake-On-CIR functionality | 25 | * o Wake-On-CIR functionality |
| 25 | * | 26 | * o Carrier detection |
| 26 | * To do: | ||
| 27 | * o Learning | ||
| 28 | * | 27 | * |
| 29 | * This program is free software; you can redistribute it and/or modify | 28 | * This program is free software; you can redistribute it and/or modify |
| 30 | * it under the terms of the GNU General Public License as published by | 29 | * it under the terms of the GNU General Public License as published by |
| @@ -149,6 +148,12 @@ | |||
| 149 | #define WBCIR_REGSEL_MASK 0x20 | 148 | #define WBCIR_REGSEL_MASK 0x20 |
| 150 | /* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */ | 149 | /* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */ |
| 151 | #define WBCIR_REG_ADDR0 0x00 | 150 | #define WBCIR_REG_ADDR0 0x00 |
| 151 | /* Enable carrier counter */ | ||
| 152 | #define WBCIR_CNTR_EN 0x01 | ||
| 153 | /* Reset carrier counter */ | ||
| 154 | #define WBCIR_CNTR_R 0x02 | ||
| 155 | /* Invert TX */ | ||
| 156 | #define WBCIR_IRTX_INV 0x04 | ||
| 152 | 157 | ||
| 153 | /* Valid banks for the SP3 UART */ | 158 | /* Valid banks for the SP3 UART */ |
| 154 | enum wbcir_bank { | 159 | enum wbcir_bank { |
| @@ -184,7 +189,7 @@ enum wbcir_txstate { | |||
| 184 | }; | 189 | }; |
| 185 | 190 | ||
| 186 | /* Misc */ | 191 | /* Misc */ |
| 187 | #define WBCIR_NAME "winbond-cir" | 192 | #define WBCIR_NAME "Winbond CIR" |
| 188 | #define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */ | 193 | #define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */ |
| 189 | #define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */ | 194 | #define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */ |
| 190 | #define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */ | 195 | #define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */ |
| @@ -207,7 +212,8 @@ struct wbcir_data { | |||
| 207 | /* RX state */ | 212 | /* RX state */ |
| 208 | enum wbcir_rxstate rxstate; | 213 | enum wbcir_rxstate rxstate; |
| 209 | struct led_trigger *rxtrigger; | 214 | struct led_trigger *rxtrigger; |
| 210 | struct ir_raw_event rxev; | 215 | int carrier_report_enabled; |
| 216 | u32 pulse_duration; | ||
| 211 | 217 | ||
| 212 | /* TX state */ | 218 | /* TX state */ |
| 213 | enum wbcir_txstate txstate; | 219 | enum wbcir_txstate txstate; |
| @@ -330,6 +336,30 @@ wbcir_to_rc6cells(u8 val) | |||
| 330 | *****************************************************************************/ | 336 | *****************************************************************************/ |
| 331 | 337 | ||
| 332 | static void | 338 | static void |
| 339 | wbcir_carrier_report(struct wbcir_data *data) | ||
| 340 | { | ||
| 341 | unsigned counter = inb(data->ebase + WBCIR_REG_ECEIR_CNT_LO) | | ||
| 342 | inb(data->ebase + WBCIR_REG_ECEIR_CNT_HI) << 8; | ||
| 343 | |||
| 344 | if (counter > 0 && counter < 0xffff) { | ||
| 345 | DEFINE_IR_RAW_EVENT(ev); | ||
| 346 | |||
| 347 | ev.carrier_report = 1; | ||
| 348 | ev.carrier = DIV_ROUND_CLOSEST(counter * 1000000u, | ||
| 349 | data->pulse_duration); | ||
| 350 | |||
| 351 | ir_raw_event_store(data->dev, &ev); | ||
| 352 | } | ||
| 353 | |||
| 354 | /* reset and restart the counter */ | ||
| 355 | data->pulse_duration = 0; | ||
| 356 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, | ||
| 357 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
| 358 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_EN, | ||
| 359 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
| 360 | } | ||
| 361 | |||
| 362 | static void | ||
| 333 | wbcir_idle_rx(struct rc_dev *dev, bool idle) | 363 | wbcir_idle_rx(struct rc_dev *dev, bool idle) |
| 334 | { | 364 | { |
| 335 | struct wbcir_data *data = dev->priv; | 365 | struct wbcir_data *data = dev->priv; |
| @@ -339,9 +369,16 @@ wbcir_idle_rx(struct rc_dev *dev, bool idle) | |||
| 339 | led_trigger_event(data->rxtrigger, LED_FULL); | 369 | led_trigger_event(data->rxtrigger, LED_FULL); |
| 340 | } | 370 | } |
| 341 | 371 | ||
| 342 | if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) | 372 | if (idle && data->rxstate != WBCIR_RXSTATE_INACTIVE) { |
| 373 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | ||
| 374 | led_trigger_event(data->rxtrigger, LED_OFF); | ||
| 375 | |||
| 376 | if (data->carrier_report_enabled) | ||
| 377 | wbcir_carrier_report(data); | ||
| 378 | |||
| 343 | /* Tell hardware to go idle by setting RXINACTIVE */ | 379 | /* Tell hardware to go idle by setting RXINACTIVE */ |
| 344 | outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR); | 380 | outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR); |
| 381 | } | ||
| 345 | } | 382 | } |
| 346 | 383 | ||
| 347 | static void | 384 | static void |
| @@ -349,21 +386,22 @@ wbcir_irq_rx(struct wbcir_data *data, struct pnp_dev *device) | |||
| 349 | { | 386 | { |
| 350 | u8 irdata; | 387 | u8 irdata; |
| 351 | DEFINE_IR_RAW_EVENT(rawir); | 388 | DEFINE_IR_RAW_EVENT(rawir); |
| 389 | unsigned duration; | ||
| 352 | 390 | ||
| 353 | /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ | 391 | /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */ |
| 354 | while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { | 392 | while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL) { |
| 355 | irdata = inb(data->sbase + WBCIR_REG_SP3_RXDATA); | 393 | irdata = inb(data->sbase + WBCIR_REG_SP3_RXDATA); |
| 356 | if (data->rxstate == WBCIR_RXSTATE_ERROR) | 394 | if (data->rxstate == WBCIR_RXSTATE_ERROR) |
| 357 | continue; | 395 | continue; |
| 396 | |||
| 397 | duration = ((irdata & 0x7F) + 1) * 2; | ||
| 358 | rawir.pulse = irdata & 0x80 ? false : true; | 398 | rawir.pulse = irdata & 0x80 ? false : true; |
| 359 | rawir.duration = US_TO_NS(((irdata & 0x7F) + 1) * 10); | 399 | rawir.duration = US_TO_NS(duration); |
| 360 | ir_raw_event_store_with_filter(data->dev, &rawir); | ||
| 361 | } | ||
| 362 | 400 | ||
| 363 | /* Check if we should go idle */ | 401 | if (rawir.pulse) |
| 364 | if (data->dev->idle) { | 402 | data->pulse_duration += duration; |
| 365 | led_trigger_event(data->rxtrigger, LED_OFF); | 403 | |
| 366 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | 404 | ir_raw_event_store_with_filter(data->dev, &rawir); |
| 367 | } | 405 | } |
| 368 | 406 | ||
| 369 | ir_raw_event_handle(data->dev); | 407 | ir_raw_event_handle(data->dev); |
| @@ -492,6 +530,33 @@ wbcir_irq_handler(int irqno, void *cookie) | |||
| 492 | *****************************************************************************/ | 530 | *****************************************************************************/ |
| 493 | 531 | ||
| 494 | static int | 532 | static int |
| 533 | wbcir_set_carrier_report(struct rc_dev *dev, int enable) | ||
| 534 | { | ||
| 535 | struct wbcir_data *data = dev->priv; | ||
| 536 | unsigned long flags; | ||
| 537 | |||
| 538 | spin_lock_irqsave(&data->spinlock, flags); | ||
| 539 | |||
| 540 | if (data->carrier_report_enabled == enable) { | ||
| 541 | spin_unlock_irqrestore(&data->spinlock, flags); | ||
| 542 | return 0; | ||
| 543 | } | ||
| 544 | |||
| 545 | data->pulse_duration = 0; | ||
| 546 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, WBCIR_CNTR_R, | ||
| 547 | WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
| 548 | |||
| 549 | if (enable && data->dev->idle) | ||
| 550 | wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, | ||
| 551 | WBCIR_CNTR_EN, WBCIR_CNTR_EN | WBCIR_CNTR_R); | ||
| 552 | |||
| 553 | data->carrier_report_enabled = enable; | ||
| 554 | spin_unlock_irqrestore(&data->spinlock, flags); | ||
| 555 | |||
| 556 | return 0; | ||
| 557 | } | ||
| 558 | |||
| 559 | static int | ||
| 495 | wbcir_txcarrier(struct rc_dev *dev, u32 carrier) | 560 | wbcir_txcarrier(struct rc_dev *dev, u32 carrier) |
| 496 | { | 561 | { |
| 497 | struct wbcir_data *data = dev->priv; | 562 | struct wbcir_data *data = dev->priv; |
| @@ -837,7 +902,7 @@ wbcir_init_hw(struct wbcir_data *data) | |||
| 837 | 902 | ||
| 838 | /* Set IRTX_INV */ | 903 | /* Set IRTX_INV */ |
| 839 | if (invert) | 904 | if (invert) |
| 840 | outb(0x04, data->ebase + WBCIR_REG_ECEIR_CCTL); | 905 | outb(WBCIR_IRTX_INV, data->ebase + WBCIR_REG_ECEIR_CCTL); |
| 841 | else | 906 | else |
| 842 | outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL); | 907 | outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL); |
| 843 | 908 | ||
| @@ -866,8 +931,8 @@ wbcir_init_hw(struct wbcir_data *data) | |||
| 866 | /* prescaler 1.0, tx/rx fifo lvl 16 */ | 931 | /* prescaler 1.0, tx/rx fifo lvl 16 */ |
| 867 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); | 932 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); |
| 868 | 933 | ||
| 869 | /* Set baud divisor to sample every 10 us */ | 934 | /* Set baud divisor to sample every 2 ns */ |
| 870 | outb(0x0F, data->sbase + WBCIR_REG_SP3_BGDL); | 935 | outb(0x03, data->sbase + WBCIR_REG_SP3_BGDL); |
| 871 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); | 936 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); |
| 872 | 937 | ||
| 873 | /* Set CEIR mode */ | 938 | /* Set CEIR mode */ |
| @@ -876,9 +941,12 @@ wbcir_init_hw(struct wbcir_data *data) | |||
| 876 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ | 941 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ |
| 877 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ | 942 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ |
| 878 | 943 | ||
| 879 | /* Disable RX demod, enable run-length enc/dec, set freq span */ | 944 | /* |
| 945 | * Disable RX demod, enable run-length enc/dec, set freq span and | ||
| 946 | * enable over-sampling | ||
| 947 | */ | ||
| 880 | wbcir_select_bank(data, WBCIR_BANK_7); | 948 | wbcir_select_bank(data, WBCIR_BANK_7); |
| 881 | outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG); | 949 | outb(0xd0, data->sbase + WBCIR_REG_SP3_RCCFG); |
| 882 | 950 | ||
| 883 | /* Disable timer */ | 951 | /* Disable timer */ |
| 884 | wbcir_select_bank(data, WBCIR_BANK_4); | 952 | wbcir_select_bank(data, WBCIR_BANK_4); |
| @@ -915,9 +983,8 @@ wbcir_init_hw(struct wbcir_data *data) | |||
| 915 | 983 | ||
| 916 | /* Clear RX state */ | 984 | /* Clear RX state */ |
| 917 | data->rxstate = WBCIR_RXSTATE_INACTIVE; | 985 | data->rxstate = WBCIR_RXSTATE_INACTIVE; |
| 918 | data->rxev.duration = 0; | ||
| 919 | ir_raw_event_reset(data->dev); | 986 | ir_raw_event_reset(data->dev); |
| 920 | ir_raw_event_handle(data->dev); | 987 | ir_raw_event_set_idle(data->dev, true); |
| 921 | 988 | ||
| 922 | /* Clear TX state */ | 989 | /* Clear TX state */ |
| 923 | if (data->txstate == WBCIR_TXSTATE_ACTIVE) { | 990 | if (data->txstate == WBCIR_TXSTATE_ACTIVE) { |
| @@ -941,7 +1008,7 @@ wbcir_resume(struct pnp_dev *device) | |||
| 941 | return 0; | 1008 | return 0; |
| 942 | } | 1009 | } |
| 943 | 1010 | ||
| 944 | static int __devinit | 1011 | static int |
| 945 | wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | 1012 | wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) |
| 946 | { | 1013 | { |
| 947 | struct device *dev = &device->dev; | 1014 | struct device *dev = &device->dev; |
| @@ -1007,7 +1074,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1007 | } | 1074 | } |
| 1008 | 1075 | ||
| 1009 | data->dev->driver_type = RC_DRIVER_IR_RAW; | 1076 | data->dev->driver_type = RC_DRIVER_IR_RAW; |
| 1010 | data->dev->driver_name = WBCIR_NAME; | 1077 | data->dev->driver_name = DRVNAME; |
| 1011 | data->dev->input_name = WBCIR_NAME; | 1078 | data->dev->input_name = WBCIR_NAME; |
| 1012 | data->dev->input_phys = "wbcir/cir0"; | 1079 | data->dev->input_phys = "wbcir/cir0"; |
| 1013 | data->dev->input_id.bustype = BUS_HOST; | 1080 | data->dev->input_id.bustype = BUS_HOST; |
| @@ -1016,13 +1083,15 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1016 | data->dev->input_id.version = WBCIR_ID_CHIP; | 1083 | data->dev->input_id.version = WBCIR_ID_CHIP; |
| 1017 | data->dev->map_name = RC_MAP_RC6_MCE; | 1084 | data->dev->map_name = RC_MAP_RC6_MCE; |
| 1018 | data->dev->s_idle = wbcir_idle_rx; | 1085 | data->dev->s_idle = wbcir_idle_rx; |
| 1086 | data->dev->s_carrier_report = wbcir_set_carrier_report; | ||
| 1019 | data->dev->s_tx_mask = wbcir_txmask; | 1087 | data->dev->s_tx_mask = wbcir_txmask; |
| 1020 | data->dev->s_tx_carrier = wbcir_txcarrier; | 1088 | data->dev->s_tx_carrier = wbcir_txcarrier; |
| 1021 | data->dev->tx_ir = wbcir_tx; | 1089 | data->dev->tx_ir = wbcir_tx; |
| 1022 | data->dev->priv = data; | 1090 | data->dev->priv = data; |
| 1023 | data->dev->dev.parent = &device->dev; | 1091 | data->dev->dev.parent = &device->dev; |
| 1024 | data->dev->timeout = MS_TO_NS(100); | 1092 | data->dev->timeout = MS_TO_NS(100); |
| 1025 | data->dev->allowed_protos = RC_TYPE_ALL; | 1093 | data->dev->rx_resolution = US_TO_NS(2); |
| 1094 | data->dev->allowed_protos = RC_BIT_ALL; | ||
| 1026 | 1095 | ||
| 1027 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | 1096 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { |
| 1028 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | 1097 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", |
| @@ -1086,7 +1155,7 @@ exit: | |||
| 1086 | return err; | 1155 | return err; |
| 1087 | } | 1156 | } |
| 1088 | 1157 | ||
| 1089 | static void __devexit | 1158 | static void |
| 1090 | wbcir_remove(struct pnp_dev *device) | 1159 | wbcir_remove(struct pnp_dev *device) |
| 1091 | { | 1160 | { |
| 1092 | struct wbcir_data *data = pnp_get_drvdata(device); | 1161 | struct wbcir_data *data = pnp_get_drvdata(device); |
| @@ -1132,7 +1201,7 @@ static struct pnp_driver wbcir_driver = { | |||
| 1132 | .name = WBCIR_NAME, | 1201 | .name = WBCIR_NAME, |
| 1133 | .id_table = wbcir_ids, | 1202 | .id_table = wbcir_ids, |
| 1134 | .probe = wbcir_probe, | 1203 | .probe = wbcir_probe, |
| 1135 | .remove = __devexit_p(wbcir_remove), | 1204 | .remove = wbcir_remove, |
| 1136 | .suspend = wbcir_suspend, | 1205 | .suspend = wbcir_suspend, |
| 1137 | .resume = wbcir_resume, | 1206 | .resume = wbcir_resume, |
| 1138 | .shutdown = wbcir_shutdown | 1207 | .shutdown = wbcir_shutdown |
diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c index aff39ae457a0..81f38aae9c66 100644 --- a/drivers/media/tuners/fc2580.c +++ b/drivers/media/tuners/fc2580.c | |||
| @@ -35,8 +35,6 @@ | |||
| 35 | * Currently it blind writes bunch of static registers from the | 35 | * Currently it blind writes bunch of static registers from the |
| 36 | * fc2580_freq_regs_lut[] when fc2580_set_params() is called. Add some | 36 | * fc2580_freq_regs_lut[] when fc2580_set_params() is called. Add some |
| 37 | * logic to reduce unneeded register writes. | 37 | * logic to reduce unneeded register writes. |
| 38 | * There is also don't-care registers, initialized with value 0xff, and those | ||
| 39 | * are also written to the chip currently (yes, not wise). | ||
| 40 | */ | 38 | */ |
| 41 | 39 | ||
| 42 | /* write multiple registers */ | 40 | /* write multiple registers */ |
| @@ -111,6 +109,17 @@ static int fc2580_rd_reg(struct fc2580_priv *priv, u8 reg, u8 *val) | |||
| 111 | return fc2580_rd_regs(priv, reg, val, 1); | 109 | return fc2580_rd_regs(priv, reg, val, 1); |
| 112 | } | 110 | } |
| 113 | 111 | ||
| 112 | /* write single register conditionally only when value differs from 0xff | ||
| 113 | * XXX: This is special routine meant only for writing fc2580_freq_regs_lut[] | ||
| 114 | * values. Do not use for the other purposes. */ | ||
| 115 | static int fc2580_wr_reg_ff(struct fc2580_priv *priv, u8 reg, u8 val) | ||
| 116 | { | ||
| 117 | if (val == 0xff) | ||
| 118 | return 0; | ||
| 119 | else | ||
| 120 | return fc2580_wr_regs(priv, reg, &val, 1); | ||
| 121 | } | ||
| 122 | |||
| 114 | static int fc2580_set_params(struct dvb_frontend *fe) | 123 | static int fc2580_set_params(struct dvb_frontend *fe) |
| 115 | { | 124 | { |
| 116 | struct fc2580_priv *priv = fe->tuner_priv; | 125 | struct fc2580_priv *priv = fe->tuner_priv; |
| @@ -213,99 +222,99 @@ static int fc2580_set_params(struct dvb_frontend *fe) | |||
| 213 | if (i == ARRAY_SIZE(fc2580_freq_regs_lut)) | 222 | if (i == ARRAY_SIZE(fc2580_freq_regs_lut)) |
| 214 | goto err; | 223 | goto err; |
| 215 | 224 | ||
| 216 | ret = fc2580_wr_reg(priv, 0x25, fc2580_freq_regs_lut[i].r25_val); | 225 | ret = fc2580_wr_reg_ff(priv, 0x25, fc2580_freq_regs_lut[i].r25_val); |
| 217 | if (ret < 0) | 226 | if (ret < 0) |
| 218 | goto err; | 227 | goto err; |
| 219 | 228 | ||
| 220 | ret = fc2580_wr_reg(priv, 0x27, fc2580_freq_regs_lut[i].r27_val); | 229 | ret = fc2580_wr_reg_ff(priv, 0x27, fc2580_freq_regs_lut[i].r27_val); |
| 221 | if (ret < 0) | 230 | if (ret < 0) |
| 222 | goto err; | 231 | goto err; |
| 223 | 232 | ||
| 224 | ret = fc2580_wr_reg(priv, 0x28, fc2580_freq_regs_lut[i].r28_val); | 233 | ret = fc2580_wr_reg_ff(priv, 0x28, fc2580_freq_regs_lut[i].r28_val); |
| 225 | if (ret < 0) | 234 | if (ret < 0) |
| 226 | goto err; | 235 | goto err; |
| 227 | 236 | ||
| 228 | ret = fc2580_wr_reg(priv, 0x29, fc2580_freq_regs_lut[i].r29_val); | 237 | ret = fc2580_wr_reg_ff(priv, 0x29, fc2580_freq_regs_lut[i].r29_val); |
| 229 | if (ret < 0) | 238 | if (ret < 0) |
| 230 | goto err; | 239 | goto err; |
| 231 | 240 | ||
| 232 | ret = fc2580_wr_reg(priv, 0x2b, fc2580_freq_regs_lut[i].r2b_val); | 241 | ret = fc2580_wr_reg_ff(priv, 0x2b, fc2580_freq_regs_lut[i].r2b_val); |
| 233 | if (ret < 0) | 242 | if (ret < 0) |
| 234 | goto err; | 243 | goto err; |
| 235 | 244 | ||
| 236 | ret = fc2580_wr_reg(priv, 0x2c, fc2580_freq_regs_lut[i].r2c_val); | 245 | ret = fc2580_wr_reg_ff(priv, 0x2c, fc2580_freq_regs_lut[i].r2c_val); |
| 237 | if (ret < 0) | 246 | if (ret < 0) |
| 238 | goto err; | 247 | goto err; |
| 239 | 248 | ||
| 240 | ret = fc2580_wr_reg(priv, 0x2d, fc2580_freq_regs_lut[i].r2d_val); | 249 | ret = fc2580_wr_reg_ff(priv, 0x2d, fc2580_freq_regs_lut[i].r2d_val); |
| 241 | if (ret < 0) | 250 | if (ret < 0) |
| 242 | goto err; | 251 | goto err; |
| 243 | 252 | ||
| 244 | ret = fc2580_wr_reg(priv, 0x30, fc2580_freq_regs_lut[i].r30_val); | 253 | ret = fc2580_wr_reg_ff(priv, 0x30, fc2580_freq_regs_lut[i].r30_val); |
| 245 | if (ret < 0) | 254 | if (ret < 0) |
| 246 | goto err; | 255 | goto err; |
| 247 | 256 | ||
| 248 | ret = fc2580_wr_reg(priv, 0x44, fc2580_freq_regs_lut[i].r44_val); | 257 | ret = fc2580_wr_reg_ff(priv, 0x44, fc2580_freq_regs_lut[i].r44_val); |
| 249 | if (ret < 0) | 258 | if (ret < 0) |
| 250 | goto err; | 259 | goto err; |
| 251 | 260 | ||
| 252 | ret = fc2580_wr_reg(priv, 0x50, fc2580_freq_regs_lut[i].r50_val); | 261 | ret = fc2580_wr_reg_ff(priv, 0x50, fc2580_freq_regs_lut[i].r50_val); |
| 253 | if (ret < 0) | 262 | if (ret < 0) |
| 254 | goto err; | 263 | goto err; |
| 255 | 264 | ||
| 256 | ret = fc2580_wr_reg(priv, 0x53, fc2580_freq_regs_lut[i].r53_val); | 265 | ret = fc2580_wr_reg_ff(priv, 0x53, fc2580_freq_regs_lut[i].r53_val); |
| 257 | if (ret < 0) | 266 | if (ret < 0) |
| 258 | goto err; | 267 | goto err; |
| 259 | 268 | ||
| 260 | ret = fc2580_wr_reg(priv, 0x5f, fc2580_freq_regs_lut[i].r5f_val); | 269 | ret = fc2580_wr_reg_ff(priv, 0x5f, fc2580_freq_regs_lut[i].r5f_val); |
| 261 | if (ret < 0) | 270 | if (ret < 0) |
| 262 | goto err; | 271 | goto err; |
| 263 | 272 | ||
| 264 | ret = fc2580_wr_reg(priv, 0x61, fc2580_freq_regs_lut[i].r61_val); | 273 | ret = fc2580_wr_reg_ff(priv, 0x61, fc2580_freq_regs_lut[i].r61_val); |
| 265 | if (ret < 0) | 274 | if (ret < 0) |
| 266 | goto err; | 275 | goto err; |
| 267 | 276 | ||
| 268 | ret = fc2580_wr_reg(priv, 0x62, fc2580_freq_regs_lut[i].r62_val); | 277 | ret = fc2580_wr_reg_ff(priv, 0x62, fc2580_freq_regs_lut[i].r62_val); |
| 269 | if (ret < 0) | 278 | if (ret < 0) |
| 270 | goto err; | 279 | goto err; |
| 271 | 280 | ||
| 272 | ret = fc2580_wr_reg(priv, 0x63, fc2580_freq_regs_lut[i].r63_val); | 281 | ret = fc2580_wr_reg_ff(priv, 0x63, fc2580_freq_regs_lut[i].r63_val); |
| 273 | if (ret < 0) | 282 | if (ret < 0) |
| 274 | goto err; | 283 | goto err; |
| 275 | 284 | ||
| 276 | ret = fc2580_wr_reg(priv, 0x67, fc2580_freq_regs_lut[i].r67_val); | 285 | ret = fc2580_wr_reg_ff(priv, 0x67, fc2580_freq_regs_lut[i].r67_val); |
| 277 | if (ret < 0) | 286 | if (ret < 0) |
| 278 | goto err; | 287 | goto err; |
| 279 | 288 | ||
| 280 | ret = fc2580_wr_reg(priv, 0x68, fc2580_freq_regs_lut[i].r68_val); | 289 | ret = fc2580_wr_reg_ff(priv, 0x68, fc2580_freq_regs_lut[i].r68_val); |
| 281 | if (ret < 0) | 290 | if (ret < 0) |
| 282 | goto err; | 291 | goto err; |
| 283 | 292 | ||
| 284 | ret = fc2580_wr_reg(priv, 0x69, fc2580_freq_regs_lut[i].r69_val); | 293 | ret = fc2580_wr_reg_ff(priv, 0x69, fc2580_freq_regs_lut[i].r69_val); |
| 285 | if (ret < 0) | 294 | if (ret < 0) |
| 286 | goto err; | 295 | goto err; |
| 287 | 296 | ||
| 288 | ret = fc2580_wr_reg(priv, 0x6a, fc2580_freq_regs_lut[i].r6a_val); | 297 | ret = fc2580_wr_reg_ff(priv, 0x6a, fc2580_freq_regs_lut[i].r6a_val); |
| 289 | if (ret < 0) | 298 | if (ret < 0) |
| 290 | goto err; | 299 | goto err; |
| 291 | 300 | ||
| 292 | ret = fc2580_wr_reg(priv, 0x6b, fc2580_freq_regs_lut[i].r6b_val); | 301 | ret = fc2580_wr_reg_ff(priv, 0x6b, fc2580_freq_regs_lut[i].r6b_val); |
| 293 | if (ret < 0) | 302 | if (ret < 0) |
| 294 | goto err; | 303 | goto err; |
| 295 | 304 | ||
| 296 | ret = fc2580_wr_reg(priv, 0x6c, fc2580_freq_regs_lut[i].r6c_val); | 305 | ret = fc2580_wr_reg_ff(priv, 0x6c, fc2580_freq_regs_lut[i].r6c_val); |
| 297 | if (ret < 0) | 306 | if (ret < 0) |
| 298 | goto err; | 307 | goto err; |
| 299 | 308 | ||
| 300 | ret = fc2580_wr_reg(priv, 0x6d, fc2580_freq_regs_lut[i].r6d_val); | 309 | ret = fc2580_wr_reg_ff(priv, 0x6d, fc2580_freq_regs_lut[i].r6d_val); |
| 301 | if (ret < 0) | 310 | if (ret < 0) |
| 302 | goto err; | 311 | goto err; |
| 303 | 312 | ||
| 304 | ret = fc2580_wr_reg(priv, 0x6e, fc2580_freq_regs_lut[i].r6e_val); | 313 | ret = fc2580_wr_reg_ff(priv, 0x6e, fc2580_freq_regs_lut[i].r6e_val); |
| 305 | if (ret < 0) | 314 | if (ret < 0) |
| 306 | goto err; | 315 | goto err; |
| 307 | 316 | ||
| 308 | ret = fc2580_wr_reg(priv, 0x6f, fc2580_freq_regs_lut[i].r6f_val); | 317 | ret = fc2580_wr_reg_ff(priv, 0x6f, fc2580_freq_regs_lut[i].r6f_val); |
| 309 | if (ret < 0) | 318 | if (ret < 0) |
| 310 | goto err; | 319 | goto err; |
| 311 | 320 | ||
diff --git a/drivers/media/tuners/max2165.c b/drivers/media/tuners/max2165.c index ba84936aafd6..95ed46f2cd26 100644 --- a/drivers/media/tuners/max2165.c +++ b/drivers/media/tuners/max2165.c | |||
| @@ -161,7 +161,7 @@ static int max2165_set_bandwidth(struct max2165_priv *priv, u32 bw) | |||
| 161 | return 0; | 161 | return 0; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | int fixpt_div32(u32 dividend, u32 divisor, u32 *quotient, u32 *fraction) | 164 | static int fixpt_div32(u32 dividend, u32 divisor, u32 *quotient, u32 *fraction) |
| 165 | { | 165 | { |
| 166 | u32 remainder; | 166 | u32 remainder; |
| 167 | u32 q, f = 0; | 167 | u32 q, f = 0; |
diff --git a/drivers/media/tuners/tua9001.c b/drivers/media/tuners/tua9001.c index 389668474070..83a6240f64d3 100644 --- a/drivers/media/tuners/tua9001.c +++ b/drivers/media/tuners/tua9001.c | |||
| @@ -136,7 +136,7 @@ static int tua9001_set_params(struct dvb_frontend *fe) | |||
| 136 | { | 136 | { |
| 137 | struct tua9001_priv *priv = fe->tuner_priv; | 137 | struct tua9001_priv *priv = fe->tuner_priv; |
| 138 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 138 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
| 139 | int ret, i; | 139 | int ret = 0, i; |
| 140 | u16 val; | 140 | u16 val; |
| 141 | u32 frequency; | 141 | u32 frequency; |
| 142 | struct reg_val data[2]; | 142 | struct reg_val data[2]; |
diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c index 4937712278f6..5c0fd787cc8f 100644 --- a/drivers/media/tuners/xc4000.c +++ b/drivers/media/tuners/xc4000.c | |||
| @@ -934,7 +934,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, | |||
| 934 | int rc = 0, is_retry = 0; | 934 | int rc = 0, is_retry = 0; |
| 935 | u16 hwmodel; | 935 | u16 hwmodel; |
| 936 | v4l2_std_id std0; | 936 | v4l2_std_id std0; |
| 937 | u8 hw_major, hw_minor, fw_major, fw_minor; | 937 | u8 hw_major = 0, hw_minor = 0, fw_major = 0, fw_minor = 0; |
| 938 | 938 | ||
| 939 | dprintk(1, "%s called\n", __func__); | 939 | dprintk(1, "%s called\n", __func__); |
| 940 | 940 | ||
diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c index 448361c6a13e..0cb7c28dcb17 100644 --- a/drivers/media/usb/au0828/au0828-cards.c +++ b/drivers/media/usb/au0828/au0828-cards.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include "media/tuner.h" | 25 | #include "media/tuner.h" |
| 26 | #include "media/v4l2-common.h" | 26 | #include "media/v4l2-common.h" |
| 27 | 27 | ||
| 28 | void hvr950q_cs5340_audio(void *priv, int enable) | 28 | static void hvr950q_cs5340_audio(void *priv, int enable) |
| 29 | { | 29 | { |
| 30 | /* Because the HVR-950q shares an i2s bus between the cs5340 and the | 30 | /* Because the HVR-950q shares an i2s bus between the cs5340 and the |
| 31 | au8522, we need to hold cs5340 in reset when using the au8522 */ | 31 | au8522, we need to hold cs5340 in reset when using the au8522 */ |
diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c index b328f6550d0b..9a6f15613a38 100644 --- a/drivers/media/usb/au0828/au0828-dvb.c +++ b/drivers/media/usb/au0828/au0828-dvb.c | |||
| @@ -272,7 +272,6 @@ static void au0828_restart_dvb_streaming(struct work_struct *work) | |||
| 272 | struct au0828_dev *dev = container_of(work, struct au0828_dev, | 272 | struct au0828_dev *dev = container_of(work, struct au0828_dev, |
| 273 | restart_streaming); | 273 | restart_streaming); |
| 274 | struct au0828_dvb *dvb = &dev->dvb; | 274 | struct au0828_dvb *dvb = &dev->dvb; |
| 275 | int ret; | ||
| 276 | 275 | ||
| 277 | if (dev->urb_streaming == 0) | 276 | if (dev->urb_streaming == 0) |
| 278 | return; | 277 | return; |
| @@ -282,7 +281,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work) | |||
| 282 | mutex_lock(&dvb->lock); | 281 | mutex_lock(&dvb->lock); |
| 283 | 282 | ||
| 284 | /* Stop transport */ | 283 | /* Stop transport */ |
| 285 | ret = stop_urb_transfer(dev); | 284 | stop_urb_transfer(dev); |
| 286 | au0828_write(dev, 0x608, 0x00); | 285 | au0828_write(dev, 0x608, 0x00); |
| 287 | au0828_write(dev, 0x609, 0x00); | 286 | au0828_write(dev, 0x609, 0x00); |
| 288 | au0828_write(dev, 0x60a, 0x00); | 287 | au0828_write(dev, 0x60a, 0x00); |
| @@ -293,7 +292,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work) | |||
| 293 | au0828_write(dev, 0x609, 0x72); | 292 | au0828_write(dev, 0x609, 0x72); |
| 294 | au0828_write(dev, 0x60a, 0x71); | 293 | au0828_write(dev, 0x60a, 0x71); |
| 295 | au0828_write(dev, 0x60b, 0x01); | 294 | au0828_write(dev, 0x60b, 0x01); |
| 296 | ret = start_urb_transfer(dev); | 295 | start_urb_transfer(dev); |
| 297 | 296 | ||
| 298 | mutex_unlock(&dvb->lock); | 297 | mutex_unlock(&dvb->lock); |
| 299 | } | 298 | } |
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 870585570571..45387aab10c7 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c | |||
| @@ -158,7 +158,7 @@ static void au0828_irq_callback(struct urb *urb) | |||
| 158 | /* | 158 | /* |
| 159 | * Stop and Deallocate URBs | 159 | * Stop and Deallocate URBs |
| 160 | */ | 160 | */ |
| 161 | void au0828_uninit_isoc(struct au0828_dev *dev) | 161 | static void au0828_uninit_isoc(struct au0828_dev *dev) |
| 162 | { | 162 | { |
| 163 | struct urb *urb; | 163 | struct urb *urb; |
| 164 | int i; | 164 | int i; |
| @@ -197,9 +197,9 @@ void au0828_uninit_isoc(struct au0828_dev *dev) | |||
| 197 | /* | 197 | /* |
| 198 | * Allocate URBs and start IRQ | 198 | * Allocate URBs and start IRQ |
| 199 | */ | 199 | */ |
| 200 | int au0828_init_isoc(struct au0828_dev *dev, int max_packets, | 200 | static int au0828_init_isoc(struct au0828_dev *dev, int max_packets, |
| 201 | int num_bufs, int max_pkt_size, | 201 | int num_bufs, int max_pkt_size, |
| 202 | int (*isoc_copy) (struct au0828_dev *dev, struct urb *urb)) | 202 | int (*isoc_copy) (struct au0828_dev *dev, struct urb *urb)) |
| 203 | { | 203 | { |
| 204 | struct au0828_dmaqueue *dma_q = &dev->vidq; | 204 | struct au0828_dmaqueue *dma_q = &dev->vidq; |
| 205 | int i; | 205 | int i; |
| @@ -783,7 +783,7 @@ static int au0828_i2s_init(struct au0828_dev *dev) | |||
| 783 | * Auvitek au0828 analog stream enable | 783 | * Auvitek au0828 analog stream enable |
| 784 | * Please set interface0 to AS5 before enable the stream | 784 | * Please set interface0 to AS5 before enable the stream |
| 785 | */ | 785 | */ |
| 786 | int au0828_analog_stream_enable(struct au0828_dev *d) | 786 | static int au0828_analog_stream_enable(struct au0828_dev *d) |
| 787 | { | 787 | { |
| 788 | dprintk(1, "au0828_analog_stream_enable called\n"); | 788 | dprintk(1, "au0828_analog_stream_enable called\n"); |
| 789 | au0828_writereg(d, AU0828_SENSORCTRL_VBI_103, 0x00); | 789 | au0828_writereg(d, AU0828_SENSORCTRL_VBI_103, 0x00); |
| @@ -810,7 +810,7 @@ int au0828_analog_stream_disable(struct au0828_dev *d) | |||
| 810 | return 0; | 810 | return 0; |
| 811 | } | 811 | } |
| 812 | 812 | ||
| 813 | void au0828_analog_stream_reset(struct au0828_dev *dev) | 813 | static void au0828_analog_stream_reset(struct au0828_dev *dev) |
| 814 | { | 814 | { |
| 815 | dprintk(1, "au0828_analog_stream_reset called\n"); | 815 | dprintk(1, "au0828_analog_stream_reset called\n"); |
| 816 | au0828_writereg(dev, AU0828_SENSORCTRL_100, 0x0); | 816 | au0828_writereg(dev, AU0828_SENSORCTRL_100, 0x0); |
| @@ -913,7 +913,7 @@ static int get_ressource(struct au0828_fh *fh) | |||
| 913 | /* This function ensures that video frames continue to be delivered even if | 913 | /* This function ensures that video frames continue to be delivered even if |
| 914 | the ITU-656 input isn't receiving any data (thereby preventing applications | 914 | the ITU-656 input isn't receiving any data (thereby preventing applications |
| 915 | such as tvtime from hanging) */ | 915 | such as tvtime from hanging) */ |
| 916 | void au0828_vid_buffer_timeout(unsigned long data) | 916 | static void au0828_vid_buffer_timeout(unsigned long data) |
| 917 | { | 917 | { |
| 918 | struct au0828_dev *dev = (struct au0828_dev *) data; | 918 | struct au0828_dev *dev = (struct au0828_dev *) data; |
| 919 | struct au0828_dmaqueue *dma_q = &dev->vidq; | 919 | struct au0828_dmaqueue *dma_q = &dev->vidq; |
| @@ -937,7 +937,7 @@ void au0828_vid_buffer_timeout(unsigned long data) | |||
| 937 | spin_unlock_irqrestore(&dev->slock, flags); | 937 | spin_unlock_irqrestore(&dev->slock, flags); |
| 938 | } | 938 | } |
| 939 | 939 | ||
| 940 | void au0828_vbi_buffer_timeout(unsigned long data) | 940 | static void au0828_vbi_buffer_timeout(unsigned long data) |
| 941 | { | 941 | { |
| 942 | struct au0828_dev *dev = (struct au0828_dev *) data; | 942 | struct au0828_dev *dev = (struct au0828_dev *) data; |
| 943 | struct au0828_dmaqueue *dma_q = &dev->vbiq; | 943 | struct au0828_dmaqueue *dma_q = &dev->vbiq; |
diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 447148eff958..722207913740 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c | |||
| @@ -1068,12 +1068,12 @@ int cx231xx_unmute_audio(struct cx231xx *dev) | |||
| 1068 | } | 1068 | } |
| 1069 | EXPORT_SYMBOL_GPL(cx231xx_unmute_audio); | 1069 | EXPORT_SYMBOL_GPL(cx231xx_unmute_audio); |
| 1070 | 1070 | ||
| 1071 | int stopAudioFirmware(struct cx231xx *dev) | 1071 | static int stopAudioFirmware(struct cx231xx *dev) |
| 1072 | { | 1072 | { |
| 1073 | return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x03); | 1073 | return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x03); |
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| 1076 | int restartAudioFirmware(struct cx231xx *dev) | 1076 | static int restartAudioFirmware(struct cx231xx *dev) |
| 1077 | { | 1077 | { |
| 1078 | return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x13); | 1078 | return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x13); |
| 1079 | } | 1079 | } |
| @@ -2631,11 +2631,6 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) | |||
| 2631 | rc = cx231xx_stop_stream(dev, ep_mask); | 2631 | rc = cx231xx_stop_stream(dev, ep_mask); |
| 2632 | } | 2632 | } |
| 2633 | 2633 | ||
| 2634 | if (dev->mode == CX231XX_ANALOG_MODE) | ||
| 2635 | ;/* do any in Analog mode */ | ||
| 2636 | else | ||
| 2637 | ;/* do any in digital mode */ | ||
| 2638 | |||
| 2639 | return rc; | 2634 | return rc; |
| 2640 | } | 2635 | } |
| 2641 | EXPORT_SYMBOL_GPL(cx231xx_capture_start); | 2636 | EXPORT_SYMBOL_GPL(cx231xx_capture_start); |
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index b84ebc54d91b..bbed1e40eeda 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c | |||
| @@ -686,7 +686,7 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) | |||
| 686 | } | 686 | } |
| 687 | EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); | 687 | EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); |
| 688 | 688 | ||
| 689 | void cx231xx_reset_out(struct cx231xx *dev) | 689 | static void cx231xx_reset_out(struct cx231xx *dev) |
| 690 | { | 690 | { |
| 691 | cx231xx_set_gpio_value(dev, CX23417_RESET, 1); | 691 | cx231xx_set_gpio_value(dev, CX23417_RESET, 1); |
| 692 | msleep(200); | 692 | msleep(200); |
| @@ -694,11 +694,13 @@ void cx231xx_reset_out(struct cx231xx *dev) | |||
| 694 | msleep(200); | 694 | msleep(200); |
| 695 | cx231xx_set_gpio_value(dev, CX23417_RESET, 1); | 695 | cx231xx_set_gpio_value(dev, CX23417_RESET, 1); |
| 696 | } | 696 | } |
| 697 | void cx231xx_enable_OSC(struct cx231xx *dev) | 697 | |
| 698 | static void cx231xx_enable_OSC(struct cx231xx *dev) | ||
| 698 | { | 699 | { |
| 699 | cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1); | 700 | cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1); |
| 700 | } | 701 | } |
| 701 | void cx231xx_sleep_s5h1432(struct cx231xx *dev) | 702 | |
| 703 | static void cx231xx_sleep_s5h1432(struct cx231xx *dev) | ||
| 702 | { | 704 | { |
| 703 | cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0); | 705 | cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0); |
| 704 | } | 706 | } |
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 781feed406f7..96a5a0965399 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c | |||
| @@ -72,8 +72,8 @@ static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus, | |||
| 72 | /* | 72 | /* |
| 73 | * cx231xx_i2c_send_bytes() | 73 | * cx231xx_i2c_send_bytes() |
| 74 | */ | 74 | */ |
| 75 | int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, | 75 | static int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, |
| 76 | const struct i2c_msg *msg) | 76 | const struct i2c_msg *msg) |
| 77 | { | 77 | { |
| 78 | struct cx231xx_i2c *bus = i2c_adap->algo_data; | 78 | struct cx231xx_i2c *bus = i2c_adap->algo_data; |
| 79 | struct cx231xx *dev = bus->dev; | 79 | struct cx231xx *dev = bus->dev; |
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c index 96176e9db5a2..0f7b42446826 100644 --- a/drivers/media/usb/cx231xx/cx231xx-input.c +++ b/drivers/media/usb/cx231xx/cx231xx-input.c | |||
| @@ -99,7 +99,7 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
| 99 | /* The i2c micro-controller only outputs the cmd part of NEC protocol */ | 99 | /* The i2c micro-controller only outputs the cmd part of NEC protocol */ |
| 100 | dev->init_data.rc_dev->scanmask = 0xff; | 100 | dev->init_data.rc_dev->scanmask = 0xff; |
| 101 | dev->init_data.rc_dev->driver_name = "cx231xx"; | 101 | dev->init_data.rc_dev->driver_name = "cx231xx"; |
| 102 | dev->init_data.type = RC_TYPE_NEC; | 102 | dev->init_data.type = RC_BIT_NEC; |
| 103 | info.addr = 0x30; | 103 | info.addr = 0x30; |
| 104 | 104 | ||
| 105 | /* Load and bind ir-kbd-i2c */ | 105 | /* Load and bind ir-kbd-i2c */ |
diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c index 3d7526e28d42..943d93423705 100644 --- a/drivers/media/usb/dvb-usb-v2/af9015.c +++ b/drivers/media/usb/dvb-usb-v2/af9015.c | |||
| @@ -1306,7 +1306,7 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | |||
| 1306 | if (!rc->map_name) | 1306 | if (!rc->map_name) |
| 1307 | rc->map_name = RC_MAP_EMPTY; | 1307 | rc->map_name = RC_MAP_EMPTY; |
| 1308 | 1308 | ||
| 1309 | rc->allowed_protos = RC_TYPE_NEC; | 1309 | rc->allowed_protos = RC_BIT_NEC; |
| 1310 | rc->query = af9015_rc_query; | 1310 | rc->query = af9015_rc_query; |
| 1311 | rc->interval = 500; | 1311 | rc->interval = 500; |
| 1312 | 1312 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index ea27eaff4e34..61ae7f9d0b27 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
| @@ -1023,10 +1023,10 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | |||
| 1023 | switch (tmp) { | 1023 | switch (tmp) { |
| 1024 | case 0: /* NEC */ | 1024 | case 0: /* NEC */ |
| 1025 | default: | 1025 | default: |
| 1026 | rc->allowed_protos = RC_TYPE_NEC; | 1026 | rc->allowed_protos = RC_BIT_NEC; |
| 1027 | break; | 1027 | break; |
| 1028 | case 1: /* RC6 */ | 1028 | case 1: /* RC6 */ |
| 1029 | rc->allowed_protos = RC_TYPE_RC6; | 1029 | rc->allowed_protos = RC_BIT_RC6_MCE; |
| 1030 | break; | 1030 | break; |
| 1031 | } | 1031 | } |
| 1032 | 1032 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index ec540140c810..d05c5b563dac 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c | |||
| @@ -1048,7 +1048,7 @@ static int anysee_rc_query(struct dvb_usb_device *d) | |||
| 1048 | 1048 | ||
| 1049 | static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | 1049 | static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) |
| 1050 | { | 1050 | { |
| 1051 | rc->allowed_protos = RC_TYPE_NEC; | 1051 | rc->allowed_protos = RC_BIT_NEC; |
| 1052 | rc->query = anysee_rc_query; | 1052 | rc->query = anysee_rc_query; |
| 1053 | rc->interval = 250; /* windows driver uses 500ms */ | 1053 | rc->interval = 250; /* windows driver uses 500ms */ |
| 1054 | 1054 | ||
| @@ -1170,7 +1170,7 @@ static int anysee_ci_poll_slot_status(struct dvb_ca_en50221 *ci, int slot, | |||
| 1170 | struct dvb_usb_device *d = ci->data; | 1170 | struct dvb_usb_device *d = ci->data; |
| 1171 | struct anysee_state *state = d_to_priv(d); | 1171 | struct anysee_state *state = d_to_priv(d); |
| 1172 | int ret; | 1172 | int ret; |
| 1173 | u8 tmp; | 1173 | u8 tmp = 0; |
| 1174 | 1174 | ||
| 1175 | ret = anysee_rd_reg_mask(d, REG_IOC, &tmp, 0x40); | 1175 | ret = anysee_rd_reg_mask(d, REG_IOC, &tmp, 0x40); |
| 1176 | if (ret) | 1176 | if (ret) |
diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c index 54f1221d930d..d75dbf27e99e 100644 --- a/drivers/media/usb/dvb-usb-v2/az6007.c +++ b/drivers/media/usb/dvb-usb-v2/az6007.c | |||
| @@ -826,7 +826,7 @@ static int az6007_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | |||
| 826 | { | 826 | { |
| 827 | pr_debug("Getting az6007 Remote Control properties\n"); | 827 | pr_debug("Getting az6007 Remote Control properties\n"); |
| 828 | 828 | ||
| 829 | rc->allowed_protos = RC_TYPE_NEC; | 829 | rc->allowed_protos = RC_BIT_NEC; |
| 830 | rc->query = az6007_rc_query; | 830 | rc->query = az6007_rc_query; |
| 831 | rc->interval = 400; | 831 | rc->interval = 400; |
| 832 | 832 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h index bae16a1189d6..059291b892b8 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h | |||
| @@ -137,7 +137,7 @@ struct dvb_usb_driver_info { | |||
| 137 | struct dvb_usb_rc { | 137 | struct dvb_usb_rc { |
| 138 | const char *map_name; | 138 | const char *map_name; |
| 139 | u64 allowed_protos; | 139 | u64 allowed_protos; |
| 140 | int (*change_protocol)(struct rc_dev *dev, u64 rc_type); | 140 | int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); |
| 141 | int (*query) (struct dvb_usb_device *d); | 141 | int (*query) (struct dvb_usb_device *d); |
| 142 | unsigned int interval; | 142 | unsigned int interval; |
| 143 | const enum rc_driver_type driver_type; | 143 | const enum rc_driver_type driver_type; |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 9859d2a2449b..671b4fa232b4 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | |||
| @@ -224,7 +224,7 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, u8 *buf, | |||
| 224 | dvb_dmx_swfilter_raw(&adap->demux, buf, len); | 224 | dvb_dmx_swfilter_raw(&adap->demux, buf, len); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) | 227 | static int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) |
| 228 | { | 228 | { |
| 229 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, | 229 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, |
| 230 | adap->id); | 230 | adap->id); |
| @@ -236,7 +236,7 @@ int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) | |||
| 236 | return usb_urb_initv2(&adap->stream, &adap->props->stream); | 236 | return usb_urb_initv2(&adap->stream, &adap->props->stream); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) | 239 | static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) |
| 240 | { | 240 | { |
| 241 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, | 241 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, |
| 242 | adap->id); | 242 | adap->id); |
| @@ -283,14 +283,13 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, | |||
| 283 | 283 | ||
| 284 | /* activate the pid on the device pid filter */ | 284 | /* activate the pid on the device pid filter */ |
| 285 | if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && | 285 | if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && |
| 286 | adap->pid_filtering && | 286 | adap->pid_filtering && adap->props->pid_filter) { |
| 287 | adap->props->pid_filter) | ||
| 288 | ret = adap->props->pid_filter(adap, dvbdmxfeed->index, | 287 | ret = adap->props->pid_filter(adap, dvbdmxfeed->index, |
| 289 | dvbdmxfeed->pid, (count == 1) ? 1 : 0); | 288 | dvbdmxfeed->pid, (count == 1) ? 1 : 0); |
| 290 | if (ret < 0) | 289 | if (ret < 0) |
| 291 | dev_err(&d->udev->dev, "%s: pid_filter() " \ | 290 | dev_err(&d->udev->dev, "%s: pid_filter() failed=%d\n", |
| 292 | "failed=%d\n", KBUILD_MODNAME, | 291 | KBUILD_MODNAME, ret); |
| 293 | ret); | 292 | } |
| 294 | 293 | ||
| 295 | /* start feeding if it is first pid */ | 294 | /* start feeding if it is first pid */ |
| 296 | if (adap->feed_count == 1 && count == 1) { | 295 | if (adap->feed_count == 1 && count == 1) { |
| @@ -369,7 +368,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | |||
| 369 | return dvb_usb_ctrl_feed(dvbdmxfeed, -1); | 368 | return dvb_usb_ctrl_feed(dvbdmxfeed, -1); |
| 370 | } | 369 | } |
| 371 | 370 | ||
| 372 | int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) | 371 | static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) |
| 373 | { | 372 | { |
| 374 | int ret; | 373 | int ret; |
| 375 | struct dvb_usb_device *d = adap_to_d(adap); | 374 | struct dvb_usb_device *d = adap_to_d(adap); |
| @@ -441,7 +440,7 @@ err_dvb_register_adapter: | |||
| 441 | return ret; | 440 | return ret; |
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) | 443 | static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) |
| 445 | { | 444 | { |
| 446 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, | 445 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, |
| 447 | adap->id); | 446 | adap->id); |
| @@ -457,7 +456,7 @@ int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) | |||
| 457 | return 0; | 456 | return 0; |
| 458 | } | 457 | } |
| 459 | 458 | ||
| 460 | int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff) | 459 | static int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff) |
| 461 | { | 460 | { |
| 462 | int ret; | 461 | int ret; |
| 463 | 462 | ||
| @@ -554,7 +553,7 @@ err: | |||
| 554 | return ret; | 553 | return ret; |
| 555 | } | 554 | } |
| 556 | 555 | ||
| 557 | int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) | 556 | static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) |
| 558 | { | 557 | { |
| 559 | int ret, i, count_registered = 0; | 558 | int ret, i, count_registered = 0; |
| 560 | struct dvb_usb_device *d = adap_to_d(adap); | 559 | struct dvb_usb_device *d = adap_to_d(adap); |
| @@ -623,7 +622,7 @@ err: | |||
| 623 | return ret; | 622 | return ret; |
| 624 | } | 623 | } |
| 625 | 624 | ||
| 626 | int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap) | 625 | static int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap) |
| 627 | { | 626 | { |
| 628 | int i; | 627 | int i; |
| 629 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, | 628 | dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, |
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c index 0431beed0ef4..5716662b4834 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c | |||
| @@ -32,9 +32,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, | |||
| 32 | return -EINVAL; | 32 | return -EINVAL; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | ret = mutex_lock_interruptible(&d->usb_mutex); | 35 | mutex_lock(&d->usb_mutex); |
| 36 | if (ret < 0) | ||
| 37 | return ret; | ||
| 38 | 36 | ||
| 39 | dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); | 37 | dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); |
| 40 | 38 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 695f9106bc54..47204280b8b3 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c | |||
| @@ -659,13 +659,19 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap) | |||
| 659 | it913x_wr_reg(d, DEV_0_DMOD, MP2IF2_SW_RST, 0x1); | 659 | it913x_wr_reg(d, DEV_0_DMOD, MP2IF2_SW_RST, 0x1); |
| 660 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x0f); | 660 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x0f); |
| 661 | it913x_wr_reg(d, DEV_0, EP0_TX_NAK, 0x1b); | 661 | it913x_wr_reg(d, DEV_0, EP0_TX_NAK, 0x1b); |
| 662 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f); | 662 | if (st->proprietary_ir == false) /* Enable endpoint 3 */ |
| 663 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x3f); | ||
| 664 | else | ||
| 665 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f); | ||
| 663 | it913x_wr_reg(d, DEV_0, EP4_TX_LEN_LSB, | 666 | it913x_wr_reg(d, DEV_0, EP4_TX_LEN_LSB, |
| 664 | ep_size & 0xff); | 667 | ep_size & 0xff); |
| 665 | it913x_wr_reg(d, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8); | 668 | it913x_wr_reg(d, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8); |
| 666 | ret = it913x_wr_reg(d, DEV_0, EP4_MAX_PKT, pkt_size); | 669 | ret = it913x_wr_reg(d, DEV_0, EP4_MAX_PKT, pkt_size); |
| 667 | } else if (adap->id == 1 && adap->fe[0]) { | 670 | } else if (adap->id == 1 && adap->fe[0]) { |
| 668 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f); | 671 | if (st->proprietary_ir == false) |
| 672 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x7f); | ||
| 673 | else | ||
| 674 | it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f); | ||
| 669 | it913x_wr_reg(d, DEV_0, EP5_TX_LEN_LSB, | 675 | it913x_wr_reg(d, DEV_0, EP5_TX_LEN_LSB, |
| 670 | ep_size & 0xff); | 676 | ep_size & 0xff); |
| 671 | it913x_wr_reg(d, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8); | 677 | it913x_wr_reg(d, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8); |
| @@ -698,7 +704,7 @@ static int it913x_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) | |||
| 698 | return 0; | 704 | return 0; |
| 699 | } | 705 | } |
| 700 | 706 | ||
| 701 | rc->allowed_protos = RC_TYPE_NEC; | 707 | rc->allowed_protos = RC_BIT_NEC; |
| 702 | rc->query = it913x_rc_query; | 708 | rc->query = it913x_rc_query; |
| 703 | rc->interval = 250; | 709 | rc->interval = 250; |
| 704 | 710 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index c41d9d9ec7b5..6427ac359f21 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c | |||
| @@ -799,7 +799,7 @@ static const char fw_c_rs2000[] = LME2510_C_RS2000; | |||
| 799 | static const char fw_lg[] = LME2510_LG; | 799 | static const char fw_lg[] = LME2510_LG; |
| 800 | static const char fw_s0194[] = LME2510_S0194; | 800 | static const char fw_s0194[] = LME2510_S0194; |
| 801 | 801 | ||
| 802 | const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) | 802 | static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) |
| 803 | { | 803 | { |
| 804 | struct lme2510_state *st = d->priv; | 804 | struct lme2510_state *st = d->priv; |
| 805 | struct usb_device *udev = d->udev; | 805 | struct usb_device *udev = d->udev; |
| @@ -1253,7 +1253,7 @@ static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type, | |||
| 1253 | static int lme2510_get_rc_config(struct dvb_usb_device *d, | 1253 | static int lme2510_get_rc_config(struct dvb_usb_device *d, |
| 1254 | struct dvb_usb_rc *rc) | 1254 | struct dvb_usb_rc *rc) |
| 1255 | { | 1255 | { |
| 1256 | rc->allowed_protos = RC_TYPE_NEC; | 1256 | rc->allowed_protos = RC_BIT_NEC; |
| 1257 | return 0; | 1257 | return 0; |
| 1258 | } | 1258 | } |
| 1259 | 1259 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index adabba8d28bc..a4c302d0aa37 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
| @@ -1197,7 +1197,7 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d, | |||
| 1197 | struct dvb_usb_rc *rc) | 1197 | struct dvb_usb_rc *rc) |
| 1198 | { | 1198 | { |
| 1199 | rc->map_name = RC_MAP_EMPTY; | 1199 | rc->map_name = RC_MAP_EMPTY; |
| 1200 | rc->allowed_protos = RC_TYPE_NEC; | 1200 | rc->allowed_protos = RC_BIT_NEC; |
| 1201 | rc->query = rtl2831u_rc_query; | 1201 | rc->query = rtl2831u_rc_query; |
| 1202 | rc->interval = 400; | 1202 | rc->interval = 400; |
| 1203 | 1203 | ||
| @@ -1269,7 +1269,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d, | |||
| 1269 | struct dvb_usb_rc *rc) | 1269 | struct dvb_usb_rc *rc) |
| 1270 | { | 1270 | { |
| 1271 | rc->map_name = RC_MAP_EMPTY; | 1271 | rc->map_name = RC_MAP_EMPTY; |
| 1272 | rc->allowed_protos = RC_TYPE_NEC; | 1272 | rc->allowed_protos = RC_BIT_NEC; |
| 1273 | rc->query = rtl2832u_rc_query; | 1273 | rc->query = rtl2832u_rc_query; |
| 1274 | rc->interval = 400; | 1274 | rc->interval = 400; |
| 1275 | 1275 | ||
| @@ -1338,6 +1338,8 @@ static const struct usb_device_id rtl28xxu_id_table[] = { | |||
| 1338 | &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) }, | 1338 | &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) }, |
| 1339 | { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK, | 1339 | { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK, |
| 1340 | &rtl2832u_props, "NOXON DAB/DAB+ USB dongle", NULL) }, | 1340 | &rtl2832u_props, "NOXON DAB/DAB+ USB dongle", NULL) }, |
| 1341 | { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2, | ||
| 1342 | &rtl2832u_props, "NOXON DAB/DAB+ USB dongle (rev 2)", NULL) }, | ||
| 1341 | { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0, | 1343 | { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0, |
| 1342 | &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) }, | 1344 | &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) }, |
| 1343 | { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101, | 1345 | { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101, |
| @@ -1346,6 +1348,10 @@ static const struct usb_device_id rtl28xxu_id_table[] = { | |||
| 1346 | &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, | 1348 | &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, |
| 1347 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, | 1349 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, |
| 1348 | &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, | 1350 | &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, |
| 1351 | { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102, | ||
| 1352 | &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) }, | ||
| 1353 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7, | ||
| 1354 | &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) }, | ||
| 1349 | { } | 1355 | { } |
| 1350 | }; | 1356 | }; |
| 1351 | MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); | 1357 | MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); |
diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c index 5989b6590377..7346f85f3f2f 100644 --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c | |||
| @@ -112,7 +112,7 @@ int usb_urb_submitv2(struct usb_data_stream *stream, | |||
| 112 | return 0; | 112 | return 0; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | int usb_urb_free_urbs(struct usb_data_stream *stream) | 115 | static int usb_urb_free_urbs(struct usb_data_stream *stream) |
| 116 | { | 116 | { |
| 117 | int i; | 117 | int i; |
| 118 | 118 | ||
| @@ -205,7 +205,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) | |||
| 205 | return 0; | 205 | return 0; |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | int usb_free_stream_buffers(struct usb_data_stream *stream) | 208 | static int usb_free_stream_buffers(struct usb_data_stream *stream) |
| 209 | { | 209 | { |
| 210 | if (stream->state & USB_STATE_URB_BUF) { | 210 | if (stream->state & USB_STATE_URB_BUF) { |
| 211 | while (stream->buf_num) { | 211 | while (stream->buf_num) { |
| @@ -223,8 +223,8 @@ int usb_free_stream_buffers(struct usb_data_stream *stream) | |||
| 223 | return 0; | 223 | return 0; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num, | 226 | static int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num, |
| 227 | unsigned long size) | 227 | unsigned long size) |
| 228 | { | 228 | { |
| 229 | stream->buf_num = 0; | 229 | stream->buf_num = 0; |
| 230 | stream->buf_size = size; | 230 | stream->buf_size = size; |
diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c index 5e45ae605427..91e0119e8a87 100644 --- a/drivers/media/usb/dvb-usb/az6027.c +++ b/drivers/media/usb/dvb-usb/az6027.c | |||
| @@ -298,7 +298,8 @@ struct stb6100_config az6027_stb6100_config = { | |||
| 298 | 298 | ||
| 299 | 299 | ||
| 300 | /* check for mutex FIXME */ | 300 | /* check for mutex FIXME */ |
| 301 | int az6027_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | 301 | static int az6027_usb_in_op(struct dvb_usb_device *d, u8 req, |
| 302 | u16 value, u16 index, u8 *b, int blen) | ||
| 302 | { | 303 | { |
| 303 | int ret = -1; | 304 | int ret = -1; |
| 304 | if (mutex_lock_interruptible(&d->usb_mutex)) | 305 | if (mutex_lock_interruptible(&d->usb_mutex)) |
| @@ -1051,10 +1052,10 @@ static struct i2c_algorithm az6027_i2c_algo = { | |||
| 1051 | .functionality = az6027_i2c_func, | 1052 | .functionality = az6027_i2c_func, |
| 1052 | }; | 1053 | }; |
| 1053 | 1054 | ||
| 1054 | int az6027_identify_state(struct usb_device *udev, | 1055 | static int az6027_identify_state(struct usb_device *udev, |
| 1055 | struct dvb_usb_device_properties *props, | 1056 | struct dvb_usb_device_properties *props, |
| 1056 | struct dvb_usb_device_description **desc, | 1057 | struct dvb_usb_device_description **desc, |
| 1057 | int *cold) | 1058 | int *cold) |
| 1058 | { | 1059 | { |
| 1059 | u8 *b; | 1060 | u8 *b; |
| 1060 | s16 ret; | 1061 | s16 ret; |
diff --git a/drivers/media/usb/dvb-usb/dib0700.h b/drivers/media/usb/dvb-usb/dib0700.h index 7de125c0b36f..637b6123f391 100644 --- a/drivers/media/usb/dvb-usb/dib0700.h +++ b/drivers/media/usb/dvb-usb/dib0700.h | |||
| @@ -64,7 +64,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); | |||
| 64 | extern struct i2c_algorithm dib0700_i2c_algo; | 64 | extern struct i2c_algorithm dib0700_i2c_algo; |
| 65 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, | 65 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
| 66 | struct dvb_usb_device_description **desc, int *cold); | 66 | struct dvb_usb_device_description **desc, int *cold); |
| 67 | extern int dib0700_change_protocol(struct rc_dev *dev, u64 rc_type); | 67 | extern int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_type); |
| 68 | extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); | 68 | extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); |
| 69 | 69 | ||
| 70 | extern int dib0700_device_count; | 70 | extern int dib0700_device_count; |
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index ef87229de6af..19b5ed2825d7 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c | |||
| @@ -605,7 +605,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 605 | return ret; | 605 | return ret; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) | 608 | int dib0700_change_protocol(struct rc_dev *rc, u64 *rc_type) |
| 609 | { | 609 | { |
| 610 | struct dvb_usb_device *d = rc->priv; | 610 | struct dvb_usb_device *d = rc->priv; |
| 611 | struct dib0700_state *st = d->priv; | 611 | struct dib0700_state *st = d->priv; |
| @@ -621,17 +621,19 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
| 621 | st->buf[2] = 0; | 621 | st->buf[2] = 0; |
| 622 | 622 | ||
| 623 | /* Set the IR mode */ | 623 | /* Set the IR mode */ |
| 624 | if (rc_type == RC_TYPE_RC5) | 624 | if (*rc_type & RC_BIT_RC5) { |
| 625 | new_proto = 1; | 625 | new_proto = 1; |
| 626 | else if (rc_type == RC_TYPE_NEC) | 626 | *rc_type = RC_BIT_RC5; |
| 627 | } else if (*rc_type & RC_BIT_NEC) { | ||
| 627 | new_proto = 0; | 628 | new_proto = 0; |
| 628 | else if (rc_type == RC_TYPE_RC6) { | 629 | *rc_type = RC_BIT_NEC; |
| 630 | } else if (*rc_type & RC_BIT_RC6_MCE) { | ||
| 629 | if (st->fw_version < 0x10200) { | 631 | if (st->fw_version < 0x10200) { |
| 630 | ret = -EINVAL; | 632 | ret = -EINVAL; |
| 631 | goto out; | 633 | goto out; |
| 632 | } | 634 | } |
| 633 | |||
| 634 | new_proto = 2; | 635 | new_proto = 2; |
| 636 | *rc_type = RC_BIT_RC6_MCE; | ||
| 635 | } else { | 637 | } else { |
| 636 | ret = -EINVAL; | 638 | ret = -EINVAL; |
| 637 | goto out; | 639 | goto out; |
| @@ -645,7 +647,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
| 645 | goto out; | 647 | goto out; |
| 646 | } | 648 | } |
| 647 | 649 | ||
| 648 | d->props.rc.core.protocol = rc_type; | 650 | d->props.rc.core.protocol = *rc_type; |
| 649 | 651 | ||
| 650 | out: | 652 | out: |
| 651 | mutex_unlock(&d->usb_mutex); | 653 | mutex_unlock(&d->usb_mutex); |
| @@ -707,7 +709,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
| 707 | purb->actual_length); | 709 | purb->actual_length); |
| 708 | 710 | ||
| 709 | switch (d->props.rc.core.protocol) { | 711 | switch (d->props.rc.core.protocol) { |
| 710 | case RC_TYPE_NEC: | 712 | case RC_BIT_NEC: |
| 711 | toggle = 0; | 713 | toggle = 0; |
| 712 | 714 | ||
| 713 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 715 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 510001da6e83..11798426fa88 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c | |||
| @@ -518,7 +518,7 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) | |||
| 518 | 518 | ||
| 519 | d->last_event = 0; | 519 | d->last_event = 0; |
| 520 | switch (d->props.rc.core.protocol) { | 520 | switch (d->props.rc.core.protocol) { |
| 521 | case RC_TYPE_NEC: | 521 | case RC_BIT_NEC: |
| 522 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 522 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
| 523 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && | 523 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && |
| 524 | (key[3] == 0xff)) | 524 | (key[3] == 0xff)) |
| @@ -3658,9 +3658,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3658 | .rc_interval = DEFAULT_RC_INTERVAL, | 3658 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 3659 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3659 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3660 | .rc_query = dib0700_rc_query_old_firmware, | 3660 | .rc_query = dib0700_rc_query_old_firmware, |
| 3661 | .allowed_protos = RC_TYPE_RC5 | | 3661 | .allowed_protos = RC_BIT_RC5 | |
| 3662 | RC_TYPE_RC6 | | 3662 | RC_BIT_RC6_MCE | |
| 3663 | RC_TYPE_NEC, | 3663 | RC_BIT_NEC, |
| 3664 | .change_protocol = dib0700_change_protocol, | 3664 | .change_protocol = dib0700_change_protocol, |
| 3665 | }, | 3665 | }, |
| 3666 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3666 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3698,9 +3698,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3698 | .rc_interval = DEFAULT_RC_INTERVAL, | 3698 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 3699 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3699 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3700 | .rc_query = dib0700_rc_query_old_firmware, | 3700 | .rc_query = dib0700_rc_query_old_firmware, |
| 3701 | .allowed_protos = RC_TYPE_RC5 | | 3701 | .allowed_protos = RC_BIT_RC5 | |
| 3702 | RC_TYPE_RC6 | | 3702 | RC_BIT_RC6_MCE | |
| 3703 | RC_TYPE_NEC, | 3703 | RC_BIT_NEC, |
| 3704 | .change_protocol = dib0700_change_protocol, | 3704 | .change_protocol = dib0700_change_protocol, |
| 3705 | }, | 3705 | }, |
| 3706 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3706 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3763,9 +3763,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3763 | .rc_interval = DEFAULT_RC_INTERVAL, | 3763 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 3764 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3764 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3765 | .rc_query = dib0700_rc_query_old_firmware, | 3765 | .rc_query = dib0700_rc_query_old_firmware, |
| 3766 | .allowed_protos = RC_TYPE_RC5 | | 3766 | .allowed_protos = RC_BIT_RC5 | |
| 3767 | RC_TYPE_RC6 | | 3767 | RC_BIT_RC6_MCE | |
| 3768 | RC_TYPE_NEC, | 3768 | RC_BIT_NEC, |
| 3769 | .change_protocol = dib0700_change_protocol, | 3769 | .change_protocol = dib0700_change_protocol, |
| 3770 | }, | 3770 | }, |
| 3771 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3771 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3808,9 +3808,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3808 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3808 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3809 | .module_name = "dib0700", | 3809 | .module_name = "dib0700", |
| 3810 | .rc_query = dib0700_rc_query_old_firmware, | 3810 | .rc_query = dib0700_rc_query_old_firmware, |
| 3811 | .allowed_protos = RC_TYPE_RC5 | | 3811 | .allowed_protos = RC_BIT_RC5 | |
| 3812 | RC_TYPE_RC6 | | 3812 | RC_BIT_RC6_MCE | |
| 3813 | RC_TYPE_NEC, | 3813 | RC_BIT_NEC, |
| 3814 | .change_protocol = dib0700_change_protocol, | 3814 | .change_protocol = dib0700_change_protocol, |
| 3815 | }, | 3815 | }, |
| 3816 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3816 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3890,9 +3890,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3890 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3890 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3891 | .module_name = "dib0700", | 3891 | .module_name = "dib0700", |
| 3892 | .rc_query = dib0700_rc_query_old_firmware, | 3892 | .rc_query = dib0700_rc_query_old_firmware, |
| 3893 | .allowed_protos = RC_TYPE_RC5 | | 3893 | .allowed_protos = RC_BIT_RC5 | |
| 3894 | RC_TYPE_RC6 | | 3894 | RC_BIT_RC6_MCE | |
| 3895 | RC_TYPE_NEC, | 3895 | RC_BIT_NEC, |
| 3896 | .change_protocol = dib0700_change_protocol, | 3896 | .change_protocol = dib0700_change_protocol, |
| 3897 | }, | 3897 | }, |
| 3898 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3898 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3936,9 +3936,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3936 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3936 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3937 | .module_name = "dib0700", | 3937 | .module_name = "dib0700", |
| 3938 | .rc_query = dib0700_rc_query_old_firmware, | 3938 | .rc_query = dib0700_rc_query_old_firmware, |
| 3939 | .allowed_protos = RC_TYPE_RC5 | | 3939 | .allowed_protos = RC_BIT_RC5 | |
| 3940 | RC_TYPE_RC6 | | 3940 | RC_BIT_RC6_MCE | |
| 3941 | RC_TYPE_NEC, | 3941 | RC_BIT_NEC, |
| 3942 | .change_protocol = dib0700_change_protocol, | 3942 | .change_protocol = dib0700_change_protocol, |
| 3943 | }, | 3943 | }, |
| 3944 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3944 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -3987,9 +3987,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 3987 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 3987 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 3988 | .module_name = "dib0700", | 3988 | .module_name = "dib0700", |
| 3989 | .rc_query = dib0700_rc_query_old_firmware, | 3989 | .rc_query = dib0700_rc_query_old_firmware, |
| 3990 | .allowed_protos = RC_TYPE_RC5 | | 3990 | .allowed_protos = RC_BIT_RC5 | |
| 3991 | RC_TYPE_RC6 | | 3991 | RC_BIT_RC6_MCE | |
| 3992 | RC_TYPE_NEC, | 3992 | RC_BIT_NEC, |
| 3993 | .change_protocol = dib0700_change_protocol, | 3993 | .change_protocol = dib0700_change_protocol, |
| 3994 | }, | 3994 | }, |
| 3995 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 3995 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4055,9 +4055,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4055 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4055 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4056 | .module_name = "dib0700", | 4056 | .module_name = "dib0700", |
| 4057 | .rc_query = dib0700_rc_query_old_firmware, | 4057 | .rc_query = dib0700_rc_query_old_firmware, |
| 4058 | .allowed_protos = RC_TYPE_RC5 | | 4058 | .allowed_protos = RC_BIT_RC5 | |
| 4059 | RC_TYPE_RC6 | | 4059 | RC_BIT_RC6_MCE | |
| 4060 | RC_TYPE_NEC, | 4060 | RC_BIT_NEC, |
| 4061 | .change_protocol = dib0700_change_protocol, | 4061 | .change_protocol = dib0700_change_protocol, |
| 4062 | }, | 4062 | }, |
| 4063 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4063 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4106,9 +4106,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4106 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, | 4106 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
| 4107 | .module_name = "dib0700", | 4107 | .module_name = "dib0700", |
| 4108 | .rc_query = dib0700_rc_query_old_firmware, | 4108 | .rc_query = dib0700_rc_query_old_firmware, |
| 4109 | .allowed_protos = RC_TYPE_RC5 | | 4109 | .allowed_protos = RC_BIT_RC5 | |
| 4110 | RC_TYPE_RC6 | | 4110 | RC_BIT_RC6_MCE | |
| 4111 | RC_TYPE_NEC, | 4111 | RC_BIT_NEC, |
| 4112 | .change_protocol = dib0700_change_protocol, | 4112 | .change_protocol = dib0700_change_protocol, |
| 4113 | }, | 4113 | }, |
| 4114 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4114 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4177,9 +4177,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4177 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4177 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4178 | .module_name = "dib0700", | 4178 | .module_name = "dib0700", |
| 4179 | .rc_query = dib0700_rc_query_old_firmware, | 4179 | .rc_query = dib0700_rc_query_old_firmware, |
| 4180 | .allowed_protos = RC_TYPE_RC5 | | 4180 | .allowed_protos = RC_BIT_RC5 | |
| 4181 | RC_TYPE_RC6 | | 4181 | RC_BIT_RC6_MCE | |
| 4182 | RC_TYPE_NEC, | 4182 | RC_BIT_NEC, |
| 4183 | .change_protocol = dib0700_change_protocol, | 4183 | .change_protocol = dib0700_change_protocol, |
| 4184 | }, | 4184 | }, |
| 4185 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4185 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4215,9 +4215,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4215 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4215 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4216 | .module_name = "dib0700", | 4216 | .module_name = "dib0700", |
| 4217 | .rc_query = dib0700_rc_query_old_firmware, | 4217 | .rc_query = dib0700_rc_query_old_firmware, |
| 4218 | .allowed_protos = RC_TYPE_RC5 | | 4218 | .allowed_protos = RC_BIT_RC5 | |
| 4219 | RC_TYPE_RC6 | | 4219 | RC_BIT_RC6_MCE | |
| 4220 | RC_TYPE_NEC, | 4220 | RC_BIT_NEC, |
| 4221 | .change_protocol = dib0700_change_protocol, | 4221 | .change_protocol = dib0700_change_protocol, |
| 4222 | }, | 4222 | }, |
| 4223 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4223 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4295,9 +4295,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4295 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4295 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4296 | .module_name = "dib0700", | 4296 | .module_name = "dib0700", |
| 4297 | .rc_query = dib0700_rc_query_old_firmware, | 4297 | .rc_query = dib0700_rc_query_old_firmware, |
| 4298 | .allowed_protos = RC_TYPE_RC5 | | 4298 | .allowed_protos = RC_BIT_RC5 | |
| 4299 | RC_TYPE_RC6 | | 4299 | RC_BIT_RC6_MCE | |
| 4300 | RC_TYPE_NEC, | 4300 | RC_BIT_NEC, |
| 4301 | .change_protocol = dib0700_change_protocol, | 4301 | .change_protocol = dib0700_change_protocol, |
| 4302 | }, | 4302 | }, |
| 4303 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4303 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4341,9 +4341,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4341 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, | 4341 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
| 4342 | .module_name = "dib0700", | 4342 | .module_name = "dib0700", |
| 4343 | .rc_query = dib0700_rc_query_old_firmware, | 4343 | .rc_query = dib0700_rc_query_old_firmware, |
| 4344 | .allowed_protos = RC_TYPE_RC5 | | 4344 | .allowed_protos = RC_BIT_RC5 | |
| 4345 | RC_TYPE_RC6 | | 4345 | RC_BIT_RC6_MCE | |
| 4346 | RC_TYPE_NEC, | 4346 | RC_BIT_NEC, |
| 4347 | .change_protocol = dib0700_change_protocol, | 4347 | .change_protocol = dib0700_change_protocol, |
| 4348 | }, | 4348 | }, |
| 4349 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4349 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4394,9 +4394,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4394 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4394 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4395 | .module_name = "dib0700", | 4395 | .module_name = "dib0700", |
| 4396 | .rc_query = dib0700_rc_query_old_firmware, | 4396 | .rc_query = dib0700_rc_query_old_firmware, |
| 4397 | .allowed_protos = RC_TYPE_RC5 | | 4397 | .allowed_protos = RC_BIT_RC5 | |
| 4398 | RC_TYPE_RC6 | | 4398 | RC_BIT_RC6_MCE | |
| 4399 | RC_TYPE_NEC, | 4399 | RC_BIT_NEC, |
| 4400 | .change_protocol = dib0700_change_protocol, | 4400 | .change_protocol = dib0700_change_protocol, |
| 4401 | }, | 4401 | }, |
| 4402 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4402 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4433,9 +4433,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4433 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4433 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4434 | .module_name = "dib0700", | 4434 | .module_name = "dib0700", |
| 4435 | .rc_query = dib0700_rc_query_old_firmware, | 4435 | .rc_query = dib0700_rc_query_old_firmware, |
| 4436 | .allowed_protos = RC_TYPE_RC5 | | 4436 | .allowed_protos = RC_BIT_RC5 | |
| 4437 | RC_TYPE_RC6 | | 4437 | RC_BIT_RC6_MCE | |
| 4438 | RC_TYPE_NEC, | 4438 | RC_BIT_NEC, |
| 4439 | .change_protocol = dib0700_change_protocol, | 4439 | .change_protocol = dib0700_change_protocol, |
| 4440 | }, | 4440 | }, |
| 4441 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4441 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4472,9 +4472,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4472 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4472 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4473 | .module_name = "dib0700", | 4473 | .module_name = "dib0700", |
| 4474 | .rc_query = dib0700_rc_query_old_firmware, | 4474 | .rc_query = dib0700_rc_query_old_firmware, |
| 4475 | .allowed_protos = RC_TYPE_RC5 | | 4475 | .allowed_protos = RC_BIT_RC5 | |
| 4476 | RC_TYPE_RC6 | | 4476 | RC_BIT_RC6_MCE | |
| 4477 | RC_TYPE_NEC, | 4477 | RC_BIT_NEC, |
| 4478 | .change_protocol = dib0700_change_protocol, | 4478 | .change_protocol = dib0700_change_protocol, |
| 4479 | }, | 4479 | }, |
| 4480 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4480 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4511,9 +4511,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4511 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4511 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4512 | .module_name = "dib0700", | 4512 | .module_name = "dib0700", |
| 4513 | .rc_query = dib0700_rc_query_old_firmware, | 4513 | .rc_query = dib0700_rc_query_old_firmware, |
| 4514 | .allowed_protos = RC_TYPE_RC5 | | 4514 | .allowed_protos = RC_BIT_RC5 | |
| 4515 | RC_TYPE_RC6 | | 4515 | RC_BIT_RC6_MCE | |
| 4516 | RC_TYPE_NEC, | 4516 | RC_BIT_NEC, |
| 4517 | .change_protocol = dib0700_change_protocol, | 4517 | .change_protocol = dib0700_change_protocol, |
| 4518 | }, | 4518 | }, |
| 4519 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4519 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4550,9 +4550,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4550 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4550 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4551 | .module_name = "dib0700", | 4551 | .module_name = "dib0700", |
| 4552 | .rc_query = dib0700_rc_query_old_firmware, | 4552 | .rc_query = dib0700_rc_query_old_firmware, |
| 4553 | .allowed_protos = RC_TYPE_RC5 | | 4553 | .allowed_protos = RC_BIT_RC5 | |
| 4554 | RC_TYPE_RC6 | | 4554 | RC_BIT_RC6_MCE | |
| 4555 | RC_TYPE_NEC, | 4555 | RC_BIT_NEC, |
| 4556 | .change_protocol = dib0700_change_protocol, | 4556 | .change_protocol = dib0700_change_protocol, |
| 4557 | }, | 4557 | }, |
| 4558 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4558 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4589,9 +4589,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4589 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4589 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4590 | .module_name = "dib0700", | 4590 | .module_name = "dib0700", |
| 4591 | .rc_query = dib0700_rc_query_old_firmware, | 4591 | .rc_query = dib0700_rc_query_old_firmware, |
| 4592 | .allowed_protos = RC_TYPE_RC5 | | 4592 | .allowed_protos = RC_BIT_RC5 | |
| 4593 | RC_TYPE_RC6 | | 4593 | RC_BIT_RC6_MCE | |
| 4594 | RC_TYPE_NEC, | 4594 | RC_BIT_NEC, |
| 4595 | .change_protocol = dib0700_change_protocol, | 4595 | .change_protocol = dib0700_change_protocol, |
| 4596 | }, | 4596 | }, |
| 4597 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4597 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4644,9 +4644,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4644 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4644 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4645 | .module_name = "dib0700", | 4645 | .module_name = "dib0700", |
| 4646 | .rc_query = dib0700_rc_query_old_firmware, | 4646 | .rc_query = dib0700_rc_query_old_firmware, |
| 4647 | .allowed_protos = RC_TYPE_RC5 | | 4647 | .allowed_protos = RC_BIT_RC5 | |
| 4648 | RC_TYPE_RC6 | | 4648 | RC_BIT_RC6_MCE | |
| 4649 | RC_TYPE_NEC, | 4649 | RC_BIT_NEC, |
| 4650 | .change_protocol = dib0700_change_protocol, | 4650 | .change_protocol = dib0700_change_protocol, |
| 4651 | }, | 4651 | }, |
| 4652 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4652 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4681,9 +4681,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4681 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4681 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4682 | .module_name = "dib0700", | 4682 | .module_name = "dib0700", |
| 4683 | .rc_query = dib0700_rc_query_old_firmware, | 4683 | .rc_query = dib0700_rc_query_old_firmware, |
| 4684 | .allowed_protos = RC_TYPE_RC5 | | 4684 | .allowed_protos = RC_BIT_RC5 | |
| 4685 | RC_TYPE_RC6 | | 4685 | RC_BIT_RC6_MCE | |
| 4686 | RC_TYPE_NEC, | 4686 | RC_BIT_NEC, |
| 4687 | .change_protocol = dib0700_change_protocol, | 4687 | .change_protocol = dib0700_change_protocol, |
| 4688 | }, | 4688 | }, |
| 4689 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4689 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4721,9 +4721,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4721 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4721 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4722 | .module_name = "dib0700", | 4722 | .module_name = "dib0700", |
| 4723 | .rc_query = dib0700_rc_query_old_firmware, | 4723 | .rc_query = dib0700_rc_query_old_firmware, |
| 4724 | .allowed_protos = RC_TYPE_RC5 | | 4724 | .allowed_protos = RC_BIT_RC5 | |
| 4725 | RC_TYPE_RC6 | | 4725 | RC_BIT_RC6_MCE | |
| 4726 | RC_TYPE_NEC, | 4726 | RC_BIT_NEC, |
| 4727 | .change_protocol = dib0700_change_protocol, | 4727 | .change_protocol = dib0700_change_protocol, |
| 4728 | }, | 4728 | }, |
| 4729 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4729 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4761,9 +4761,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4761 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4761 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4762 | .module_name = "dib0700", | 4762 | .module_name = "dib0700", |
| 4763 | .rc_query = dib0700_rc_query_old_firmware, | 4763 | .rc_query = dib0700_rc_query_old_firmware, |
| 4764 | .allowed_protos = RC_TYPE_RC5 | | 4764 | .allowed_protos = RC_BIT_RC5 | |
| 4765 | RC_TYPE_RC6 | | 4765 | RC_BIT_RC6_MCE | |
| 4766 | RC_TYPE_NEC, | 4766 | RC_BIT_NEC, |
| 4767 | .change_protocol = dib0700_change_protocol, | 4767 | .change_protocol = dib0700_change_protocol, |
| 4768 | }, | 4768 | }, |
| 4769 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 4769 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| @@ -4802,9 +4802,9 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 4802 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 4802 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4803 | .module_name = "dib0700", | 4803 | .module_name = "dib0700", |
| 4804 | .rc_query = dib0700_rc_query_old_firmware, | 4804 | .rc_query = dib0700_rc_query_old_firmware, |
| 4805 | .allowed_protos = RC_TYPE_RC5 | | 4805 | .allowed_protos = RC_BIT_RC5 | |
| 4806 | RC_TYPE_RC6 | | 4806 | RC_BIT_RC6_MCE | |
| 4807 | RC_TYPE_NEC, | 4807 | RC_BIT_NEC, |
| 4808 | .change_protocol = dib0700_change_protocol, | 4808 | .change_protocol = dib0700_change_protocol, |
| 4809 | }, | 4809 | }, |
| 4810 | }, | 4810 | }, |
diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h index aab0f99bc892..ce4c4e3b58bb 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb.h +++ b/drivers/media/usb/dvb-usb/dvb-usb.h | |||
| @@ -202,7 +202,7 @@ struct dvb_rc { | |||
| 202 | u64 protocol; | 202 | u64 protocol; |
| 203 | u64 allowed_protos; | 203 | u64 allowed_protos; |
| 204 | enum rc_driver_type driver_type; | 204 | enum rc_driver_type driver_type; |
| 205 | int (*change_protocol)(struct rc_dev *dev, u64 rc_type); | 205 | int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); |
| 206 | char *module_name; | 206 | char *module_name; |
| 207 | int (*rc_query) (struct dvb_usb_device *d); | 207 | int (*rc_query) (struct dvb_usb_device *d); |
| 208 | int rc_interval; | 208 | int rc_interval; |
diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index 02e878577c3d..d1ddfa13de86 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c | |||
| @@ -927,7 +927,7 @@ static struct dvb_usb_device_properties pctv452e_properties = { | |||
| 927 | 927 | ||
| 928 | .rc.core = { | 928 | .rc.core = { |
| 929 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | 929 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 930 | .allowed_protos = RC_TYPE_UNKNOWN, | 930 | .allowed_protos = RC_BIT_UNKNOWN, |
| 931 | .rc_query = pctv452e_rc_query, | 931 | .rc_query = pctv452e_rc_query, |
| 932 | .rc_interval = 100, | 932 | .rc_interval = 100, |
| 933 | }, | 933 | }, |
| @@ -980,7 +980,7 @@ static struct dvb_usb_device_properties tt_connect_s2_3600_properties = { | |||
| 980 | 980 | ||
| 981 | .rc.core = { | 981 | .rc.core = { |
| 982 | .rc_codes = RC_MAP_TT_1500, | 982 | .rc_codes = RC_MAP_TT_1500, |
| 983 | .allowed_protos = RC_TYPE_UNKNOWN, | 983 | .allowed_protos = RC_BIT_UNKNOWN, |
| 984 | .rc_query = pctv452e_rc_query, | 984 | .rc_query = pctv452e_rc_query, |
| 985 | .rc_interval = 100, | 985 | .rc_interval = 100, |
| 986 | }, | 986 | }, |
diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 7a8c8c18590f..40832a1aef6c 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c | |||
| @@ -732,7 +732,7 @@ static struct dvb_usb_device_properties technisat_usb2_devices = { | |||
| 732 | .rc_codes = RC_MAP_TECHNISAT_USB2, | 732 | .rc_codes = RC_MAP_TECHNISAT_USB2, |
| 733 | .module_name = "technisat-usb2", | 733 | .module_name = "technisat-usb2", |
| 734 | .rc_query = technisat_usb2_rc_query, | 734 | .rc_query = technisat_usb2_rc_query, |
| 735 | .allowed_protos = RC_TYPE_ALL, | 735 | .allowed_protos = RC_BIT_ALL, |
| 736 | .driver_type = RC_DRIVER_IR_RAW, | 736 | .driver_type = RC_DRIVER_IR_RAW, |
| 737 | } | 737 | } |
| 738 | }; | 738 | }; |
diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c index 6a50cdea3bce..bcdac225ebe1 100644 --- a/drivers/media/usb/dvb-usb/ttusb2.c +++ b/drivers/media/usb/dvb-usb/ttusb2.c | |||
| @@ -741,7 +741,7 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = { | |||
| 741 | .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ | 741 | .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ |
| 742 | .rc_codes = RC_MAP_TT_1500, | 742 | .rc_codes = RC_MAP_TT_1500, |
| 743 | .rc_query = tt3650_rc_query, | 743 | .rc_query = tt3650_rc_query, |
| 744 | .allowed_protos = RC_TYPE_UNKNOWN, | 744 | .allowed_protos = RC_BIT_UNKNOWN, |
| 745 | }, | 745 | }, |
| 746 | 746 | ||
| 747 | .num_adapters = 1, | 747 | .num_adapters = 1, |
diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c index 07c673a6e764..22cf9f96cb9e 100644 --- a/drivers/media/usb/dvb-usb/vp702x.c +++ b/drivers/media/usb/dvb-usb/vp702x.c | |||
| @@ -56,7 +56,7 @@ static int vp702x_usb_in_op_unlocked(struct dvb_usb_device *d, u8 req, | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, | 58 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, |
| 59 | u16 index, u8 *b, int blen) | 59 | u16 index, u8 *b, int blen) |
| 60 | { | 60 | { |
| 61 | int ret; | 61 | int ret; |
| 62 | 62 | ||
| @@ -67,8 +67,8 @@ int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, | |||
| 67 | return ret; | 67 | return ret; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value, | 70 | static int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, |
| 71 | u16 index, u8 *b, int blen) | 71 | u16 value, u16 index, u8 *b, int blen) |
| 72 | { | 72 | { |
| 73 | int ret; | 73 | int ret; |
| 74 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); | 74 | deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); |
| @@ -86,7 +86,7 @@ int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value, | |||
| 86 | return 0; | 86 | return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, | 89 | static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, |
| 90 | u16 index, u8 *b, int blen) | 90 | u16 index, u8 *b, int blen) |
| 91 | { | 91 | { |
| 92 | int ret; | 92 | int ret; |
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 16a84f9f46d8..619bffbab3bc 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c | |||
| @@ -1979,6 +1979,15 @@ struct em28xx_board em28xx_boards[] = { | |||
| 1979 | EM28XX_I2C_CLK_WAIT_ENABLE | | 1979 | EM28XX_I2C_CLK_WAIT_ENABLE | |
| 1980 | EM28XX_I2C_FREQ_400_KHZ, | 1980 | EM28XX_I2C_FREQ_400_KHZ, |
| 1981 | }, | 1981 | }, |
| 1982 | [EM2884_BOARD_TERRATEC_HTC_USB_XS] = { | ||
| 1983 | .name = "Terratec Cinergy HTC USB XS", | ||
| 1984 | .has_dvb = 1, | ||
| 1985 | .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS, | ||
| 1986 | .tuner_type = TUNER_ABSENT, | ||
| 1987 | .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | | ||
| 1988 | EM28XX_I2C_CLK_WAIT_ENABLE | | ||
| 1989 | EM28XX_I2C_FREQ_400_KHZ, | ||
| 1990 | }, | ||
| 1982 | }; | 1991 | }; |
| 1983 | const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); | 1992 | const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); |
| 1984 | 1993 | ||
| @@ -2057,9 +2066,9 @@ struct usb_device_id em28xx_id_table[] = { | |||
| 2057 | { USB_DEVICE(0x0ccd, 0x0043), | 2066 | { USB_DEVICE(0x0ccd, 0x0043), |
| 2058 | .driver_info = EM2870_BOARD_TERRATEC_XS }, | 2067 | .driver_info = EM2870_BOARD_TERRATEC_XS }, |
| 2059 | { USB_DEVICE(0x0ccd, 0x008e), /* Cinergy HTC USB XS Rev. 1 */ | 2068 | { USB_DEVICE(0x0ccd, 0x008e), /* Cinergy HTC USB XS Rev. 1 */ |
| 2060 | .driver_info = EM2884_BOARD_TERRATEC_H5 }, | 2069 | .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS }, |
| 2061 | { USB_DEVICE(0x0ccd, 0x00ac), /* Cinergy HTC USB XS Rev. 2 */ | 2070 | { USB_DEVICE(0x0ccd, 0x00ac), /* Cinergy HTC USB XS Rev. 2 */ |
| 2062 | .driver_info = EM2884_BOARD_TERRATEC_H5 }, | 2071 | .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS }, |
| 2063 | { USB_DEVICE(0x0ccd, 0x10a2), /* H5 Rev. 1 */ | 2072 | { USB_DEVICE(0x0ccd, 0x10a2), /* H5 Rev. 1 */ |
| 2064 | .driver_info = EM2884_BOARD_TERRATEC_H5 }, | 2073 | .driver_info = EM2884_BOARD_TERRATEC_H5 }, |
| 2065 | { USB_DEVICE(0x0ccd, 0x10ad), /* H5 Rev. 2 */ | 2074 | { USB_DEVICE(0x0ccd, 0x10ad), /* H5 Rev. 2 */ |
| @@ -3297,7 +3306,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
| 3297 | 3306 | ||
| 3298 | dev->num_alt = interface->num_altsetting; | 3307 | dev->num_alt = interface->num_altsetting; |
| 3299 | 3308 | ||
| 3300 | if ((card[nr] >= 0) && (card[nr] < em28xx_bcount)) | 3309 | if ((unsigned)card[nr] < em28xx_bcount) |
| 3301 | dev->model = card[nr]; | 3310 | dev->model = card[nr]; |
| 3302 | 3311 | ||
| 3303 | /* save our data pointer in this interface device */ | 3312 | /* save our data pointer in this interface device */ |
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 13ae821949e9..63f2e7070c00 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c | |||
| @@ -331,7 +331,7 @@ static struct drxk_config hauppauge_930c_drxk = { | |||
| 331 | .load_firmware_sync = true, | 331 | .load_firmware_sync = true, |
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| 334 | struct drxk_config terratec_htc_stick_drxk = { | 334 | static struct drxk_config terratec_htc_stick_drxk = { |
| 335 | .adr = 0x29, | 335 | .adr = 0x29, |
| 336 | .single_master = 1, | 336 | .single_master = 1, |
| 337 | .no_i2c_bridge = 1, | 337 | .no_i2c_bridge = 1, |
| @@ -520,7 +520,10 @@ static void terratec_htc_stick_init(struct em28xx *dev) | |||
| 520 | { -1, -1, -1, -1}, | 520 | { -1, -1, -1, -1}, |
| 521 | }; | 521 | }; |
| 522 | 522 | ||
| 523 | /* Init the analog decoder? */ | 523 | /* |
| 524 | * Init the analog decoder (not yet supported), but | ||
| 525 | * it's probably still a good idea. | ||
| 526 | */ | ||
| 524 | struct { | 527 | struct { |
| 525 | unsigned char r[4]; | 528 | unsigned char r[4]; |
| 526 | int len; | 529 | int len; |
| @@ -547,6 +550,64 @@ static void terratec_htc_stick_init(struct em28xx *dev) | |||
| 547 | em28xx_gpio_set(dev, terratec_htc_stick_end); | 550 | em28xx_gpio_set(dev, terratec_htc_stick_end); |
| 548 | }; | 551 | }; |
| 549 | 552 | ||
| 553 | static void terratec_htc_usb_xs_init(struct em28xx *dev) | ||
| 554 | { | ||
| 555 | int i; | ||
| 556 | |||
| 557 | struct em28xx_reg_seq terratec_htc_usb_xs_init[] = { | ||
| 558 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, | ||
| 559 | {EM2874_R80_GPIO, 0xb2, 0xff, 100}, | ||
| 560 | {EM2874_R80_GPIO, 0xb2, 0xff, 50}, | ||
| 561 | {EM2874_R80_GPIO, 0xb6, 0xff, 100}, | ||
| 562 | { -1, -1, -1, -1}, | ||
| 563 | }; | ||
| 564 | struct em28xx_reg_seq terratec_htc_usb_xs_end[] = { | ||
| 565 | {EM2874_R80_GPIO, 0xa6, 0xff, 100}, | ||
| 566 | {EM2874_R80_GPIO, 0xa6, 0xff, 50}, | ||
| 567 | {EM2874_R80_GPIO, 0xe6, 0xff, 100}, | ||
| 568 | { -1, -1, -1, -1}, | ||
| 569 | }; | ||
| 570 | |||
| 571 | /* | ||
| 572 | * Init the analog decoder (not yet supported), but | ||
| 573 | * it's probably still a good idea. | ||
| 574 | */ | ||
| 575 | struct { | ||
| 576 | unsigned char r[4]; | ||
| 577 | int len; | ||
| 578 | } regs[] = { | ||
| 579 | {{ 0x06, 0x02, 0x00, 0x31 }, 4}, | ||
| 580 | {{ 0x01, 0x02 }, 2}, | ||
| 581 | {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, | ||
| 582 | {{ 0x01, 0x00 }, 2}, | ||
| 583 | {{ 0x01, 0x00, 0xff, 0xaf }, 4}, | ||
| 584 | {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, | ||
| 585 | {{ 0x01, 0x00 }, 2}, | ||
| 586 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, | ||
| 587 | {{ 0x04, 0x00 }, 2}, | ||
| 588 | {{ 0x00, 0x04 }, 2}, | ||
| 589 | {{ 0x00, 0x04, 0x00, 0x0a }, 4}, | ||
| 590 | {{ 0x04, 0x14 }, 2}, | ||
| 591 | {{ 0x04, 0x14, 0x00, 0x00 }, 4}, | ||
| 592 | }; | ||
| 593 | |||
| 594 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); | ||
| 595 | |||
| 596 | em28xx_gpio_set(dev, terratec_htc_usb_xs_init); | ||
| 597 | |||
| 598 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40); | ||
| 599 | msleep(10); | ||
| 600 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); | ||
| 601 | msleep(10); | ||
| 602 | |||
| 603 | dev->i2c_client.addr = 0x82 >> 1; | ||
| 604 | |||
| 605 | for (i = 0; i < ARRAY_SIZE(regs); i++) | ||
| 606 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | ||
| 607 | |||
| 608 | em28xx_gpio_set(dev, terratec_htc_usb_xs_end); | ||
| 609 | }; | ||
| 610 | |||
| 550 | static void pctv_520e_init(struct em28xx *dev) | 611 | static void pctv_520e_init(struct em28xx *dev) |
| 551 | { | 612 | { |
| 552 | /* | 613 | /* |
| @@ -1155,6 +1216,25 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
| 1155 | goto out_free; | 1216 | goto out_free; |
| 1156 | } | 1217 | } |
| 1157 | break; | 1218 | break; |
| 1219 | case EM2884_BOARD_TERRATEC_HTC_USB_XS: | ||
| 1220 | terratec_htc_usb_xs_init(dev); | ||
| 1221 | |||
| 1222 | /* attach demodulator */ | ||
| 1223 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, | ||
| 1224 | &dev->i2c_adap); | ||
| 1225 | if (!dvb->fe[0]) { | ||
| 1226 | result = -EINVAL; | ||
| 1227 | goto out_free; | ||
| 1228 | } | ||
| 1229 | |||
| 1230 | /* Attach the demodulator. */ | ||
| 1231 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | ||
| 1232 | &dev->i2c_adap, | ||
| 1233 | &em28xx_cxd2820r_tda18271_config)) { | ||
| 1234 | result = -EINVAL; | ||
| 1235 | goto out_free; | ||
| 1236 | } | ||
| 1237 | break; | ||
| 1158 | default: | 1238 | default: |
| 1159 | em28xx_errdev("/2: The frontend of your DVB/ATSC card" | 1239 | em28xx_errdev("/2: The frontend of your DVB/ATSC card" |
| 1160 | " isn't supported yet\n"); | 1240 | " isn't supported yet\n"); |
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 97d36b4f19db..660bf803c9e4 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c | |||
| @@ -345,7 +345,7 @@ static void em28xx_ir_stop(struct rc_dev *rc) | |||
| 345 | cancel_delayed_work_sync(&ir->work); | 345 | cancel_delayed_work_sync(&ir->work); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) | 348 | static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type) |
| 349 | { | 349 | { |
| 350 | int rc = 0; | 350 | int rc = 0; |
| 351 | struct em28xx_IR *ir = rc_dev->priv; | 351 | struct em28xx_IR *ir = rc_dev->priv; |
| @@ -354,14 +354,16 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) | |||
| 354 | 354 | ||
| 355 | /* Adjust xclk based o IR table for RC5/NEC tables */ | 355 | /* Adjust xclk based o IR table for RC5/NEC tables */ |
| 356 | 356 | ||
| 357 | if (rc_type == RC_TYPE_RC5) { | 357 | if (*rc_type & RC_BIT_RC5) { |
| 358 | dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; | 358 | dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; |
| 359 | ir->full_code = 1; | 359 | ir->full_code = 1; |
| 360 | } else if (rc_type == RC_TYPE_NEC) { | 360 | *rc_type = RC_BIT_RC5; |
| 361 | } else if (*rc_type & RC_BIT_NEC) { | ||
| 361 | dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; | 362 | dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; |
| 362 | ir_config = EM2874_IR_NEC; | 363 | ir_config = EM2874_IR_NEC; |
| 363 | ir->full_code = 1; | 364 | ir->full_code = 1; |
| 364 | } else if (rc_type != RC_TYPE_UNKNOWN) | 365 | *rc_type = RC_BIT_NEC; |
| 366 | } else if (*rc_type != RC_BIT_UNKNOWN) | ||
| 365 | rc = -EINVAL; | 367 | rc = -EINVAL; |
| 366 | 368 | ||
| 367 | em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, | 369 | em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, |
| @@ -524,6 +526,7 @@ static int em28xx_ir_init(struct em28xx *dev) | |||
| 524 | struct em28xx_IR *ir; | 526 | struct em28xx_IR *ir; |
| 525 | struct rc_dev *rc; | 527 | struct rc_dev *rc; |
| 526 | int err = -ENOMEM; | 528 | int err = -ENOMEM; |
| 529 | u64 rc_type; | ||
| 527 | 530 | ||
| 528 | if (dev->board.ir_codes == NULL) { | 531 | if (dev->board.ir_codes == NULL) { |
| 529 | /* No remote control support */ | 532 | /* No remote control support */ |
| @@ -546,14 +549,15 @@ static int em28xx_ir_init(struct em28xx *dev) | |||
| 546 | * em2874 supports more protocols. For now, let's just announce | 549 | * em2874 supports more protocols. For now, let's just announce |
| 547 | * the two protocols that were already tested | 550 | * the two protocols that were already tested |
| 548 | */ | 551 | */ |
| 549 | rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; | 552 | rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC; |
| 550 | rc->priv = ir; | 553 | rc->priv = ir; |
| 551 | rc->change_protocol = em28xx_ir_change_protocol; | 554 | rc->change_protocol = em28xx_ir_change_protocol; |
| 552 | rc->open = em28xx_ir_start; | 555 | rc->open = em28xx_ir_start; |
| 553 | rc->close = em28xx_ir_stop; | 556 | rc->close = em28xx_ir_stop; |
| 554 | 557 | ||
| 555 | /* By default, keep protocol field untouched */ | 558 | /* By default, keep protocol field untouched */ |
| 556 | err = em28xx_ir_change_protocol(rc, RC_TYPE_UNKNOWN); | 559 | rc_type = RC_BIT_UNKNOWN; |
| 560 | err = em28xx_ir_change_protocol(rc, &rc_type); | ||
| 557 | if (err) | 561 | if (err) |
| 558 | goto err_out_free; | 562 | goto err_out_free; |
| 559 | 563 | ||
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 8757523e6863..86e90d86da6d 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h | |||
| @@ -128,6 +128,7 @@ | |||
| 128 | #define EM2874_BOARD_MAXMEDIA_UB425_TC 84 | 128 | #define EM2874_BOARD_MAXMEDIA_UB425_TC 84 |
| 129 | #define EM2884_BOARD_PCTV_510E 85 | 129 | #define EM2884_BOARD_PCTV_510E 85 |
| 130 | #define EM2884_BOARD_PCTV_520E 86 | 130 | #define EM2884_BOARD_PCTV_520E 86 |
| 131 | #define EM2884_BOARD_TERRATEC_HTC_USB_XS 87 | ||
| 131 | 132 | ||
| 132 | /* Limits minimum and default number of buffers */ | 133 | /* Limits minimum and default number of buffers */ |
| 133 | #define EM28XX_MIN_BUF 4 | 134 | #define EM28XX_MIN_BUF 4 |
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index a2b934146ebf..e0a431bb0d42 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c | |||
| @@ -1586,8 +1586,7 @@ static int vidioc_querybuf(struct file *file, void *priv, | |||
| 1586 | struct gspca_dev *gspca_dev = video_drvdata(file); | 1586 | struct gspca_dev *gspca_dev = video_drvdata(file); |
| 1587 | struct gspca_frame *frame; | 1587 | struct gspca_frame *frame; |
| 1588 | 1588 | ||
| 1589 | if (v4l2_buf->index < 0 | 1589 | if (v4l2_buf->index >= gspca_dev->nframes) |
| 1590 | || v4l2_buf->index >= gspca_dev->nframes) | ||
| 1591 | return -EINVAL; | 1590 | return -EINVAL; |
| 1592 | 1591 | ||
| 1593 | frame = &gspca_dev->frame[v4l2_buf->index]; | 1592 | frame = &gspca_dev->frame[v4l2_buf->index]; |
diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h index e3eab82cd4e5..352317d7acdb 100644 --- a/drivers/media/usb/gspca/gspca.h +++ b/drivers/media/usb/gspca/gspca.h | |||
| @@ -32,7 +32,7 @@ do { \ | |||
| 32 | #define D_USBO 0x00 | 32 | #define D_USBO 0x00 |
| 33 | #define D_V4L2 0x0100 | 33 | #define D_V4L2 0x0100 |
| 34 | #else | 34 | #else |
| 35 | #define PDEBUG(level, fmt, ...) | 35 | #define PDEBUG(level, fmt, ...) do {} while(0) |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | #define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */ | 38 | #define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */ |
diff --git a/drivers/media/usb/gspca/jeilinj.c b/drivers/media/usb/gspca/jeilinj.c index b897aa86f315..1ba29fe7fada 100644 --- a/drivers/media/usb/gspca/jeilinj.c +++ b/drivers/media/usb/gspca/jeilinj.c | |||
| @@ -114,7 +114,7 @@ static void jlj_write2(struct gspca_dev *gspca_dev, unsigned char *command) | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /* Responses are one byte only */ | 116 | /* Responses are one byte only */ |
| 117 | static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char response) | 117 | static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char *response) |
| 118 | { | 118 | { |
| 119 | int retval; | 119 | int retval; |
| 120 | 120 | ||
| @@ -123,7 +123,7 @@ static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char response) | |||
| 123 | retval = usb_bulk_msg(gspca_dev->dev, | 123 | retval = usb_bulk_msg(gspca_dev->dev, |
| 124 | usb_rcvbulkpipe(gspca_dev->dev, 0x84), | 124 | usb_rcvbulkpipe(gspca_dev->dev, 0x84), |
| 125 | gspca_dev->usb_buf, 1, NULL, 500); | 125 | gspca_dev->usb_buf, 1, NULL, 500); |
| 126 | response = gspca_dev->usb_buf[0]; | 126 | *response = gspca_dev->usb_buf[0]; |
| 127 | if (retval < 0) { | 127 | if (retval < 0) { |
| 128 | pr_err("read command [%02x] error %d\n", | 128 | pr_err("read command [%02x] error %d\n", |
| 129 | gspca_dev->usb_buf[0], retval); | 129 | gspca_dev->usb_buf[0], retval); |
| @@ -260,7 +260,7 @@ static int jlj_start(struct gspca_dev *gspca_dev) | |||
| 260 | if (start_commands[i].delay) | 260 | if (start_commands[i].delay) |
| 261 | msleep(start_commands[i].delay); | 261 | msleep(start_commands[i].delay); |
| 262 | if (start_commands[i].ack_wanted) | 262 | if (start_commands[i].ack_wanted) |
| 263 | jlj_read1(gspca_dev, response); | 263 | jlj_read1(gspca_dev, &response); |
| 264 | } | 264 | } |
| 265 | setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual)); | 265 | setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual)); |
| 266 | msleep(2); | 266 | msleep(2); |
diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c index cc8ec3f7e8dc..c8e1572eb502 100644 --- a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c +++ b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c | |||
| @@ -74,6 +74,12 @@ static | |||
| 74 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 2548") | 74 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 2548") |
| 75 | } | 75 | } |
| 76 | }, { | 76 | }, { |
| 77 | .ident = "Fujitsu-Siemens Amilo Pi 2530", | ||
| 78 | .matches = { | ||
| 79 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
| 80 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 2530") | ||
| 81 | } | ||
| 82 | }, { | ||
| 77 | .ident = "MSI GX700", | 83 | .ident = "MSI GX700", |
| 78 | .matches = { | 84 | .matches = { |
| 79 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | 85 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), |
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c index 2d5c6d8343a0..4f5869a98082 100644 --- a/drivers/media/usb/gspca/pac7302.c +++ b/drivers/media/usb/gspca/pac7302.c | |||
| @@ -29,14 +29,13 @@ | |||
| 29 | * Register page 0: | 29 | * Register page 0: |
| 30 | * | 30 | * |
| 31 | * Address Description | 31 | * Address Description |
| 32 | * 0x02 Red balance control | 32 | * 0x01 Red balance control |
| 33 | * 0x03 Green balance control | 33 | * 0x02 Green balance control |
| 34 | * 0x04 Blue balance control | 34 | * 0x03 Blue balance control |
| 35 | * Valus are inverted (0=max, 255=min). | ||
| 36 | * The Windows driver uses a quadratic approach to map | 35 | * The Windows driver uses a quadratic approach to map |
| 37 | * the settable values (0-200) on register values: | 36 | * the settable values (0-200) on register values: |
| 38 | * min=0x80, default=0x40, max=0x20 | 37 | * min=0x20, default=0x40, max=0x80 |
| 39 | * 0x0f-0x20 Colors, saturation and exposure control | 38 | * 0x0f-0x20 Color and saturation control |
| 40 | * 0xa2-0xab Brightness, contrast and gamma control | 39 | * 0xa2-0xab Brightness, contrast and gamma control |
| 41 | * 0xb6 Sharpness control (bits 0-4) | 40 | * 0xb6 Sharpness control (bits 0-4) |
| 42 | * | 41 | * |
| @@ -78,12 +77,12 @@ | |||
| 78 | * | 77 | * |
| 79 | * Page | Register | Function | 78 | * Page | Register | Function |
| 80 | * -----+------------+--------------------------------------------------- | 79 | * -----+------------+--------------------------------------------------- |
| 80 | * 0 | 0x01 | setredbalance() | ||
| 81 | * 0 | 0x03 | setbluebalance() | ||
| 81 | * 0 | 0x0f..0x20 | setcolors() | 82 | * 0 | 0x0f..0x20 | setcolors() |
| 82 | * 0 | 0xa2..0xab | setbrightcont() | 83 | * 0 | 0xa2..0xab | setbrightcont() |
| 83 | * 0 | 0xb6 | setsharpness() | 84 | * 0 | 0xb6 | setsharpness() |
| 84 | * 0 | 0xc5 | setredbalance() | ||
| 85 | * 0 | 0xc6 | setwhitebalance() | 85 | * 0 | 0xc6 | setwhitebalance() |
| 86 | * 0 | 0xc7 | setbluebalance() | ||
| 87 | * 0 | 0xdc | setbrightcont(), setcolors() | 86 | * 0 | 0xdc | setbrightcont(), setcolors() |
| 88 | * 3 | 0x02 | setexposure() | 87 | * 3 | 0x02 | setexposure() |
| 89 | * 3 | 0x10, 0x12 | setgain() | 88 | * 3 | 0x10, 0x12 | setgain() |
| @@ -99,10 +98,13 @@ | |||
| 99 | /* Include pac common sof detection functions */ | 98 | /* Include pac common sof detection functions */ |
| 100 | #include "pac_common.h" | 99 | #include "pac_common.h" |
| 101 | 100 | ||
| 102 | #define PAC7302_GAIN_DEFAULT 15 | 101 | #define PAC7302_RGB_BALANCE_MIN 0 |
| 103 | #define PAC7302_GAIN_KNEE 42 | 102 | #define PAC7302_RGB_BALANCE_MAX 200 |
| 104 | #define PAC7302_EXPOSURE_DEFAULT 66 /* 33 ms / 30 fps */ | 103 | #define PAC7302_RGB_BALANCE_DEFAULT 100 |
| 105 | #define PAC7302_EXPOSURE_KNEE 133 /* 66 ms / 15 fps */ | 104 | #define PAC7302_GAIN_DEFAULT 15 |
| 105 | #define PAC7302_GAIN_KNEE 42 | ||
| 106 | #define PAC7302_EXPOSURE_DEFAULT 66 /* 33 ms / 30 fps */ | ||
| 107 | #define PAC7302_EXPOSURE_KNEE 133 /* 66 ms / 15 fps */ | ||
| 106 | 108 | ||
| 107 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, " | 109 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, " |
| 108 | "Thomas Kaiser thomas@kaiser-linux.li"); | 110 | "Thomas Kaiser thomas@kaiser-linux.li"); |
| @@ -439,12 +441,31 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) | |||
| 439 | reg_w(gspca_dev, 0xdc, 0x01); | 441 | reg_w(gspca_dev, 0xdc, 0x01); |
| 440 | } | 442 | } |
| 441 | 443 | ||
| 444 | static u8 rgbbalance_ctrl_to_reg_value(s32 rgb_ctrl_val) | ||
| 445 | { | ||
| 446 | const unsigned int k = 1000; /* precision factor */ | ||
| 447 | unsigned int norm; | ||
| 448 | |||
| 449 | /* Normed value [0...k] */ | ||
| 450 | norm = k * (rgb_ctrl_val - PAC7302_RGB_BALANCE_MIN) | ||
| 451 | / (PAC7302_RGB_BALANCE_MAX - PAC7302_RGB_BALANCE_MIN); | ||
| 452 | /* Qudratic apporach improves control at small (register) values: */ | ||
| 453 | return 64 * norm * norm / (k*k) + 32 * norm / k + 32; | ||
| 454 | /* Y = 64*X*X + 32*X + 32 | ||
| 455 | * => register values 0x20-0x80; Windows driver uses these limits */ | ||
| 456 | |||
| 457 | /* NOTE: for full value range (0x00-0xff) use | ||
| 458 | * Y = 254*X*X + X | ||
| 459 | * => 254 * norm * norm / (k*k) + 1 * norm / k */ | ||
| 460 | } | ||
| 461 | |||
| 442 | static void setredbalance(struct gspca_dev *gspca_dev) | 462 | static void setredbalance(struct gspca_dev *gspca_dev) |
| 443 | { | 463 | { |
| 444 | struct sd *sd = (struct sd *) gspca_dev; | 464 | struct sd *sd = (struct sd *) gspca_dev; |
| 445 | 465 | ||
| 446 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ | 466 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ |
| 447 | reg_w(gspca_dev, 0xc5, sd->red_balance->val); | 467 | reg_w(gspca_dev, 0x01, |
| 468 | rgbbalance_ctrl_to_reg_value(sd->red_balance->val)); | ||
| 448 | 469 | ||
| 449 | reg_w(gspca_dev, 0xdc, 0x01); | 470 | reg_w(gspca_dev, 0xdc, 0x01); |
| 450 | } | 471 | } |
| @@ -454,7 +475,8 @@ static void setbluebalance(struct gspca_dev *gspca_dev) | |||
| 454 | struct sd *sd = (struct sd *) gspca_dev; | 475 | struct sd *sd = (struct sd *) gspca_dev; |
| 455 | 476 | ||
| 456 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ | 477 | reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ |
| 457 | reg_w(gspca_dev, 0xc7, sd->blue_balance->val); | 478 | reg_w(gspca_dev, 0x03, |
| 479 | rgbbalance_ctrl_to_reg_value(sd->blue_balance->val)); | ||
| 458 | 480 | ||
| 459 | reg_w(gspca_dev, 0xdc, 0x01); | 481 | reg_w(gspca_dev, 0xdc, 0x01); |
| 460 | } | 482 | } |
| @@ -643,9 +665,15 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 643 | V4L2_CID_WHITE_BALANCE_TEMPERATURE, | 665 | V4L2_CID_WHITE_BALANCE_TEMPERATURE, |
| 644 | 0, 255, 1, 55); | 666 | 0, 255, 1, 55); |
| 645 | sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 667 | sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 646 | V4L2_CID_RED_BALANCE, 0, 3, 1, 1); | 668 | V4L2_CID_RED_BALANCE, |
| 669 | PAC7302_RGB_BALANCE_MIN, | ||
| 670 | PAC7302_RGB_BALANCE_MAX, | ||
| 671 | 1, PAC7302_RGB_BALANCE_DEFAULT); | ||
| 647 | sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 672 | sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 648 | V4L2_CID_BLUE_BALANCE, 0, 3, 1, 1); | 673 | V4L2_CID_BLUE_BALANCE, |
| 674 | PAC7302_RGB_BALANCE_MIN, | ||
| 675 | PAC7302_RGB_BALANCE_MAX, | ||
| 676 | 1, PAC7302_RGB_BALANCE_DEFAULT); | ||
| 649 | 677 | ||
| 650 | gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 678 | gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 651 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); | 679 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); |
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c index fd1f8d2d3b0b..70511d5f9538 100644 --- a/drivers/media/usb/gspca/sonixb.c +++ b/drivers/media/usb/gspca/sonixb.c | |||
| @@ -1449,6 +1449,7 @@ static const struct usb_device_id device_table[] = { | |||
| 1449 | {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, | 1449 | {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, |
| 1450 | {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, | 1450 | {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, |
| 1451 | #endif | 1451 | #endif |
| 1452 | {USB_DEVICE(0x0c45, 0x6027), SB(OV7630, 101)}, /* Genius Eye 310 */ | ||
| 1452 | {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, | 1453 | {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, |
| 1453 | {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, | 1454 | {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, |
| 1454 | {USB_DEVICE(0x0c45, 0x602a), SB(HV7131D, 102)}, | 1455 | {USB_DEVICE(0x0c45, 0x602a), SB(HV7131D, 102)}, |
diff --git a/drivers/media/usb/gspca/spca506.c b/drivers/media/usb/gspca/spca506.c index bab01c86c315..bcd2c04c770e 100644 --- a/drivers/media/usb/gspca/spca506.c +++ b/drivers/media/usb/gspca/spca506.c | |||
| @@ -590,8 +590,7 @@ static const struct usb_device_id device_table[] = { | |||
| 590 | MODULE_DEVICE_TABLE(usb, device_table); | 590 | MODULE_DEVICE_TABLE(usb, device_table); |
| 591 | 591 | ||
| 592 | /* -- device connect -- */ | 592 | /* -- device connect -- */ |
| 593 | static int __devinit sd_probe(struct usb_interface *intf, | 593 | static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id) |
| 594 | const struct usb_device_id *id) | ||
| 595 | { | 594 | { |
| 596 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 595 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
| 597 | THIS_MODULE); | 596 | THIS_MODULE); |
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index 304f43ef59eb..84dc26fe80ee 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c | |||
| @@ -401,12 +401,14 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
| 401 | client = hdpvr_register_ir_rx_i2c(dev); | 401 | client = hdpvr_register_ir_rx_i2c(dev); |
| 402 | if (!client) { | 402 | if (!client) { |
| 403 | v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); | 403 | v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); |
| 404 | retval = -ENODEV; | ||
| 404 | goto reg_fail; | 405 | goto reg_fail; |
| 405 | } | 406 | } |
| 406 | 407 | ||
| 407 | client = hdpvr_register_ir_tx_i2c(dev); | 408 | client = hdpvr_register_ir_tx_i2c(dev); |
| 408 | if (!client) { | 409 | if (!client) { |
| 409 | v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); | 410 | v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); |
| 411 | retval = -ENODEV; | ||
| 410 | goto reg_fail; | 412 | goto reg_fail; |
| 411 | } | 413 | } |
| 412 | #endif | 414 | #endif |
diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index 82e819fa91c0..031cf024304c 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c | |||
| @@ -55,7 +55,7 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) | |||
| 55 | /* Our default information for ir-kbd-i2c.c to use */ | 55 | /* Our default information for ir-kbd-i2c.c to use */ |
| 56 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 56 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 57 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 57 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
| 58 | init_data->type = RC_TYPE_RC5; | 58 | init_data->type = RC_BIT_RC5; |
| 59 | init_data->name = "HD-PVR"; | 59 | init_data->name = "HD-PVR"; |
| 60 | init_data->polling_interval = 405; /* ms, duplicated from Windows */ | 60 | init_data->polling_interval = 405; /* ms, duplicated from Windows */ |
| 61 | hdpvr_ir_rx_i2c_board_info.platform_data = init_data; | 61 | hdpvr_ir_rx_i2c_board_info.platform_data = init_data; |
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index fb828ba1dbbe..299751a8b06b 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c | |||
| @@ -3563,9 +3563,9 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw, | |||
| 3563 | enum pvr2_v4l_type index,int v) | 3563 | enum pvr2_v4l_type index,int v) |
| 3564 | { | 3564 | { |
| 3565 | switch (index) { | 3565 | switch (index) { |
| 3566 | case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v; | 3566 | case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v;break; |
| 3567 | case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v; | 3567 | case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v;break; |
| 3568 | case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v; | 3568 | case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v;break; |
| 3569 | default: break; | 3569 | default: break; |
| 3570 | } | 3570 | } |
| 3571 | } | 3571 | } |
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 885ce11f222d..9ab596c78a4e 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | |||
| @@ -581,7 +581,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) | |||
| 581 | case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */ | 581 | case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */ |
| 582 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 582 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 583 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; | 583 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; |
| 584 | init_data->type = RC_TYPE_RC5; | 584 | init_data->type = RC_BIT_RC5; |
| 585 | init_data->name = hdw->hdw_desc->description; | 585 | init_data->name = hdw->hdw_desc->description; |
| 586 | init_data->polling_interval = 100; /* ms From ir-kbd-i2c */ | 586 | init_data->polling_interval = 100; /* ms From ir-kbd-i2c */ |
| 587 | /* IR Receiver */ | 587 | /* IR Receiver */ |
| @@ -596,7 +596,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) | |||
| 596 | case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ | 596 | case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ |
| 597 | init_data->ir_codes = RC_MAP_HAUPPAUGE; | 597 | init_data->ir_codes = RC_MAP_HAUPPAUGE; |
| 598 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 598 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
| 599 | init_data->type = RC_TYPE_RC5; | 599 | init_data->type = RC_BIT_RC5; |
| 600 | init_data->name = hdw->hdw_desc->description; | 600 | init_data->name = hdw->hdw_desc->description; |
| 601 | /* IR Receiver */ | 601 | /* IR Receiver */ |
| 602 | info.addr = 0x71; | 602 | info.addr = 0x71; |
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index db249cad3cd9..6930676051e7 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | |||
| @@ -196,7 +196,7 @@ static int pvr2_g_std(struct file *file, void *priv, v4l2_std_id *std) | |||
| 196 | return ret; | 196 | return ret; |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | int pvr2_s_std(struct file *file, void *priv, v4l2_std_id *std) | 199 | static int pvr2_s_std(struct file *file, void *priv, v4l2_std_id *std) |
| 200 | { | 200 | { |
| 201 | struct pvr2_v4l2_fh *fh = file->private_data; | 201 | struct pvr2_v4l2_fh *fh = file->private_data; |
| 202 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; | 202 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; |
| @@ -365,7 +365,7 @@ static int pvr2_s_tuner(struct file *file, void *priv, struct v4l2_tuner *vt) | |||
| 365 | vt->audmode); | 365 | vt->audmode); |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | int pvr2_s_frequency(struct file *file, void *priv, struct v4l2_frequency *vf) | 368 | static int pvr2_s_frequency(struct file *file, void *priv, struct v4l2_frequency *vf) |
| 369 | { | 369 | { |
| 370 | struct pvr2_v4l2_fh *fh = file->private_data; | 370 | struct pvr2_v4l2_fh *fh = file->private_data; |
| 371 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; | 371 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; |
diff --git a/drivers/media/usb/pwc/pwc-ctrl.c b/drivers/media/usb/pwc/pwc-ctrl.c index 1f506fde97d0..3a1618580ed6 100644 --- a/drivers/media/usb/pwc/pwc-ctrl.c +++ b/drivers/media/usb/pwc/pwc-ctrl.c | |||
| @@ -179,6 +179,8 @@ static int set_video_mode_Nala(struct pwc_device *pdev, int size, int pixfmt, | |||
| 179 | return -EINVAL; | 179 | return -EINVAL; |
| 180 | if (frames < 4) | 180 | if (frames < 4) |
| 181 | frames = 4; | 181 | frames = 4; |
| 182 | else if (size > PSZ_QCIF && frames > 15) | ||
| 183 | frames = 15; | ||
| 182 | else if (frames > 25) | 184 | else if (frames > 25) |
| 183 | frames = 25; | 185 | frames = 25; |
| 184 | frames = frames2frames[frames]; | 186 | frames = frames2frames[frames]; |
diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 42e36bac4d72..5210239cbaee 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c | |||
| @@ -155,7 +155,7 @@ static struct video_device pwc_template = { | |||
| 155 | /***************************************************************************/ | 155 | /***************************************************************************/ |
| 156 | /* Private functions */ | 156 | /* Private functions */ |
| 157 | 157 | ||
| 158 | struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev) | 158 | static struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev) |
| 159 | { | 159 | { |
| 160 | unsigned long flags = 0; | 160 | unsigned long flags = 0; |
| 161 | struct pwc_frame_buf *buf = NULL; | 161 | struct pwc_frame_buf *buf = NULL; |
| @@ -1000,7 +1000,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
| 1000 | pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf); | 1000 | pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf); |
| 1001 | pdev->vb_queue.ops = &pwc_vb_queue_ops; | 1001 | pdev->vb_queue.ops = &pwc_vb_queue_ops; |
| 1002 | pdev->vb_queue.mem_ops = &vb2_vmalloc_memops; | 1002 | pdev->vb_queue.mem_ops = &vb2_vmalloc_memops; |
| 1003 | vb2_queue_init(&pdev->vb_queue); | 1003 | rc = vb2_queue_init(&pdev->vb_queue); |
| 1004 | if (rc < 0) { | ||
| 1005 | PWC_ERROR("Oops, could not initialize vb2 queue.\n"); | ||
| 1006 | goto err_free_mem; | ||
| 1007 | } | ||
| 1004 | 1008 | ||
| 1005 | /* Init video_device structure */ | 1009 | /* Init video_device structure */ |
| 1006 | memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); | 1010 | memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); |
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 2191f6ddf9e7..8ebec0d7bf59 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c | |||
| @@ -1651,7 +1651,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv, | |||
| 1651 | int is_ntsc = 0; | 1651 | int is_ntsc = 0; |
| 1652 | #define NUM_FRAME_ENUMS 4 | 1652 | #define NUM_FRAME_ENUMS 4 |
| 1653 | int frm_dec[NUM_FRAME_ENUMS] = {1, 2, 3, 5}; | 1653 | int frm_dec[NUM_FRAME_ENUMS] = {1, 2, 3, 5}; |
| 1654 | if (fe->index < 0 || fe->index >= NUM_FRAME_ENUMS) | 1654 | if (fe->index >= NUM_FRAME_ENUMS) |
| 1655 | return -EINVAL; | 1655 | return -EINVAL; |
| 1656 | switch (fe->width) { | 1656 | switch (fe->width) { |
| 1657 | case 640: | 1657 | case 640: |
diff --git a/drivers/media/usb/siano/Kconfig b/drivers/media/usb/siano/Kconfig index 3c76e62d820d..5afbd9a4b55c 100644 --- a/drivers/media/usb/siano/Kconfig +++ b/drivers/media/usb/siano/Kconfig | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | config SMS_USB_DRV | 5 | config SMS_USB_DRV |
| 6 | tristate "Siano SMS1xxx based MDTV receiver" | 6 | tristate "Siano SMS1xxx based MDTV receiver" |
| 7 | depends on DVB_CORE && RC_CORE && HAS_DMA | 7 | depends on DVB_CORE && HAS_DMA |
| 8 | select MEDIA_COMMON_OPTIONS | ||
| 8 | ---help--- | 9 | ---help--- |
| 9 | Choose if you would like to have Siano's support for USB interface | 10 | Choose if you would like to have Siano's support for USB interface |
| 10 | 11 | ||
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index aac622200e99..de2c10289eec 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c | |||
| @@ -389,7 +389,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) | |||
| 389 | return rc; | 389 | return rc; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | static int __devinit smsusb_probe(struct usb_interface *intf, | 392 | static int smsusb_probe(struct usb_interface *intf, |
| 393 | const struct usb_device_id *id) | 393 | const struct usb_device_id *id) |
| 394 | { | 394 | { |
| 395 | struct usb_device *udev = interface_to_usbdev(intf); | 395 | struct usb_device *udev = interface_to_usbdev(intf); |
diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c index 5bfc8e2f018f..73605864fffa 100644 --- a/drivers/media/usb/sn9c102/sn9c102_core.c +++ b/drivers/media/usb/sn9c102/sn9c102_core.c | |||
| @@ -2481,11 +2481,13 @@ sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg) | |||
| 2481 | if (frmsize.pixel_format != V4L2_PIX_FMT_SN9C10X && | 2481 | if (frmsize.pixel_format != V4L2_PIX_FMT_SN9C10X && |
| 2482 | frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) | 2482 | frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) |
| 2483 | return -EINVAL; | 2483 | return -EINVAL; |
| 2484 | break; | ||
| 2484 | case BRIDGE_SN9C105: | 2485 | case BRIDGE_SN9C105: |
| 2485 | case BRIDGE_SN9C120: | 2486 | case BRIDGE_SN9C120: |
| 2486 | if (frmsize.pixel_format != V4L2_PIX_FMT_JPEG && | 2487 | if (frmsize.pixel_format != V4L2_PIX_FMT_JPEG && |
| 2487 | frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) | 2488 | frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) |
| 2488 | return -EINVAL; | 2489 | return -EINVAL; |
| 2490 | break; | ||
| 2489 | } | 2491 | } |
| 2490 | 2492 | ||
| 2491 | frmsize.type = V4L2_FRMSIZE_TYPE_STEPWISE; | 2493 | frmsize.type = V4L2_FRMSIZE_TYPE_STEPWISE; |
diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c index 176ac937306b..850cf285ada8 100644 --- a/drivers/media/usb/stk1160/stk1160-i2c.c +++ b/drivers/media/usb/stk1160/stk1160-i2c.c | |||
| @@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 addr, | |||
| 116 | if (rc < 0) | 116 | if (rc < 0) |
| 117 | return rc; | 117 | return rc; |
| 118 | 118 | ||
| 119 | stk1160_read_reg(dev, STK1160_SBUSR_RD, value); | 119 | rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value); |
| 120 | if (rc < 0) | 120 | if (rc < 0) |
| 121 | return rc; | 121 | return rc; |
| 122 | 122 | ||
diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index 8bdfb0275313..fa3671de02aa 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c | |||
| @@ -475,7 +475,11 @@ int stk1160_alloc_isoc(struct stk1160 *dev) | |||
| 475 | if (!dev->isoc_ctl.transfer_buffer[i]) { | 475 | if (!dev->isoc_ctl.transfer_buffer[i]) { |
| 476 | stk1160_err("cannot alloc %d bytes for tx[%d] buffer\n", | 476 | stk1160_err("cannot alloc %d bytes for tx[%d] buffer\n", |
| 477 | sb_size, i); | 477 | sb_size, i); |
| 478 | goto free_i_bufs; | 478 | |
| 479 | /* Not enough transfer buffers, so just give up */ | ||
| 480 | if (i < STK1160_MIN_BUFS) | ||
| 481 | goto free_i_bufs; | ||
| 482 | goto nomore_tx_bufs; | ||
| 479 | } | 483 | } |
| 480 | memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); | 484 | memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); |
| 481 | 485 | ||
| @@ -506,13 +510,28 @@ int stk1160_alloc_isoc(struct stk1160 *dev) | |||
| 506 | } | 510 | } |
| 507 | } | 511 | } |
| 508 | 512 | ||
| 509 | stk1160_dbg("urbs allocated\n"); | 513 | stk1160_dbg("%d urbs allocated\n", num_bufs); |
| 510 | 514 | ||
| 511 | /* At last we can say we have some buffers */ | 515 | /* At last we can say we have some buffers */ |
| 512 | dev->isoc_ctl.num_bufs = num_bufs; | 516 | dev->isoc_ctl.num_bufs = num_bufs; |
| 513 | 517 | ||
| 514 | return 0; | 518 | return 0; |
| 515 | 519 | ||
| 520 | nomore_tx_bufs: | ||
| 521 | /* | ||
| 522 | * Failed to allocate desired buffer count. However, we may have | ||
| 523 | * enough to work fine, so we just free the extra urb, | ||
| 524 | * store the allocated count and keep going, fingers crossed! | ||
| 525 | */ | ||
| 526 | usb_free_urb(dev->isoc_ctl.urb[i]); | ||
| 527 | dev->isoc_ctl.urb[i] = NULL; | ||
| 528 | |||
| 529 | stk1160_warn("%d urbs allocated. Trying to continue...\n", i - 1); | ||
| 530 | |||
| 531 | dev->isoc_ctl.num_bufs = i - 1; | ||
| 532 | |||
| 533 | return 0; | ||
| 534 | |||
| 516 | free_i_bufs: | 535 | free_i_bufs: |
| 517 | /* Save the allocated buffers so far, so we can properly free them */ | 536 | /* Save the allocated buffers so far, so we can properly free them */ |
| 518 | dev->isoc_ctl.num_bufs = i+1; | 537 | dev->isoc_ctl.num_bufs = i+1; |
diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h index 68c8707d36ab..05b05b160e1e 100644 --- a/drivers/media/usb/stk1160/stk1160.h +++ b/drivers/media/usb/stk1160/stk1160.h | |||
| @@ -30,11 +30,12 @@ | |||
| 30 | #define STK1160_VERSION "0.9.5" | 30 | #define STK1160_VERSION "0.9.5" |
| 31 | #define STK1160_VERSION_NUM 0x000905 | 31 | #define STK1160_VERSION_NUM 0x000905 |
| 32 | 32 | ||
| 33 | /* TODO: Decide on number of packets for each buffer */ | 33 | /* Decide on number of packets for each buffer */ |
| 34 | #define STK1160_NUM_PACKETS 64 | 34 | #define STK1160_NUM_PACKETS 64 |
| 35 | 35 | ||
| 36 | /* Number of buffers for isoc transfers */ | 36 | /* Number of buffers for isoc transfers */ |
| 37 | #define STK1160_NUM_BUFS 16 /* TODO */ | 37 | #define STK1160_NUM_BUFS 16 |
| 38 | #define STK1160_MIN_BUFS 1 | ||
| 38 | 39 | ||
| 39 | /* TODO: This endpoint address should be retrieved */ | 40 | /* TODO: This endpoint address should be retrieved */ |
| 40 | #define STK1160_EP_VIDEO 0x82 | 41 | #define STK1160_EP_VIDEO 0x82 |
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index 86a0fc56c330..5d3c032d733c 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c | |||
| @@ -54,10 +54,6 @@ MODULE_LICENSE("GPL"); | |||
| 54 | MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN"); | 54 | MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN"); |
| 55 | MODULE_DESCRIPTION("Syntek DC1125 webcam driver"); | 55 | MODULE_DESCRIPTION("Syntek DC1125 webcam driver"); |
| 56 | 56 | ||
| 57 | |||
| 58 | /* bool for webcam LED management */ | ||
| 59 | int first_init = 1; | ||
| 60 | |||
| 61 | /* Some cameras have audio interfaces, we aren't interested in those */ | 57 | /* Some cameras have audio interfaces, we aren't interested in those */ |
| 62 | static struct usb_device_id stkwebcam_table[] = { | 58 | static struct usb_device_id stkwebcam_table[] = { |
| 63 | { USB_DEVICE_AND_INTERFACE_INFO(0x174f, 0xa311, 0xff, 0xff, 0xff) }, | 59 | { USB_DEVICE_AND_INTERFACE_INFO(0x174f, 0xa311, 0xff, 0xff, 0xff) }, |
| @@ -554,6 +550,7 @@ static void stk_free_buffers(struct stk_camera *dev) | |||
| 554 | 550 | ||
| 555 | static int v4l_stk_open(struct file *fp) | 551 | static int v4l_stk_open(struct file *fp) |
| 556 | { | 552 | { |
| 553 | static int first_init = 1; /* webcam LED management */ | ||
| 557 | struct stk_camera *dev; | 554 | struct stk_camera *dev; |
| 558 | struct video_device *vdev; | 555 | struct video_device *vdev; |
| 559 | 556 | ||
diff --git a/drivers/media/usb/tlg2300/pd-dvb.c b/drivers/media/usb/tlg2300/pd-dvb.c index 30fcb117e898..ca4994a5190c 100644 --- a/drivers/media/usb/tlg2300/pd-dvb.c +++ b/drivers/media/usb/tlg2300/pd-dvb.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include "pd-common.h" | 1 | #include "pd-common.h" |
| 2 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
| 3 | #include <linux/usb.h> | 3 | #include <linux/usb.h> |
| 4 | #include <linux/time.h> | ||
| 4 | #include <linux/dvb/dmx.h> | 5 | #include <linux/dvb/dmx.h> |
| 5 | #include <linux/delay.h> | 6 | #include <linux/delay.h> |
| 6 | #include <linux/gfp.h> | 7 | #include <linux/gfp.h> |
diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c index 1f448ac7a496..3082bfa9b2c5 100644 --- a/drivers/media/usb/tlg2300/pd-video.c +++ b/drivers/media/usb/tlg2300/pd-video.c | |||
| @@ -888,7 +888,7 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *in) | |||
| 888 | { | 888 | { |
| 889 | struct front_face *front = fh; | 889 | struct front_face *front = fh; |
| 890 | 890 | ||
| 891 | if (in->index < 0 || in->index >= POSEIDON_INPUTS) | 891 | if (in->index >= POSEIDON_INPUTS) |
| 892 | return -EINVAL; | 892 | return -EINVAL; |
| 893 | strcpy(in->name, pd_inputs[in->index].name); | 893 | strcpy(in->name, pd_inputs[in->index].name); |
| 894 | in->type = V4L2_INPUT_TYPE_TUNER; | 894 | in->type = V4L2_INPUT_TYPE_TUNER; |
| @@ -923,7 +923,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int i) | |||
| 923 | struct poseidon *pd = front->pd; | 923 | struct poseidon *pd = front->pd; |
| 924 | s32 ret, cmd_status; | 924 | s32 ret, cmd_status; |
| 925 | 925 | ||
| 926 | if (i < 0 || i >= POSEIDON_INPUTS) | 926 | if (i >= POSEIDON_INPUTS) |
| 927 | return -EINVAL; | 927 | return -EINVAL; |
| 928 | ret = send_set_req(pd, SGNL_SRC_SEL, | 928 | ret = send_set_req(pd, SGNL_SRC_SEL, |
| 929 | pd_inputs[i].tlg_src, &cmd_status); | 929 | pd_inputs[i].tlg_src, &cmd_status); |
diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c index dffbd4bd47b1..8a6bbf1d80e1 100644 --- a/drivers/media/usb/tm6000/tm6000-input.c +++ b/drivers/media/usb/tm6000/tm6000-input.c | |||
| @@ -109,12 +109,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir) | |||
| 109 | */ | 109 | */ |
| 110 | 110 | ||
| 111 | switch (ir->rc_type) { | 111 | switch (ir->rc_type) { |
| 112 | case RC_TYPE_NEC: | 112 | case RC_BIT_NEC: |
| 113 | leader = 900; /* ms */ | 113 | leader = 900; /* ms */ |
| 114 | pulse = 700; /* ms - the actual value would be 562 */ | 114 | pulse = 700; /* ms - the actual value would be 562 */ |
| 115 | break; | 115 | break; |
| 116 | default: | 116 | default: |
| 117 | case RC_TYPE_RC5: | 117 | case RC_BIT_RC5: |
| 118 | leader = 900; /* ms - from the NEC decoding */ | 118 | leader = 900; /* ms - from the NEC decoding */ |
| 119 | pulse = 1780; /* ms - The actual value would be 1776 */ | 119 | pulse = 1780; /* ms - The actual value would be 1776 */ |
| 120 | break; | 120 | break; |
| @@ -122,12 +122,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir) | |||
| 122 | 122 | ||
| 123 | pulse = ir_clock_mhz * pulse; | 123 | pulse = ir_clock_mhz * pulse; |
| 124 | leader = ir_clock_mhz * leader; | 124 | leader = ir_clock_mhz * leader; |
| 125 | if (ir->rc_type == RC_TYPE_NEC) | 125 | if (ir->rc_type == RC_BIT_NEC) |
| 126 | leader = leader | 0x8000; | 126 | leader = leader | 0x8000; |
| 127 | 127 | ||
| 128 | dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n", | 128 | dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n", |
| 129 | __func__, | 129 | __func__, |
| 130 | (ir->rc_type == RC_TYPE_NEC) ? "NEC" : "RC-5", | 130 | (ir->rc_type == RC_BIT_NEC) ? "NEC" : "RC-5", |
| 131 | ir_clock_mhz, leader, pulse); | 131 | ir_clock_mhz, leader, pulse); |
| 132 | 132 | ||
| 133 | /* Remote WAKEUP = enable, normal mode, from IR decoder output */ | 133 | /* Remote WAKEUP = enable, normal mode, from IR decoder output */ |
| @@ -297,7 +297,7 @@ static void tm6000_ir_stop(struct rc_dev *rc) | |||
| 297 | cancel_delayed_work_sync(&ir->work); | 297 | cancel_delayed_work_sync(&ir->work); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | 300 | static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 *rc_type) |
| 301 | { | 301 | { |
| 302 | struct tm6000_IR *ir = rc->priv; | 302 | struct tm6000_IR *ir = rc->priv; |
| 303 | 303 | ||
| @@ -306,10 +306,10 @@ static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
| 306 | 306 | ||
| 307 | dprintk(2, "%s\n",__func__); | 307 | dprintk(2, "%s\n",__func__); |
| 308 | 308 | ||
| 309 | if ((rc->rc_map.scan) && (rc_type == RC_TYPE_NEC)) | 309 | if ((rc->rc_map.scan) && (*rc_type == RC_BIT_NEC)) |
| 310 | ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff); | 310 | ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff); |
| 311 | 311 | ||
| 312 | ir->rc_type = rc_type; | 312 | ir->rc_type = *rc_type; |
| 313 | 313 | ||
| 314 | tm6000_ir_config(ir); | 314 | tm6000_ir_config(ir); |
| 315 | /* TODO */ | 315 | /* TODO */ |
| @@ -398,6 +398,7 @@ int tm6000_ir_init(struct tm6000_core *dev) | |||
| 398 | struct tm6000_IR *ir; | 398 | struct tm6000_IR *ir; |
| 399 | struct rc_dev *rc; | 399 | struct rc_dev *rc; |
| 400 | int err = -ENOMEM; | 400 | int err = -ENOMEM; |
| 401 | u64 rc_type; | ||
| 401 | 402 | ||
| 402 | if (!enable_ir) | 403 | if (!enable_ir) |
| 403 | return -ENODEV; | 404 | return -ENODEV; |
| @@ -421,7 +422,7 @@ int tm6000_ir_init(struct tm6000_core *dev) | |||
| 421 | ir->rc = rc; | 422 | ir->rc = rc; |
| 422 | 423 | ||
| 423 | /* input setup */ | 424 | /* input setup */ |
| 424 | rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; | 425 | rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC; |
| 425 | /* Neded, in order to support NEC remotes with 24 or 32 bits */ | 426 | /* Neded, in order to support NEC remotes with 24 or 32 bits */ |
| 426 | rc->scanmask = 0xffff; | 427 | rc->scanmask = 0xffff; |
| 427 | rc->priv = ir; | 428 | rc->priv = ir; |
| @@ -444,7 +445,8 @@ int tm6000_ir_init(struct tm6000_core *dev) | |||
| 444 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); | 445 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); |
| 445 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); | 446 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); |
| 446 | 447 | ||
| 447 | tm6000_ir_change_protocol(rc, RC_TYPE_UNKNOWN); | 448 | rc_type = RC_BIT_UNKNOWN; |
| 449 | tm6000_ir_change_protocol(rc, &rc_type); | ||
| 448 | 450 | ||
| 449 | rc->input_name = ir->name; | 451 | rc->input_name = ir->name; |
| 450 | rc->input_phys = ir->phys; | 452 | rc->input_phys = ir->phys; |
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index 4342cd4f5c8a..f656fd7a39a2 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c | |||
| @@ -1802,6 +1802,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev) | |||
| 1802 | if (!dev->radio_dev) { | 1802 | if (!dev->radio_dev) { |
| 1803 | printk(KERN_INFO "%s: can't register radio device\n", | 1803 | printk(KERN_INFO "%s: can't register radio device\n", |
| 1804 | dev->name); | 1804 | dev->name); |
| 1805 | ret = -ENXIO; | ||
| 1805 | return ret; /* FIXME release resource */ | 1806 | return ret; /* FIXME release resource */ |
| 1806 | } | 1807 | } |
| 1807 | 1808 | ||
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index 5c36a57e6590..ad7f7448072e 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c | |||
| @@ -1363,7 +1363,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) | |||
| 1363 | } | 1363 | } |
| 1364 | 1364 | ||
| 1365 | /* register video4linux devices */ | 1365 | /* register video4linux devices */ |
| 1366 | static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) | 1366 | static int usbvision_register_video(struct usb_usbvision *usbvision) |
| 1367 | { | 1367 | { |
| 1368 | /* Video Device: */ | 1368 | /* Video Device: */ |
| 1369 | usbvision->vdev = usbvision_vdev_init(usbvision, | 1369 | usbvision->vdev = usbvision_vdev_init(usbvision, |
| @@ -1510,8 +1510,8 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
| 1510 | * if it looks like USBVISION video device | 1510 | * if it looks like USBVISION video device |
| 1511 | * | 1511 | * |
| 1512 | */ | 1512 | */ |
| 1513 | static int __devinit usbvision_probe(struct usb_interface *intf, | 1513 | static int usbvision_probe(struct usb_interface *intf, |
| 1514 | const struct usb_device_id *devid) | 1514 | const struct usb_device_id *devid) |
| 1515 | { | 1515 | { |
| 1516 | struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); | 1516 | struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); |
| 1517 | struct usb_interface *uif; | 1517 | struct usb_interface *uif; |
| @@ -1619,7 +1619,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf, | |||
| 1619 | * with no ill consequences. | 1619 | * with no ill consequences. |
| 1620 | * | 1620 | * |
| 1621 | */ | 1621 | */ |
| 1622 | static void __devexit usbvision_disconnect(struct usb_interface *intf) | 1622 | static void usbvision_disconnect(struct usb_interface *intf) |
| 1623 | { | 1623 | { |
| 1624 | struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf)); | 1624 | struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf)); |
| 1625 | 1625 | ||
| @@ -1664,7 +1664,7 @@ static struct usb_driver usbvision_driver = { | |||
| 1664 | .name = "usbvision", | 1664 | .name = "usbvision", |
| 1665 | .id_table = usbvision_table, | 1665 | .id_table = usbvision_table, |
| 1666 | .probe = usbvision_probe, | 1666 | .probe = usbvision_probe, |
| 1667 | .disconnect = __devexit_p(usbvision_disconnect), | 1667 | .disconnect = usbvision_disconnect, |
| 1668 | }; | 1668 | }; |
| 1669 | 1669 | ||
| 1670 | /* | 1670 | /* |
diff --git a/drivers/media/usb/usbvision/usbvision.h b/drivers/media/usb/usbvision/usbvision.h index 43cf61fe4943..8a25876d72c6 100644 --- a/drivers/media/usb/usbvision/usbvision.h +++ b/drivers/media/usb/usbvision/usbvision.h | |||
| @@ -167,7 +167,7 @@ enum { | |||
| 167 | 167 | ||
| 168 | /* This macro restricts an int variable to an inclusive range */ | 168 | /* This macro restricts an int variable to an inclusive range */ |
| 169 | #define RESTRICT_TO_RANGE(v, mi, ma) \ | 169 | #define RESTRICT_TO_RANGE(v, mi, ma) \ |
| 170 | { if ((v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); } | 170 | { if (((int)v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); } |
| 171 | 171 | ||
| 172 | /* | 172 | /* |
| 173 | * We use macros to do YUV -> RGB conversion because this is | 173 | * We use macros to do YUV -> RGB conversion because this is |
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index f7061a5ef1d2..2bb7613ddebb 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c | |||
| @@ -927,7 +927,7 @@ static int __uvc_ctrl_get(struct uvc_video_chain *chain, | |||
| 927 | int ret; | 927 | int ret; |
| 928 | 928 | ||
| 929 | if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) | 929 | if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) |
| 930 | return -EINVAL; | 930 | return -EACCES; |
| 931 | 931 | ||
| 932 | if (!ctrl->loaded) { | 932 | if (!ctrl->loaded) { |
| 933 | ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id, | 933 | ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id, |
| @@ -1452,8 +1452,12 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, | |||
| 1452 | if (step == 0) | 1452 | if (step == 0) |
| 1453 | step = 1; | 1453 | step = 1; |
| 1454 | 1454 | ||
| 1455 | xctrl->value = min + (xctrl->value - min + step/2) / step * step; | 1455 | xctrl->value = min + ((u32)(xctrl->value - min) + step / 2) |
| 1456 | xctrl->value = clamp(xctrl->value, min, max); | 1456 | / step * step; |
| 1457 | if (mapping->data_type == UVC_CTRL_DATA_TYPE_SIGNED) | ||
| 1458 | xctrl->value = clamp(xctrl->value, min, max); | ||
| 1459 | else | ||
| 1460 | xctrl->value = clamp_t(u32, xctrl->value, min, max); | ||
| 1457 | value = xctrl->value; | 1461 | value = xctrl->value; |
| 1458 | break; | 1462 | break; |
| 1459 | 1463 | ||
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 5967081747ce..5dbefa68b1d2 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c | |||
| @@ -1562,6 +1562,9 @@ static int uvc_scan_device(struct uvc_device *dev) | |||
| 1562 | INIT_LIST_HEAD(&chain->entities); | 1562 | INIT_LIST_HEAD(&chain->entities); |
| 1563 | mutex_init(&chain->ctrl_mutex); | 1563 | mutex_init(&chain->ctrl_mutex); |
| 1564 | chain->dev = dev; | 1564 | chain->dev = dev; |
| 1565 | v4l2_prio_init(&chain->prio); | ||
| 1566 | |||
| 1567 | term->flags |= UVC_ENTITY_FLAG_DEFAULT; | ||
| 1565 | 1568 | ||
| 1566 | if (uvc_scan_chain(chain, term) < 0) { | 1569 | if (uvc_scan_chain(chain, term) < 0) { |
| 1567 | kfree(chain); | 1570 | kfree(chain); |
| @@ -1722,6 +1725,8 @@ static int uvc_register_video(struct uvc_device *dev, | |||
| 1722 | vdev->v4l2_dev = &dev->vdev; | 1725 | vdev->v4l2_dev = &dev->vdev; |
| 1723 | vdev->fops = &uvc_fops; | 1726 | vdev->fops = &uvc_fops; |
| 1724 | vdev->release = uvc_release; | 1727 | vdev->release = uvc_release; |
| 1728 | vdev->prio = &stream->chain->prio; | ||
| 1729 | set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); | ||
| 1725 | if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) | 1730 | if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) |
| 1726 | vdev->vfl_dir = VFL_DIR_TX; | 1731 | vdev->vfl_dir = VFL_DIR_TX; |
| 1727 | strlcpy(vdev->name, dev->name, sizeof vdev->name); | 1732 | strlcpy(vdev->name, dev->name, sizeof vdev->name); |
| @@ -1741,6 +1746,11 @@ static int uvc_register_video(struct uvc_device *dev, | |||
| 1741 | return ret; | 1746 | return ret; |
| 1742 | } | 1747 | } |
| 1743 | 1748 | ||
| 1749 | if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
| 1750 | stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE; | ||
| 1751 | else | ||
| 1752 | stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; | ||
| 1753 | |||
| 1744 | atomic_inc(&dev->nstreams); | 1754 | atomic_inc(&dev->nstreams); |
| 1745 | return 0; | 1755 | return 0; |
| 1746 | } | 1756 | } |
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c index 29e239911d0e..dc56a59ecadc 100644 --- a/drivers/media/usb/uvc/uvc_entity.c +++ b/drivers/media/usb/uvc/uvc_entity.c | |||
| @@ -93,6 +93,8 @@ static int uvc_mc_init_entity(struct uvc_entity *entity) | |||
| 93 | } else if (entity->vdev != NULL) { | 93 | } else if (entity->vdev != NULL) { |
| 94 | ret = media_entity_init(&entity->vdev->entity, | 94 | ret = media_entity_init(&entity->vdev->entity, |
| 95 | entity->num_pads, entity->pads, 0); | 95 | entity->num_pads, entity->pads, 0); |
| 96 | if (entity->flags & UVC_ENTITY_FLAG_DEFAULT) | ||
| 97 | entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT; | ||
| 96 | } else | 98 | } else |
| 97 | ret = 0; | 99 | ret = 0; |
| 98 | 100 | ||
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 18a91fae6bc1..778addc5caff 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c | |||
| @@ -128,7 +128,7 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, | |||
| 128 | int ret; | 128 | int ret; |
| 129 | 129 | ||
| 130 | queue->queue.type = type; | 130 | queue->queue.type = type; |
| 131 | queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; | 131 | queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; |
| 132 | queue->queue.drv_priv = queue; | 132 | queue->queue.drv_priv = queue; |
| 133 | queue->queue.buf_struct_size = sizeof(struct uvc_buffer); | 133 | queue->queue.buf_struct_size = sizeof(struct uvc_buffer); |
| 134 | queue->queue.ops = &uvc_queue_qops; | 134 | queue->queue.ops = &uvc_queue_qops; |
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index f00db3060e0e..f2ee8c6b0d8d 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c | |||
| @@ -165,17 +165,18 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, | |||
| 165 | fcc[0], fcc[1], fcc[2], fcc[3], | 165 | fcc[0], fcc[1], fcc[2], fcc[3], |
| 166 | fmt->fmt.pix.width, fmt->fmt.pix.height); | 166 | fmt->fmt.pix.width, fmt->fmt.pix.height); |
| 167 | 167 | ||
| 168 | /* Check if the hardware supports the requested format. */ | 168 | /* Check if the hardware supports the requested format, use the default |
| 169 | * format otherwise. | ||
| 170 | */ | ||
| 169 | for (i = 0; i < stream->nformats; ++i) { | 171 | for (i = 0; i < stream->nformats; ++i) { |
| 170 | format = &stream->format[i]; | 172 | format = &stream->format[i]; |
| 171 | if (format->fcc == fmt->fmt.pix.pixelformat) | 173 | if (format->fcc == fmt->fmt.pix.pixelformat) |
| 172 | break; | 174 | break; |
| 173 | } | 175 | } |
| 174 | 176 | ||
| 175 | if (format == NULL || format->fcc != fmt->fmt.pix.pixelformat) { | 177 | if (i == stream->nformats) { |
| 176 | uvc_trace(UVC_TRACE_FORMAT, "Unsupported format 0x%08x.\n", | 178 | format = stream->def_format; |
| 177 | fmt->fmt.pix.pixelformat); | 179 | fmt->fmt.pix.pixelformat = format->fcc; |
| 178 | return -EINVAL; | ||
| 179 | } | 180 | } |
| 180 | 181 | ||
| 181 | /* Find the closest image size. The distance between image sizes is | 182 | /* Find the closest image size. The distance between image sizes is |
| @@ -564,15 +565,30 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 564 | usb_make_path(stream->dev->udev, | 565 | usb_make_path(stream->dev->udev, |
| 565 | cap->bus_info, sizeof(cap->bus_info)); | 566 | cap->bus_info, sizeof(cap->bus_info)); |
| 566 | cap->version = LINUX_VERSION_CODE; | 567 | cap->version = LINUX_VERSION_CODE; |
| 568 | cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING | ||
| 569 | | chain->caps; | ||
| 567 | if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | 570 | if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
| 568 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | 571 | cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
| 569 | | V4L2_CAP_STREAMING; | 572 | | V4L2_CAP_STREAMING; |
| 570 | else | 573 | else |
| 571 | cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | 574 | cap->device_caps = V4L2_CAP_VIDEO_OUTPUT |
| 572 | | V4L2_CAP_STREAMING; | 575 | | V4L2_CAP_STREAMING; |
| 573 | break; | 576 | break; |
| 574 | } | 577 | } |
| 575 | 578 | ||
| 579 | /* Priority */ | ||
| 580 | case VIDIOC_G_PRIORITY: | ||
| 581 | *(u32 *)arg = v4l2_prio_max(vdev->prio); | ||
| 582 | break; | ||
| 583 | |||
| 584 | case VIDIOC_S_PRIORITY: | ||
| 585 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 586 | if (ret < 0) | ||
| 587 | return ret; | ||
| 588 | |||
| 589 | return v4l2_prio_change(vdev->prio, &handle->vfh.prio, | ||
| 590 | *(u32 *)arg); | ||
| 591 | |||
| 576 | /* Get, Set & Query control */ | 592 | /* Get, Set & Query control */ |
| 577 | case VIDIOC_QUERYCTRL: | 593 | case VIDIOC_QUERYCTRL: |
| 578 | return uvc_query_v4l2_ctrl(chain, arg); | 594 | return uvc_query_v4l2_ctrl(chain, arg); |
| @@ -601,6 +617,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 601 | struct v4l2_control *ctrl = arg; | 617 | struct v4l2_control *ctrl = arg; |
| 602 | struct v4l2_ext_control xctrl; | 618 | struct v4l2_ext_control xctrl; |
| 603 | 619 | ||
| 620 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 621 | if (ret < 0) | ||
| 622 | return ret; | ||
| 623 | |||
| 604 | memset(&xctrl, 0, sizeof xctrl); | 624 | memset(&xctrl, 0, sizeof xctrl); |
| 605 | xctrl.id = ctrl->id; | 625 | xctrl.id = ctrl->id; |
| 606 | xctrl.value = ctrl->value; | 626 | xctrl.value = ctrl->value; |
| @@ -637,7 +657,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 637 | ret = uvc_ctrl_get(chain, ctrl); | 657 | ret = uvc_ctrl_get(chain, ctrl); |
| 638 | if (ret < 0) { | 658 | if (ret < 0) { |
| 639 | uvc_ctrl_rollback(handle); | 659 | uvc_ctrl_rollback(handle); |
| 640 | ctrls->error_idx = i; | 660 | ctrls->error_idx = ret == -ENOENT |
| 661 | ? ctrls->count : i; | ||
| 641 | return ret; | 662 | return ret; |
| 642 | } | 663 | } |
| 643 | } | 664 | } |
| @@ -647,6 +668,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 647 | } | 668 | } |
| 648 | 669 | ||
| 649 | case VIDIOC_S_EXT_CTRLS: | 670 | case VIDIOC_S_EXT_CTRLS: |
| 671 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 672 | if (ret < 0) | ||
| 673 | return ret; | ||
| 674 | /* Fall through */ | ||
| 650 | case VIDIOC_TRY_EXT_CTRLS: | 675 | case VIDIOC_TRY_EXT_CTRLS: |
| 651 | { | 676 | { |
| 652 | struct v4l2_ext_controls *ctrls = arg; | 677 | struct v4l2_ext_controls *ctrls = arg; |
| @@ -661,7 +686,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 661 | ret = uvc_ctrl_set(chain, ctrl); | 686 | ret = uvc_ctrl_set(chain, ctrl); |
| 662 | if (ret < 0) { | 687 | if (ret < 0) { |
| 663 | uvc_ctrl_rollback(handle); | 688 | uvc_ctrl_rollback(handle); |
| 664 | ctrls->error_idx = i; | 689 | ctrls->error_idx = (ret == -ENOENT && |
| 690 | cmd == VIDIOC_S_EXT_CTRLS) | ||
| 691 | ? ctrls->count : i; | ||
| 665 | return ret; | 692 | return ret; |
| 666 | } | 693 | } |
| 667 | } | 694 | } |
| @@ -739,6 +766,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 739 | { | 766 | { |
| 740 | u32 input = *(u32 *)arg + 1; | 767 | u32 input = *(u32 *)arg + 1; |
| 741 | 768 | ||
| 769 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 770 | if (ret < 0) | ||
| 771 | return ret; | ||
| 772 | |||
| 742 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 773 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
| 743 | return ret; | 774 | return ret; |
| 744 | 775 | ||
| @@ -792,6 +823,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 792 | } | 823 | } |
| 793 | 824 | ||
| 794 | case VIDIOC_S_FMT: | 825 | case VIDIOC_S_FMT: |
| 826 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 827 | if (ret < 0) | ||
| 828 | return ret; | ||
| 829 | |||
| 795 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 830 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
| 796 | return ret; | 831 | return ret; |
| 797 | 832 | ||
| @@ -894,6 +929,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 894 | return uvc_v4l2_get_streamparm(stream, arg); | 929 | return uvc_v4l2_get_streamparm(stream, arg); |
| 895 | 930 | ||
| 896 | case VIDIOC_S_PARM: | 931 | case VIDIOC_S_PARM: |
| 932 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 933 | if (ret < 0) | ||
| 934 | return ret; | ||
| 935 | |||
| 897 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 936 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
| 898 | return ret; | 937 | return ret; |
| 899 | 938 | ||
| @@ -924,10 +963,14 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 924 | 963 | ||
| 925 | case VIDIOC_G_CROP: | 964 | case VIDIOC_G_CROP: |
| 926 | case VIDIOC_S_CROP: | 965 | case VIDIOC_S_CROP: |
| 927 | return -EINVAL; | 966 | return -ENOTTY; |
| 928 | 967 | ||
| 929 | /* Buffers & streaming */ | 968 | /* Buffers & streaming */ |
| 930 | case VIDIOC_REQBUFS: | 969 | case VIDIOC_REQBUFS: |
| 970 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 971 | if (ret < 0) | ||
| 972 | return ret; | ||
| 973 | |||
| 931 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 974 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
| 932 | return ret; | 975 | return ret; |
| 933 | 976 | ||
| @@ -973,6 +1016,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 973 | if (*type != stream->type) | 1016 | if (*type != stream->type) |
| 974 | return -EINVAL; | 1017 | return -EINVAL; |
| 975 | 1018 | ||
| 1019 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 1020 | if (ret < 0) | ||
| 1021 | return ret; | ||
| 1022 | |||
| 976 | if (!uvc_has_privileges(handle)) | 1023 | if (!uvc_has_privileges(handle)) |
| 977 | return -EBUSY; | 1024 | return -EBUSY; |
| 978 | 1025 | ||
| @@ -991,6 +1038,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 991 | if (*type != stream->type) | 1038 | if (*type != stream->type) |
| 992 | return -EINVAL; | 1039 | return -EINVAL; |
| 993 | 1040 | ||
| 1041 | ret = v4l2_prio_check(vdev->prio, handle->vfh.prio); | ||
| 1042 | if (ret < 0) | ||
| 1043 | return ret; | ||
| 1044 | |||
| 994 | if (!uvc_has_privileges(handle)) | 1045 | if (!uvc_has_privileges(handle)) |
| 995 | return -EBUSY; | 1046 | return -EBUSY; |
| 996 | 1047 | ||
| @@ -1030,7 +1081,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
| 1030 | 1081 | ||
| 1031 | case VIDIOC_ENUMOUTPUT: | 1082 | case VIDIOC_ENUMOUTPUT: |
| 1032 | uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd); | 1083 | uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd); |
| 1033 | return -EINVAL; | 1084 | return -ENOTTY; |
| 1034 | 1085 | ||
| 1035 | case UVCIOC_CTRL_MAP: | 1086 | case UVCIOC_CTRL_MAP: |
| 1036 | return uvc_ioctl_ctrl_map(chain, arg); | 1087 | return uvc_ioctl_ctrl_map(chain, arg); |
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 57c3076a4625..3394c3432011 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c | |||
| @@ -1812,6 +1812,7 @@ int uvc_video_init(struct uvc_streaming *stream) | |||
| 1812 | probe->bFormatIndex = format->index; | 1812 | probe->bFormatIndex = format->index; |
| 1813 | probe->bFrameIndex = frame->bFrameIndex; | 1813 | probe->bFrameIndex = frame->bFrameIndex; |
| 1814 | 1814 | ||
| 1815 | stream->def_format = format; | ||
| 1815 | stream->cur_format = format; | 1816 | stream->cur_format = format; |
| 1816 | stream->cur_frame = frame; | 1817 | stream->cur_frame = frame; |
| 1817 | 1818 | ||
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index af216ec45e39..af505fdd9b3f 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h | |||
| @@ -225,10 +225,14 @@ struct uvc_format_desc { | |||
| 225 | * always be accessed with the UVC_ENTITY_* macros and never directly. | 225 | * always be accessed with the UVC_ENTITY_* macros and never directly. |
| 226 | */ | 226 | */ |
| 227 | 227 | ||
| 228 | #define UVC_ENTITY_FLAG_DEFAULT (1 << 0) | ||
| 229 | |||
| 228 | struct uvc_entity { | 230 | struct uvc_entity { |
| 229 | struct list_head list; /* Entity as part of a UVC device. */ | 231 | struct list_head list; /* Entity as part of a UVC device. */ |
| 230 | struct list_head chain; /* Entity as part of a video device | 232 | struct list_head chain; /* Entity as part of a video device |
| 231 | * chain. */ | 233 | * chain. */ |
| 234 | unsigned int flags; | ||
| 235 | |||
| 232 | __u8 id; | 236 | __u8 id; |
| 233 | __u16 type; | 237 | __u16 type; |
| 234 | char name[64]; | 238 | char name[64]; |
| @@ -371,6 +375,9 @@ struct uvc_video_chain { | |||
| 371 | struct uvc_entity *selector; /* Selector unit */ | 375 | struct uvc_entity *selector; /* Selector unit */ |
| 372 | 376 | ||
| 373 | struct mutex ctrl_mutex; /* Protects ctrl.info */ | 377 | struct mutex ctrl_mutex; /* Protects ctrl.info */ |
| 378 | |||
| 379 | struct v4l2_prio_state prio; /* V4L2 priority state */ | ||
| 380 | u32 caps; /* V4L2 chain-wide caps */ | ||
| 374 | }; | 381 | }; |
| 375 | 382 | ||
| 376 | struct uvc_stats_frame { | 383 | struct uvc_stats_frame { |
| @@ -436,6 +443,7 @@ struct uvc_streaming { | |||
| 436 | struct uvc_format *format; | 443 | struct uvc_format *format; |
| 437 | 444 | ||
| 438 | struct uvc_streaming_control ctrl; | 445 | struct uvc_streaming_control ctrl; |
| 446 | struct uvc_format *def_format; | ||
| 439 | struct uvc_format *cur_format; | 447 | struct uvc_format *cur_format; |
| 440 | struct uvc_frame *cur_frame; | 448 | struct uvc_frame *cur_frame; |
| 441 | /* Protect access to ctrl, cur_format, cur_frame and hardware video | 449 | /* Protect access to ctrl, cur_format, cur_frame and hardware video |
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c index 9afab35878b4..39edd4442932 100644 --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c | |||
| @@ -1007,8 +1007,7 @@ static void read_pipe_completion(struct urb *purb) | |||
| 1007 | return; | 1007 | return; |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | if (purb->actual_length < 0 || | 1010 | if (purb->actual_length > pipe_info->transfer_size) { |
| 1011 | purb->actual_length > pipe_info->transfer_size) { | ||
| 1012 | dev_err(&cam->udev->dev, "wrong number of bytes\n"); | 1011 | dev_err(&cam->udev->dev, "wrong number of bytes\n"); |
| 1013 | return; | 1012 | return; |
| 1014 | } | 1013 | } |
diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig index 0c54e19d9944..65875c3aba1b 100644 --- a/drivers/media/v4l2-core/Kconfig +++ b/drivers/media/v4l2-core/Kconfig | |||
| @@ -59,6 +59,7 @@ config VIDEOBUF_DVB | |||
| 59 | 59 | ||
| 60 | # Used by drivers that need Videobuf2 modules | 60 | # Used by drivers that need Videobuf2 modules |
| 61 | config VIDEOBUF2_CORE | 61 | config VIDEOBUF2_CORE |
| 62 | select DMA_SHARED_BUFFER | ||
| 62 | tristate | 63 | tristate |
| 63 | 64 | ||
| 64 | config VIDEOBUF2_MEMOPS | 65 | config VIDEOBUF2_MEMOPS |
| @@ -68,11 +69,13 @@ config VIDEOBUF2_DMA_CONTIG | |||
| 68 | tristate | 69 | tristate |
| 69 | select VIDEOBUF2_CORE | 70 | select VIDEOBUF2_CORE |
| 70 | select VIDEOBUF2_MEMOPS | 71 | select VIDEOBUF2_MEMOPS |
| 72 | select DMA_SHARED_BUFFER | ||
| 71 | 73 | ||
| 72 | config VIDEOBUF2_VMALLOC | 74 | config VIDEOBUF2_VMALLOC |
| 73 | tristate | 75 | tristate |
| 74 | select VIDEOBUF2_CORE | 76 | select VIDEOBUF2_CORE |
| 75 | select VIDEOBUF2_MEMOPS | 77 | select VIDEOBUF2_MEMOPS |
| 78 | select DMA_SHARED_BUFFER | ||
| 76 | 79 | ||
| 77 | config VIDEOBUF2_DMA_SG | 80 | config VIDEOBUF2_DMA_SG |
| 78 | tristate | 81 | tristate |
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index f995dd31151d..380ddd89fa4c 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c | |||
| @@ -837,7 +837,7 @@ bool v4l2_detect_gtf(unsigned frame_height, | |||
| 837 | struct v4l2_dv_timings *fmt) | 837 | struct v4l2_dv_timings *fmt) |
| 838 | { | 838 | { |
| 839 | int pix_clk; | 839 | int pix_clk; |
| 840 | int v_fp, v_bp, h_fp, h_bp, hsync; | 840 | int v_fp, v_bp, h_fp, hsync; |
| 841 | int frame_width, image_height, image_width; | 841 | int frame_width, image_height, image_width; |
| 842 | bool default_gtf; | 842 | bool default_gtf; |
| 843 | int h_blank; | 843 | int h_blank; |
| @@ -885,7 +885,6 @@ bool v4l2_detect_gtf(unsigned frame_height, | |||
| 885 | hsync = hsync - hsync % GTF_CELL_GRAN; | 885 | hsync = hsync - hsync % GTF_CELL_GRAN; |
| 886 | 886 | ||
| 887 | h_fp = h_blank / 2 - hsync; | 887 | h_fp = h_blank / 2 - hsync; |
| 888 | h_bp = h_blank / 2; | ||
| 889 | 888 | ||
| 890 | fmt->bt.polarities = polarities; | 889 | fmt->bt.polarities = polarities; |
| 891 | fmt->bt.width = image_width; | 890 | fmt->bt.width = image_width; |
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 83ffb6436baf..7157af301b14 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c | |||
| @@ -297,6 +297,7 @@ struct v4l2_plane32 { | |||
| 297 | union { | 297 | union { |
| 298 | __u32 mem_offset; | 298 | __u32 mem_offset; |
| 299 | compat_long_t userptr; | 299 | compat_long_t userptr; |
| 300 | __s32 fd; | ||
| 300 | } m; | 301 | } m; |
| 301 | __u32 data_offset; | 302 | __u32 data_offset; |
| 302 | __u32 reserved[11]; | 303 | __u32 reserved[11]; |
| @@ -318,6 +319,7 @@ struct v4l2_buffer32 { | |||
| 318 | __u32 offset; | 319 | __u32 offset; |
| 319 | compat_long_t userptr; | 320 | compat_long_t userptr; |
| 320 | compat_caddr_t planes; | 321 | compat_caddr_t planes; |
| 322 | __s32 fd; | ||
| 321 | } m; | 323 | } m; |
| 322 | __u32 length; | 324 | __u32 length; |
| 323 | __u32 reserved2; | 325 | __u32 reserved2; |
| @@ -341,6 +343,9 @@ static int get_v4l2_plane32(struct v4l2_plane *up, struct v4l2_plane32 *up32, | |||
| 341 | up_pln = compat_ptr(p); | 343 | up_pln = compat_ptr(p); |
| 342 | if (put_user((unsigned long)up_pln, &up->m.userptr)) | 344 | if (put_user((unsigned long)up_pln, &up->m.userptr)) |
| 343 | return -EFAULT; | 345 | return -EFAULT; |
| 346 | } else if (memory == V4L2_MEMORY_DMABUF) { | ||
| 347 | if (copy_in_user(&up->m.fd, &up32->m.fd, sizeof(int))) | ||
| 348 | return -EFAULT; | ||
| 344 | } else { | 349 | } else { |
| 345 | if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset, | 350 | if (copy_in_user(&up->m.mem_offset, &up32->m.mem_offset, |
| 346 | sizeof(__u32))) | 351 | sizeof(__u32))) |
| @@ -364,6 +369,11 @@ static int put_v4l2_plane32(struct v4l2_plane *up, struct v4l2_plane32 *up32, | |||
| 364 | if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset, | 369 | if (copy_in_user(&up32->m.mem_offset, &up->m.mem_offset, |
| 365 | sizeof(__u32))) | 370 | sizeof(__u32))) |
| 366 | return -EFAULT; | 371 | return -EFAULT; |
| 372 | /* For DMABUF, driver might've set up the fd, so copy it back. */ | ||
| 373 | if (memory == V4L2_MEMORY_DMABUF) | ||
| 374 | if (copy_in_user(&up32->m.fd, &up->m.fd, | ||
| 375 | sizeof(int))) | ||
| 376 | return -EFAULT; | ||
| 367 | 377 | ||
| 368 | return 0; | 378 | return 0; |
| 369 | } | 379 | } |
| @@ -446,6 +456,10 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
| 446 | if (get_user(kp->m.offset, &up->m.offset)) | 456 | if (get_user(kp->m.offset, &up->m.offset)) |
| 447 | return -EFAULT; | 457 | return -EFAULT; |
| 448 | break; | 458 | break; |
| 459 | case V4L2_MEMORY_DMABUF: | ||
| 460 | if (get_user(kp->m.fd, &up->m.fd)) | ||
| 461 | return -EFAULT; | ||
| 462 | break; | ||
| 449 | } | 463 | } |
| 450 | } | 464 | } |
| 451 | 465 | ||
| @@ -510,6 +524,10 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user | |||
| 510 | if (put_user(kp->m.offset, &up->m.offset)) | 524 | if (put_user(kp->m.offset, &up->m.offset)) |
| 511 | return -EFAULT; | 525 | return -EFAULT; |
| 512 | break; | 526 | break; |
| 527 | case V4L2_MEMORY_DMABUF: | ||
| 528 | if (put_user(kp->m.fd, &up->m.fd)) | ||
| 529 | return -EFAULT; | ||
| 530 | break; | ||
| 513 | } | 531 | } |
| 514 | } | 532 | } |
| 515 | 533 | ||
| @@ -1000,6 +1018,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 1000 | case VIDIOC_S_FBUF32: | 1018 | case VIDIOC_S_FBUF32: |
| 1001 | case VIDIOC_OVERLAY32: | 1019 | case VIDIOC_OVERLAY32: |
| 1002 | case VIDIOC_QBUF32: | 1020 | case VIDIOC_QBUF32: |
| 1021 | case VIDIOC_EXPBUF: | ||
| 1003 | case VIDIOC_DQBUF32: | 1022 | case VIDIOC_DQBUF32: |
| 1004 | case VIDIOC_STREAMON32: | 1023 | case VIDIOC_STREAMON32: |
| 1005 | case VIDIOC_STREAMOFF32: | 1024 | case VIDIOC_STREAMOFF32: |
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index a2df842e5100..98dcad9c8a3b 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c | |||
| @@ -571,6 +571,7 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
| 571 | SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); | 571 | SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); |
| 572 | SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); | 572 | SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); |
| 573 | SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf); | 573 | SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf); |
| 574 | SET_VALID_IOCTL(ops, VIDIOC_EXPBUF, vidioc_expbuf); | ||
| 574 | SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf); | 575 | SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf); |
| 575 | SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon); | 576 | SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon); |
| 576 | SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); | 577 | SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); |
diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c index 18a040b935a3..c72009218152 100644 --- a/drivers/media/v4l2-core/v4l2-event.c +++ b/drivers/media/v4l2-core/v4l2-event.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2009--2010 Nokia Corporation. | 6 | * Copyright (C) 2009--2010 Nokia Corporation. |
| 7 | * | 7 | * |
| 8 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 8 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c index 9e3fc040ea20..e57c002b4150 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2009--2010 Nokia Corporation. | 6 | * Copyright (C) 2009--2010 Nokia Corporation. |
| 7 | * | 7 | * |
| 8 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 8 | * Contact: Sakari Ailus <sakari.ailus@iki.fi> |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 8f388ff31ebb..aa6e7c788db2 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
| @@ -155,6 +155,7 @@ static const char *v4l2_memory_names[] = { | |||
| 155 | [V4L2_MEMORY_MMAP] = "mmap", | 155 | [V4L2_MEMORY_MMAP] = "mmap", |
| 156 | [V4L2_MEMORY_USERPTR] = "userptr", | 156 | [V4L2_MEMORY_USERPTR] = "userptr", |
| 157 | [V4L2_MEMORY_OVERLAY] = "overlay", | 157 | [V4L2_MEMORY_OVERLAY] = "overlay", |
| 158 | [V4L2_MEMORY_DMABUF] = "dmabuf", | ||
| 158 | }; | 159 | }; |
| 159 | 160 | ||
| 160 | #define prt_names(a, arr) (((unsigned)(a)) < ARRAY_SIZE(arr) ? arr[a] : "unknown") | 161 | #define prt_names(a, arr) (((unsigned)(a)) < ARRAY_SIZE(arr) ? arr[a] : "unknown") |
| @@ -453,6 +454,15 @@ static void v4l_print_buffer(const void *arg, bool write_only) | |||
| 453 | tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits); | 454 | tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits); |
| 454 | } | 455 | } |
| 455 | 456 | ||
| 457 | static void v4l_print_exportbuffer(const void *arg, bool write_only) | ||
| 458 | { | ||
| 459 | const struct v4l2_exportbuffer *p = arg; | ||
| 460 | |||
| 461 | pr_cont("fd=%d, type=%s, index=%u, plane=%u, flags=0x%08x\n", | ||
| 462 | p->fd, prt_names(p->type, v4l2_type_names), | ||
| 463 | p->index, p->plane, p->flags); | ||
| 464 | } | ||
| 465 | |||
| 456 | static void v4l_print_create_buffers(const void *arg, bool write_only) | 466 | static void v4l_print_create_buffers(const void *arg, bool write_only) |
| 457 | { | 467 | { |
| 458 | const struct v4l2_create_buffers *p = arg; | 468 | const struct v4l2_create_buffers *p = arg; |
| @@ -1960,6 +1970,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = { | |||
| 1960 | IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO), | 1970 | IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO), |
| 1961 | IOCTL_INFO_FNC(VIDIOC_OVERLAY, v4l_overlay, v4l_print_u32, INFO_FL_PRIO), | 1971 | IOCTL_INFO_FNC(VIDIOC_OVERLAY, v4l_overlay, v4l_print_u32, INFO_FL_PRIO), |
| 1962 | IOCTL_INFO_FNC(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE), | 1972 | IOCTL_INFO_FNC(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE), |
| 1973 | IOCTL_INFO_STD(VIDIOC_EXPBUF, vidioc_expbuf, v4l_print_exportbuffer, INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_exportbuffer, flags)), | ||
| 1963 | IOCTL_INFO_FNC(VIDIOC_DQBUF, v4l_dqbuf, v4l_print_buffer, INFO_FL_QUEUE), | 1974 | IOCTL_INFO_FNC(VIDIOC_DQBUF, v4l_dqbuf, v4l_print_buffer, INFO_FL_QUEUE), |
| 1964 | IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), | 1975 | IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), |
| 1965 | IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), | 1976 | IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), |
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 3ac83583ad7a..438ea45d1074 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c | |||
| @@ -369,6 +369,19 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
| 369 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); | 369 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); |
| 370 | 370 | ||
| 371 | /** | 371 | /** |
| 372 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on | ||
| 373 | * the type | ||
| 374 | */ | ||
| 375 | int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | ||
| 376 | struct v4l2_exportbuffer *eb) | ||
| 377 | { | ||
| 378 | struct vb2_queue *vq; | ||
| 379 | |||
| 380 | vq = v4l2_m2m_get_vq(m2m_ctx, eb->type); | ||
| 381 | return vb2_expbuf(vq, eb); | ||
| 382 | } | ||
| 383 | EXPORT_SYMBOL_GPL(v4l2_m2m_expbuf); | ||
| 384 | /** | ||
| 372 | * v4l2_m2m_streamon() - turn on streaming for a video queue | 385 | * v4l2_m2m_streamon() - turn on streaming for a video queue |
| 373 | */ | 386 | */ |
| 374 | int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 387 | int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
| @@ -510,12 +523,10 @@ struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops) | |||
| 510 | { | 523 | { |
| 511 | struct v4l2_m2m_dev *m2m_dev; | 524 | struct v4l2_m2m_dev *m2m_dev; |
| 512 | 525 | ||
| 513 | if (!m2m_ops) | 526 | if (!m2m_ops || WARN_ON(!m2m_ops->device_run) || |
| 527 | WARN_ON(!m2m_ops->job_abort)) | ||
| 514 | return ERR_PTR(-EINVAL); | 528 | return ERR_PTR(-EINVAL); |
| 515 | 529 | ||
| 516 | BUG_ON(!m2m_ops->device_run); | ||
| 517 | BUG_ON(!m2m_ops->job_abort); | ||
| 518 | |||
| 519 | m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); | 530 | m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); |
| 520 | if (!m2m_dev) | 531 | if (!m2m_dev) |
| 521 | return ERR_PTR(-ENOMEM); | 532 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index dced41c1d993..996c248dea42 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c | |||
| @@ -412,20 +412,20 @@ static int | |||
| 412 | v4l2_subdev_link_validate_get_format(struct media_pad *pad, | 412 | v4l2_subdev_link_validate_get_format(struct media_pad *pad, |
| 413 | struct v4l2_subdev_format *fmt) | 413 | struct v4l2_subdev_format *fmt) |
| 414 | { | 414 | { |
| 415 | switch (media_entity_type(pad->entity)) { | 415 | if (media_entity_type(pad->entity) == MEDIA_ENT_T_V4L2_SUBDEV) { |
| 416 | case MEDIA_ENT_T_V4L2_SUBDEV: | 416 | struct v4l2_subdev *sd = |
| 417 | media_entity_to_v4l2_subdev(pad->entity); | ||
| 418 | |||
| 417 | fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; | 419 | fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; |
| 418 | fmt->pad = pad->index; | 420 | fmt->pad = pad->index; |
| 419 | return v4l2_subdev_call(media_entity_to_v4l2_subdev( | 421 | return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); |
| 420 | pad->entity), | ||
| 421 | pad, get_fmt, NULL, fmt); | ||
| 422 | default: | ||
| 423 | WARN(1, "Driver bug! Wrong media entity type %d, entity %s\n", | ||
| 424 | media_entity_type(pad->entity), pad->entity->name); | ||
| 425 | /* Fall through */ | ||
| 426 | case MEDIA_ENT_T_DEVNODE_V4L: | ||
| 427 | return -EINVAL; | ||
| 428 | } | 422 | } |
| 423 | |||
| 424 | WARN(pad->entity->type != MEDIA_ENT_T_DEVNODE_V4L, | ||
| 425 | "Driver bug! Wrong media entity type 0x%08x, entity %s\n", | ||
| 426 | pad->entity->type, pad->entity->name); | ||
| 427 | |||
| 428 | return -EINVAL; | ||
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | int v4l2_subdev_link_validate(struct media_link *link) | 431 | int v4l2_subdev_link_validate(struct media_link *link) |
diff --git a/drivers/media/v4l2-core/videobuf-core.c b/drivers/media/v4l2-core/videobuf-core.c index bf7a326b1cdc..5449e8aa984a 100644 --- a/drivers/media/v4l2-core/videobuf-core.c +++ b/drivers/media/v4l2-core/videobuf-core.c | |||
| @@ -335,6 +335,9 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | |||
| 335 | case V4L2_MEMORY_OVERLAY: | 335 | case V4L2_MEMORY_OVERLAY: |
| 336 | b->m.offset = vb->boff; | 336 | b->m.offset = vb->boff; |
| 337 | break; | 337 | break; |
| 338 | case V4L2_MEMORY_DMABUF: | ||
| 339 | /* DMABUF is not handled in videobuf framework */ | ||
| 340 | break; | ||
| 338 | } | 341 | } |
| 339 | 342 | ||
| 340 | b->flags = 0; | 343 | b->flags = 0; |
| @@ -405,6 +408,7 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, | |||
| 405 | break; | 408 | break; |
| 406 | case V4L2_MEMORY_USERPTR: | 409 | case V4L2_MEMORY_USERPTR: |
| 407 | case V4L2_MEMORY_OVERLAY: | 410 | case V4L2_MEMORY_OVERLAY: |
| 411 | case V4L2_MEMORY_DMABUF: | ||
| 408 | /* nothing */ | 412 | /* nothing */ |
| 409 | break; | 413 | break; |
| 410 | } | 414 | } |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 432df119af27..9f81be23a81f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
| @@ -109,6 +109,36 @@ static void __vb2_buf_userptr_put(struct vb2_buffer *vb) | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /** | 111 | /** |
| 112 | * __vb2_plane_dmabuf_put() - release memory associated with | ||
| 113 | * a DMABUF shared plane | ||
| 114 | */ | ||
| 115 | static void __vb2_plane_dmabuf_put(struct vb2_queue *q, struct vb2_plane *p) | ||
| 116 | { | ||
| 117 | if (!p->mem_priv) | ||
| 118 | return; | ||
| 119 | |||
| 120 | if (p->dbuf_mapped) | ||
| 121 | call_memop(q, unmap_dmabuf, p->mem_priv); | ||
| 122 | |||
| 123 | call_memop(q, detach_dmabuf, p->mem_priv); | ||
| 124 | dma_buf_put(p->dbuf); | ||
| 125 | memset(p, 0, sizeof(*p)); | ||
| 126 | } | ||
| 127 | |||
| 128 | /** | ||
| 129 | * __vb2_buf_dmabuf_put() - release memory associated with | ||
| 130 | * a DMABUF shared buffer | ||
| 131 | */ | ||
| 132 | static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb) | ||
| 133 | { | ||
| 134 | struct vb2_queue *q = vb->vb2_queue; | ||
| 135 | unsigned int plane; | ||
| 136 | |||
| 137 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
| 138 | __vb2_plane_dmabuf_put(q, &vb->planes[plane]); | ||
| 139 | } | ||
| 140 | |||
| 141 | /** | ||
| 112 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in | 142 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in |
| 113 | * every buffer on the queue | 143 | * every buffer on the queue |
| 114 | */ | 144 | */ |
| @@ -230,6 +260,8 @@ static void __vb2_free_mem(struct vb2_queue *q, unsigned int buffers) | |||
| 230 | /* Free MMAP buffers or release USERPTR buffers */ | 260 | /* Free MMAP buffers or release USERPTR buffers */ |
| 231 | if (q->memory == V4L2_MEMORY_MMAP) | 261 | if (q->memory == V4L2_MEMORY_MMAP) |
| 232 | __vb2_buf_mem_free(vb); | 262 | __vb2_buf_mem_free(vb); |
| 263 | else if (q->memory == V4L2_MEMORY_DMABUF) | ||
| 264 | __vb2_buf_dmabuf_put(vb); | ||
| 233 | else | 265 | else |
| 234 | __vb2_buf_userptr_put(vb); | 266 | __vb2_buf_userptr_put(vb); |
| 235 | } | 267 | } |
| @@ -362,6 +394,8 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
| 362 | b->m.offset = vb->v4l2_planes[0].m.mem_offset; | 394 | b->m.offset = vb->v4l2_planes[0].m.mem_offset; |
| 363 | else if (q->memory == V4L2_MEMORY_USERPTR) | 395 | else if (q->memory == V4L2_MEMORY_USERPTR) |
| 364 | b->m.userptr = vb->v4l2_planes[0].m.userptr; | 396 | b->m.userptr = vb->v4l2_planes[0].m.userptr; |
| 397 | else if (q->memory == V4L2_MEMORY_DMABUF) | ||
| 398 | b->m.fd = vb->v4l2_planes[0].m.fd; | ||
| 365 | } | 399 | } |
| 366 | 400 | ||
| 367 | /* | 401 | /* |
| @@ -454,13 +488,28 @@ static int __verify_mmap_ops(struct vb2_queue *q) | |||
| 454 | } | 488 | } |
| 455 | 489 | ||
| 456 | /** | 490 | /** |
| 491 | * __verify_dmabuf_ops() - verify that all memory operations required for | ||
| 492 | * DMABUF queue type have been provided | ||
| 493 | */ | ||
| 494 | static int __verify_dmabuf_ops(struct vb2_queue *q) | ||
| 495 | { | ||
| 496 | if (!(q->io_modes & VB2_DMABUF) || !q->mem_ops->attach_dmabuf || | ||
| 497 | !q->mem_ops->detach_dmabuf || !q->mem_ops->map_dmabuf || | ||
| 498 | !q->mem_ops->unmap_dmabuf) | ||
| 499 | return -EINVAL; | ||
| 500 | |||
| 501 | return 0; | ||
| 502 | } | ||
| 503 | |||
| 504 | /** | ||
| 457 | * __verify_memory_type() - Check whether the memory type and buffer type | 505 | * __verify_memory_type() - Check whether the memory type and buffer type |
| 458 | * passed to a buffer operation are compatible with the queue. | 506 | * passed to a buffer operation are compatible with the queue. |
| 459 | */ | 507 | */ |
| 460 | static int __verify_memory_type(struct vb2_queue *q, | 508 | static int __verify_memory_type(struct vb2_queue *q, |
| 461 | enum v4l2_memory memory, enum v4l2_buf_type type) | 509 | enum v4l2_memory memory, enum v4l2_buf_type type) |
| 462 | { | 510 | { |
| 463 | if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR) { | 511 | if (memory != V4L2_MEMORY_MMAP && memory != V4L2_MEMORY_USERPTR && |
| 512 | memory != V4L2_MEMORY_DMABUF) { | ||
| 464 | dprintk(1, "reqbufs: unsupported memory type\n"); | 513 | dprintk(1, "reqbufs: unsupported memory type\n"); |
| 465 | return -EINVAL; | 514 | return -EINVAL; |
| 466 | } | 515 | } |
| @@ -484,6 +533,11 @@ static int __verify_memory_type(struct vb2_queue *q, | |||
| 484 | return -EINVAL; | 533 | return -EINVAL; |
| 485 | } | 534 | } |
| 486 | 535 | ||
| 536 | if (memory == V4L2_MEMORY_DMABUF && __verify_dmabuf_ops(q)) { | ||
| 537 | dprintk(1, "reqbufs: DMABUF for current setup unsupported\n"); | ||
| 538 | return -EINVAL; | ||
| 539 | } | ||
| 540 | |||
| 487 | /* | 541 | /* |
| 488 | * Place the busy tests at the end: -EBUSY can be ignored when | 542 | * Place the busy tests at the end: -EBUSY can be ignored when |
| 489 | * create_bufs is called with count == 0, but count == 0 should still | 543 | * create_bufs is called with count == 0, but count == 0 should still |
| @@ -790,6 +844,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
| 790 | { | 844 | { |
| 791 | struct vb2_queue *q = vb->vb2_queue; | 845 | struct vb2_queue *q = vb->vb2_queue; |
| 792 | unsigned long flags; | 846 | unsigned long flags; |
| 847 | unsigned int plane; | ||
| 793 | 848 | ||
| 794 | if (vb->state != VB2_BUF_STATE_ACTIVE) | 849 | if (vb->state != VB2_BUF_STATE_ACTIVE) |
| 795 | return; | 850 | return; |
| @@ -800,6 +855,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
| 800 | dprintk(4, "Done processing on buffer %d, state: %d\n", | 855 | dprintk(4, "Done processing on buffer %d, state: %d\n", |
| 801 | vb->v4l2_buf.index, vb->state); | 856 | vb->v4l2_buf.index, vb->state); |
| 802 | 857 | ||
| 858 | /* sync buffers */ | ||
| 859 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
| 860 | call_memop(q, finish, vb->planes[plane].mem_priv); | ||
| 861 | |||
| 803 | /* Add the buffer to the done buffers list */ | 862 | /* Add the buffer to the done buffers list */ |
| 804 | spin_lock_irqsave(&q->done_lock, flags); | 863 | spin_lock_irqsave(&q->done_lock, flags); |
| 805 | vb->state = state; | 864 | vb->state = state; |
| @@ -845,6 +904,16 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b | |||
| 845 | b->m.planes[plane].length; | 904 | b->m.planes[plane].length; |
| 846 | } | 905 | } |
| 847 | } | 906 | } |
| 907 | if (b->memory == V4L2_MEMORY_DMABUF) { | ||
| 908 | for (plane = 0; plane < vb->num_planes; ++plane) { | ||
| 909 | v4l2_planes[plane].m.fd = | ||
| 910 | b->m.planes[plane].m.fd; | ||
| 911 | v4l2_planes[plane].length = | ||
| 912 | b->m.planes[plane].length; | ||
| 913 | v4l2_planes[plane].data_offset = | ||
| 914 | b->m.planes[plane].data_offset; | ||
| 915 | } | ||
| 916 | } | ||
| 848 | } else { | 917 | } else { |
| 849 | /* | 918 | /* |
| 850 | * Single-planar buffers do not use planes array, | 919 | * Single-planar buffers do not use planes array, |
| @@ -859,6 +928,13 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b | |||
| 859 | v4l2_planes[0].m.userptr = b->m.userptr; | 928 | v4l2_planes[0].m.userptr = b->m.userptr; |
| 860 | v4l2_planes[0].length = b->length; | 929 | v4l2_planes[0].length = b->length; |
| 861 | } | 930 | } |
| 931 | |||
| 932 | if (b->memory == V4L2_MEMORY_DMABUF) { | ||
| 933 | v4l2_planes[0].m.fd = b->m.fd; | ||
| 934 | v4l2_planes[0].length = b->length; | ||
| 935 | v4l2_planes[0].data_offset = 0; | ||
| 936 | } | ||
| 937 | |||
| 862 | } | 938 | } |
| 863 | 939 | ||
| 864 | vb->v4l2_buf.field = b->field; | 940 | vb->v4l2_buf.field = b->field; |
| @@ -959,14 +1035,121 @@ static int __qbuf_mmap(struct vb2_buffer *vb, const struct v4l2_buffer *b) | |||
| 959 | } | 1035 | } |
| 960 | 1036 | ||
| 961 | /** | 1037 | /** |
| 1038 | * __qbuf_dmabuf() - handle qbuf of a DMABUF buffer | ||
| 1039 | */ | ||
| 1040 | static int __qbuf_dmabuf(struct vb2_buffer *vb, const struct v4l2_buffer *b) | ||
| 1041 | { | ||
| 1042 | struct v4l2_plane planes[VIDEO_MAX_PLANES]; | ||
| 1043 | struct vb2_queue *q = vb->vb2_queue; | ||
| 1044 | void *mem_priv; | ||
| 1045 | unsigned int plane; | ||
| 1046 | int ret; | ||
| 1047 | int write = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
| 1048 | |||
| 1049 | /* Verify and copy relevant information provided by the userspace */ | ||
| 1050 | __fill_vb2_buffer(vb, b, planes); | ||
| 1051 | |||
| 1052 | for (plane = 0; plane < vb->num_planes; ++plane) { | ||
| 1053 | struct dma_buf *dbuf = dma_buf_get(planes[plane].m.fd); | ||
| 1054 | |||
| 1055 | if (IS_ERR_OR_NULL(dbuf)) { | ||
| 1056 | dprintk(1, "qbuf: invalid dmabuf fd for plane %d\n", | ||
| 1057 | plane); | ||
| 1058 | ret = -EINVAL; | ||
| 1059 | goto err; | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | /* use DMABUF size if length is not provided */ | ||
| 1063 | if (planes[plane].length == 0) | ||
| 1064 | planes[plane].length = dbuf->size; | ||
| 1065 | |||
| 1066 | if (planes[plane].length < planes[plane].data_offset + | ||
| 1067 | q->plane_sizes[plane]) { | ||
| 1068 | ret = -EINVAL; | ||
| 1069 | goto err; | ||
| 1070 | } | ||
| 1071 | |||
| 1072 | /* Skip the plane if already verified */ | ||
| 1073 | if (dbuf == vb->planes[plane].dbuf && | ||
| 1074 | vb->v4l2_planes[plane].length == planes[plane].length) { | ||
| 1075 | dma_buf_put(dbuf); | ||
| 1076 | continue; | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | dprintk(1, "qbuf: buffer for plane %d changed\n", plane); | ||
| 1080 | |||
| 1081 | /* Release previously acquired memory if present */ | ||
| 1082 | __vb2_plane_dmabuf_put(q, &vb->planes[plane]); | ||
| 1083 | memset(&vb->v4l2_planes[plane], 0, sizeof(struct v4l2_plane)); | ||
| 1084 | |||
| 1085 | /* Acquire each plane's memory */ | ||
| 1086 | mem_priv = call_memop(q, attach_dmabuf, q->alloc_ctx[plane], | ||
| 1087 | dbuf, planes[plane].length, write); | ||
| 1088 | if (IS_ERR(mem_priv)) { | ||
| 1089 | dprintk(1, "qbuf: failed to attach dmabuf\n"); | ||
| 1090 | ret = PTR_ERR(mem_priv); | ||
| 1091 | dma_buf_put(dbuf); | ||
| 1092 | goto err; | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | vb->planes[plane].dbuf = dbuf; | ||
| 1096 | vb->planes[plane].mem_priv = mem_priv; | ||
| 1097 | } | ||
| 1098 | |||
| 1099 | /* TODO: This pins the buffer(s) with dma_buf_map_attachment()).. but | ||
| 1100 | * really we want to do this just before the DMA, not while queueing | ||
| 1101 | * the buffer(s).. | ||
| 1102 | */ | ||
| 1103 | for (plane = 0; plane < vb->num_planes; ++plane) { | ||
| 1104 | ret = call_memop(q, map_dmabuf, vb->planes[plane].mem_priv); | ||
| 1105 | if (ret) { | ||
| 1106 | dprintk(1, "qbuf: failed to map dmabuf for plane %d\n", | ||
| 1107 | plane); | ||
| 1108 | goto err; | ||
| 1109 | } | ||
| 1110 | vb->planes[plane].dbuf_mapped = 1; | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | /* | ||
| 1114 | * Call driver-specific initialization on the newly acquired buffer, | ||
| 1115 | * if provided. | ||
| 1116 | */ | ||
| 1117 | ret = call_qop(q, buf_init, vb); | ||
| 1118 | if (ret) { | ||
| 1119 | dprintk(1, "qbuf: buffer initialization failed\n"); | ||
| 1120 | goto err; | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | /* | ||
| 1124 | * Now that everything is in order, copy relevant information | ||
| 1125 | * provided by userspace. | ||
| 1126 | */ | ||
| 1127 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
| 1128 | vb->v4l2_planes[plane] = planes[plane]; | ||
| 1129 | |||
| 1130 | return 0; | ||
| 1131 | err: | ||
| 1132 | /* In case of errors, release planes that were already acquired */ | ||
| 1133 | __vb2_buf_dmabuf_put(vb); | ||
| 1134 | |||
| 1135 | return ret; | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | /** | ||
| 962 | * __enqueue_in_driver() - enqueue a vb2_buffer in driver for processing | 1139 | * __enqueue_in_driver() - enqueue a vb2_buffer in driver for processing |
| 963 | */ | 1140 | */ |
| 964 | static void __enqueue_in_driver(struct vb2_buffer *vb) | 1141 | static void __enqueue_in_driver(struct vb2_buffer *vb) |
| 965 | { | 1142 | { |
| 966 | struct vb2_queue *q = vb->vb2_queue; | 1143 | struct vb2_queue *q = vb->vb2_queue; |
| 1144 | unsigned int plane; | ||
| 967 | 1145 | ||
| 968 | vb->state = VB2_BUF_STATE_ACTIVE; | 1146 | vb->state = VB2_BUF_STATE_ACTIVE; |
| 969 | atomic_inc(&q->queued_count); | 1147 | atomic_inc(&q->queued_count); |
| 1148 | |||
| 1149 | /* sync buffers */ | ||
| 1150 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
| 1151 | call_memop(q, prepare, vb->planes[plane].mem_priv); | ||
| 1152 | |||
| 970 | q->ops->buf_queue(vb); | 1153 | q->ops->buf_queue(vb); |
| 971 | } | 1154 | } |
| 972 | 1155 | ||
| @@ -982,6 +1165,9 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) | |||
| 982 | case V4L2_MEMORY_USERPTR: | 1165 | case V4L2_MEMORY_USERPTR: |
| 983 | ret = __qbuf_userptr(vb, b); | 1166 | ret = __qbuf_userptr(vb, b); |
| 984 | break; | 1167 | break; |
| 1168 | case V4L2_MEMORY_DMABUF: | ||
| 1169 | ret = __qbuf_dmabuf(vb, b); | ||
| 1170 | break; | ||
| 985 | default: | 1171 | default: |
| 986 | WARN(1, "Invalid queue type\n"); | 1172 | WARN(1, "Invalid queue type\n"); |
| 987 | ret = -EINVAL; | 1173 | ret = -EINVAL; |
| @@ -1303,6 +1489,30 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q) | |||
| 1303 | EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); | 1489 | EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers); |
| 1304 | 1490 | ||
| 1305 | /** | 1491 | /** |
| 1492 | * __vb2_dqbuf() - bring back the buffer to the DEQUEUED state | ||
| 1493 | */ | ||
| 1494 | static void __vb2_dqbuf(struct vb2_buffer *vb) | ||
| 1495 | { | ||
| 1496 | struct vb2_queue *q = vb->vb2_queue; | ||
| 1497 | unsigned int i; | ||
| 1498 | |||
| 1499 | /* nothing to do if the buffer is already dequeued */ | ||
| 1500 | if (vb->state == VB2_BUF_STATE_DEQUEUED) | ||
| 1501 | return; | ||
| 1502 | |||
| 1503 | vb->state = VB2_BUF_STATE_DEQUEUED; | ||
| 1504 | |||
| 1505 | /* unmap DMABUF buffer */ | ||
| 1506 | if (q->memory == V4L2_MEMORY_DMABUF) | ||
| 1507 | for (i = 0; i < vb->num_planes; ++i) { | ||
| 1508 | if (!vb->planes[i].dbuf_mapped) | ||
| 1509 | continue; | ||
| 1510 | call_memop(q, unmap_dmabuf, vb->planes[i].mem_priv); | ||
| 1511 | vb->planes[i].dbuf_mapped = 0; | ||
| 1512 | } | ||
| 1513 | } | ||
| 1514 | |||
| 1515 | /** | ||
| 1306 | * vb2_dqbuf() - Dequeue a buffer to the userspace | 1516 | * vb2_dqbuf() - Dequeue a buffer to the userspace |
| 1307 | * @q: videobuf2 queue | 1517 | * @q: videobuf2 queue |
| 1308 | * @b: buffer structure passed from userspace to vidioc_dqbuf handler | 1518 | * @b: buffer structure passed from userspace to vidioc_dqbuf handler |
| @@ -1363,11 +1573,12 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) | |||
| 1363 | __fill_v4l2_buffer(vb, b); | 1573 | __fill_v4l2_buffer(vb, b); |
| 1364 | /* Remove from videobuf queue */ | 1574 | /* Remove from videobuf queue */ |
| 1365 | list_del(&vb->queued_entry); | 1575 | list_del(&vb->queued_entry); |
| 1576 | /* go back to dequeued state */ | ||
| 1577 | __vb2_dqbuf(vb); | ||
| 1366 | 1578 | ||
| 1367 | dprintk(1, "dqbuf of buffer %d, with state %d\n", | 1579 | dprintk(1, "dqbuf of buffer %d, with state %d\n", |
| 1368 | vb->v4l2_buf.index, vb->state); | 1580 | vb->v4l2_buf.index, vb->state); |
| 1369 | 1581 | ||
| 1370 | vb->state = VB2_BUF_STATE_DEQUEUED; | ||
| 1371 | return 0; | 1582 | return 0; |
| 1372 | } | 1583 | } |
| 1373 | EXPORT_SYMBOL_GPL(vb2_dqbuf); | 1584 | EXPORT_SYMBOL_GPL(vb2_dqbuf); |
| @@ -1406,7 +1617,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) | |||
| 1406 | * Reinitialize all buffers for next use. | 1617 | * Reinitialize all buffers for next use. |
| 1407 | */ | 1618 | */ |
| 1408 | for (i = 0; i < q->num_buffers; ++i) | 1619 | for (i = 0; i < q->num_buffers; ++i) |
| 1409 | q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED; | 1620 | __vb2_dqbuf(q->bufs[i]); |
| 1410 | } | 1621 | } |
| 1411 | 1622 | ||
| 1412 | /** | 1623 | /** |
| @@ -1540,6 +1751,79 @@ static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off, | |||
| 1540 | } | 1751 | } |
| 1541 | 1752 | ||
| 1542 | /** | 1753 | /** |
| 1754 | * vb2_expbuf() - Export a buffer as a file descriptor | ||
| 1755 | * @q: videobuf2 queue | ||
| 1756 | * @eb: export buffer structure passed from userspace to vidioc_expbuf | ||
| 1757 | * handler in driver | ||
| 1758 | * | ||
| 1759 | * The return values from this function are intended to be directly returned | ||
| 1760 | * from vidioc_expbuf handler in driver. | ||
| 1761 | */ | ||
| 1762 | int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) | ||
| 1763 | { | ||
| 1764 | struct vb2_buffer *vb = NULL; | ||
| 1765 | struct vb2_plane *vb_plane; | ||
| 1766 | int ret; | ||
| 1767 | struct dma_buf *dbuf; | ||
| 1768 | |||
| 1769 | if (q->memory != V4L2_MEMORY_MMAP) { | ||
| 1770 | dprintk(1, "Queue is not currently set up for mmap\n"); | ||
| 1771 | return -EINVAL; | ||
| 1772 | } | ||
| 1773 | |||
| 1774 | if (!q->mem_ops->get_dmabuf) { | ||
| 1775 | dprintk(1, "Queue does not support DMA buffer exporting\n"); | ||
| 1776 | return -EINVAL; | ||
| 1777 | } | ||
| 1778 | |||
| 1779 | if (eb->flags & ~O_CLOEXEC) { | ||
| 1780 | dprintk(1, "Queue does support only O_CLOEXEC flag\n"); | ||
| 1781 | return -EINVAL; | ||
| 1782 | } | ||
| 1783 | |||
| 1784 | if (eb->type != q->type) { | ||
| 1785 | dprintk(1, "qbuf: invalid buffer type\n"); | ||
| 1786 | return -EINVAL; | ||
| 1787 | } | ||
| 1788 | |||
| 1789 | if (eb->index >= q->num_buffers) { | ||
| 1790 | dprintk(1, "buffer index out of range\n"); | ||
| 1791 | return -EINVAL; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | vb = q->bufs[eb->index]; | ||
| 1795 | |||
| 1796 | if (eb->plane >= vb->num_planes) { | ||
| 1797 | dprintk(1, "buffer plane out of range\n"); | ||
| 1798 | return -EINVAL; | ||
| 1799 | } | ||
| 1800 | |||
| 1801 | vb_plane = &vb->planes[eb->plane]; | ||
| 1802 | |||
| 1803 | dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv); | ||
| 1804 | if (IS_ERR_OR_NULL(dbuf)) { | ||
| 1805 | dprintk(1, "Failed to export buffer %d, plane %d\n", | ||
| 1806 | eb->index, eb->plane); | ||
| 1807 | return -EINVAL; | ||
| 1808 | } | ||
| 1809 | |||
| 1810 | ret = dma_buf_fd(dbuf, eb->flags); | ||
| 1811 | if (ret < 0) { | ||
| 1812 | dprintk(3, "buffer %d, plane %d failed to export (%d)\n", | ||
| 1813 | eb->index, eb->plane, ret); | ||
| 1814 | dma_buf_put(dbuf); | ||
| 1815 | return ret; | ||
| 1816 | } | ||
| 1817 | |||
| 1818 | dprintk(3, "buffer %d, plane %d exported as %d descriptor\n", | ||
| 1819 | eb->index, eb->plane, ret); | ||
| 1820 | eb->fd = ret; | ||
| 1821 | |||
| 1822 | return 0; | ||
| 1823 | } | ||
| 1824 | EXPORT_SYMBOL_GPL(vb2_expbuf); | ||
| 1825 | |||
| 1826 | /** | ||
| 1543 | * vb2_mmap() - map video buffers into application address space | 1827 | * vb2_mmap() - map video buffers into application address space |
| 1544 | * @q: videobuf2 queue | 1828 | * @q: videobuf2 queue |
| 1545 | * @vma: vma passed to the mmap file operation handler in the driver | 1829 | * @vma: vma passed to the mmap file operation handler in the driver |
| @@ -2245,6 +2529,16 @@ int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | |||
| 2245 | } | 2529 | } |
| 2246 | EXPORT_SYMBOL_GPL(vb2_ioctl_streamoff); | 2530 | EXPORT_SYMBOL_GPL(vb2_ioctl_streamoff); |
| 2247 | 2531 | ||
| 2532 | int vb2_ioctl_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *p) | ||
| 2533 | { | ||
| 2534 | struct video_device *vdev = video_devdata(file); | ||
| 2535 | |||
| 2536 | if (vb2_queue_is_busy(vdev, file)) | ||
| 2537 | return -EBUSY; | ||
| 2538 | return vb2_expbuf(vdev->queue, p); | ||
| 2539 | } | ||
| 2540 | EXPORT_SYMBOL_GPL(vb2_ioctl_expbuf); | ||
| 2541 | |||
| 2248 | /* v4l2_file_operations helpers */ | 2542 | /* v4l2_file_operations helpers */ |
| 2249 | 2543 | ||
| 2250 | int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma) | 2544 | int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma) |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 4b7132660a93..10beaee7f0ae 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c | |||
| @@ -10,7 +10,10 @@ | |||
| 10 | * the Free Software Foundation. | 10 | * the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/dma-buf.h> | ||
| 13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/scatterlist.h> | ||
| 16 | #include <linux/sched.h> | ||
| 14 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 15 | #include <linux/dma-mapping.h> | 18 | #include <linux/dma-mapping.h> |
| 16 | 19 | ||
| @@ -23,40 +26,158 @@ struct vb2_dc_conf { | |||
| 23 | }; | 26 | }; |
| 24 | 27 | ||
| 25 | struct vb2_dc_buf { | 28 | struct vb2_dc_buf { |
| 26 | struct vb2_dc_conf *conf; | 29 | struct device *dev; |
| 27 | void *vaddr; | 30 | void *vaddr; |
| 28 | dma_addr_t dma_addr; | ||
| 29 | unsigned long size; | 31 | unsigned long size; |
| 30 | struct vm_area_struct *vma; | 32 | dma_addr_t dma_addr; |
| 31 | atomic_t refcount; | 33 | enum dma_data_direction dma_dir; |
| 34 | struct sg_table *dma_sgt; | ||
| 35 | |||
| 36 | /* MMAP related */ | ||
| 32 | struct vb2_vmarea_handler handler; | 37 | struct vb2_vmarea_handler handler; |
| 38 | atomic_t refcount; | ||
| 39 | struct sg_table *sgt_base; | ||
| 40 | |||
| 41 | /* USERPTR related */ | ||
| 42 | struct vm_area_struct *vma; | ||
| 43 | |||
| 44 | /* DMABUF related */ | ||
| 45 | struct dma_buf_attachment *db_attach; | ||
| 33 | }; | 46 | }; |
| 34 | 47 | ||
| 35 | static void vb2_dma_contig_put(void *buf_priv); | 48 | /*********************************************/ |
| 49 | /* scatterlist table functions */ | ||
| 50 | /*********************************************/ | ||
| 51 | |||
| 52 | |||
| 53 | static void vb2_dc_sgt_foreach_page(struct sg_table *sgt, | ||
| 54 | void (*cb)(struct page *pg)) | ||
| 55 | { | ||
| 56 | struct scatterlist *s; | ||
| 57 | unsigned int i; | ||
| 58 | |||
| 59 | for_each_sg(sgt->sgl, s, sgt->orig_nents, i) { | ||
| 60 | struct page *page = sg_page(s); | ||
| 61 | unsigned int n_pages = PAGE_ALIGN(s->offset + s->length) | ||
| 62 | >> PAGE_SHIFT; | ||
| 63 | unsigned int j; | ||
| 64 | |||
| 65 | for (j = 0; j < n_pages; ++j, ++page) | ||
| 66 | cb(page); | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | static unsigned long vb2_dc_get_contiguous_size(struct sg_table *sgt) | ||
| 71 | { | ||
| 72 | struct scatterlist *s; | ||
| 73 | dma_addr_t expected = sg_dma_address(sgt->sgl); | ||
| 74 | unsigned int i; | ||
| 75 | unsigned long size = 0; | ||
| 76 | |||
| 77 | for_each_sg(sgt->sgl, s, sgt->nents, i) { | ||
| 78 | if (sg_dma_address(s) != expected) | ||
| 79 | break; | ||
| 80 | expected = sg_dma_address(s) + sg_dma_len(s); | ||
| 81 | size += sg_dma_len(s); | ||
| 82 | } | ||
| 83 | return size; | ||
| 84 | } | ||
| 85 | |||
| 86 | /*********************************************/ | ||
| 87 | /* callbacks for all buffers */ | ||
| 88 | /*********************************************/ | ||
| 89 | |||
| 90 | static void *vb2_dc_cookie(void *buf_priv) | ||
| 91 | { | ||
| 92 | struct vb2_dc_buf *buf = buf_priv; | ||
| 93 | |||
| 94 | return &buf->dma_addr; | ||
| 95 | } | ||
| 96 | |||
| 97 | static void *vb2_dc_vaddr(void *buf_priv) | ||
| 98 | { | ||
| 99 | struct vb2_dc_buf *buf = buf_priv; | ||
| 100 | |||
| 101 | return buf->vaddr; | ||
| 102 | } | ||
| 103 | |||
| 104 | static unsigned int vb2_dc_num_users(void *buf_priv) | ||
| 105 | { | ||
| 106 | struct vb2_dc_buf *buf = buf_priv; | ||
| 107 | |||
| 108 | return atomic_read(&buf->refcount); | ||
| 109 | } | ||
| 110 | |||
| 111 | static void vb2_dc_prepare(void *buf_priv) | ||
| 112 | { | ||
| 113 | struct vb2_dc_buf *buf = buf_priv; | ||
| 114 | struct sg_table *sgt = buf->dma_sgt; | ||
| 115 | |||
| 116 | /* DMABUF exporter will flush the cache for us */ | ||
| 117 | if (!sgt || buf->db_attach) | ||
| 118 | return; | ||
| 119 | |||
| 120 | dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); | ||
| 121 | } | ||
| 122 | |||
| 123 | static void vb2_dc_finish(void *buf_priv) | ||
| 124 | { | ||
| 125 | struct vb2_dc_buf *buf = buf_priv; | ||
| 126 | struct sg_table *sgt = buf->dma_sgt; | ||
| 127 | |||
| 128 | /* DMABUF exporter will flush the cache for us */ | ||
| 129 | if (!sgt || buf->db_attach) | ||
| 130 | return; | ||
| 131 | |||
| 132 | dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); | ||
| 133 | } | ||
| 134 | |||
| 135 | /*********************************************/ | ||
| 136 | /* callbacks for MMAP buffers */ | ||
| 137 | /*********************************************/ | ||
| 138 | |||
| 139 | static void vb2_dc_put(void *buf_priv) | ||
| 140 | { | ||
| 141 | struct vb2_dc_buf *buf = buf_priv; | ||
| 142 | |||
| 143 | if (!atomic_dec_and_test(&buf->refcount)) | ||
| 144 | return; | ||
| 145 | |||
| 146 | if (buf->sgt_base) { | ||
| 147 | sg_free_table(buf->sgt_base); | ||
| 148 | kfree(buf->sgt_base); | ||
| 149 | } | ||
| 150 | dma_free_coherent(buf->dev, buf->size, buf->vaddr, buf->dma_addr); | ||
| 151 | put_device(buf->dev); | ||
| 152 | kfree(buf); | ||
| 153 | } | ||
| 36 | 154 | ||
| 37 | static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) | 155 | static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size) |
| 38 | { | 156 | { |
| 39 | struct vb2_dc_conf *conf = alloc_ctx; | 157 | struct vb2_dc_conf *conf = alloc_ctx; |
| 158 | struct device *dev = conf->dev; | ||
| 40 | struct vb2_dc_buf *buf; | 159 | struct vb2_dc_buf *buf; |
| 41 | 160 | ||
| 42 | buf = kzalloc(sizeof *buf, GFP_KERNEL); | 161 | buf = kzalloc(sizeof *buf, GFP_KERNEL); |
| 43 | if (!buf) | 162 | if (!buf) |
| 44 | return ERR_PTR(-ENOMEM); | 163 | return ERR_PTR(-ENOMEM); |
| 45 | 164 | ||
| 46 | buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->dma_addr, | 165 | /* align image size to PAGE_SIZE */ |
| 47 | GFP_KERNEL); | 166 | size = PAGE_ALIGN(size); |
| 167 | |||
| 168 | buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL); | ||
| 48 | if (!buf->vaddr) { | 169 | if (!buf->vaddr) { |
| 49 | dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", | 170 | dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); |
| 50 | size); | ||
| 51 | kfree(buf); | 171 | kfree(buf); |
| 52 | return ERR_PTR(-ENOMEM); | 172 | return ERR_PTR(-ENOMEM); |
| 53 | } | 173 | } |
| 54 | 174 | ||
| 55 | buf->conf = conf; | 175 | /* Prevent the device from being released while the buffer is used */ |
| 176 | buf->dev = get_device(dev); | ||
| 56 | buf->size = size; | 177 | buf->size = size; |
| 57 | 178 | ||
| 58 | buf->handler.refcount = &buf->refcount; | 179 | buf->handler.refcount = &buf->refcount; |
| 59 | buf->handler.put = vb2_dma_contig_put; | 180 | buf->handler.put = vb2_dc_put; |
| 60 | buf->handler.arg = buf; | 181 | buf->handler.arg = buf; |
| 61 | 182 | ||
| 62 | atomic_inc(&buf->refcount); | 183 | atomic_inc(&buf->refcount); |
| @@ -64,100 +185,569 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) | |||
| 64 | return buf; | 185 | return buf; |
| 65 | } | 186 | } |
| 66 | 187 | ||
| 67 | static void vb2_dma_contig_put(void *buf_priv) | 188 | static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma) |
| 68 | { | 189 | { |
| 69 | struct vb2_dc_buf *buf = buf_priv; | 190 | struct vb2_dc_buf *buf = buf_priv; |
| 191 | int ret; | ||
| 70 | 192 | ||
| 71 | if (atomic_dec_and_test(&buf->refcount)) { | 193 | if (!buf) { |
| 72 | dma_free_coherent(buf->conf->dev, buf->size, buf->vaddr, | 194 | printk(KERN_ERR "No buffer to map\n"); |
| 73 | buf->dma_addr); | 195 | return -EINVAL; |
| 74 | kfree(buf); | 196 | } |
| 197 | |||
| 198 | /* | ||
| 199 | * dma_mmap_* uses vm_pgoff as in-buffer offset, but we want to | ||
| 200 | * map whole buffer | ||
| 201 | */ | ||
| 202 | vma->vm_pgoff = 0; | ||
| 203 | |||
| 204 | ret = dma_mmap_coherent(buf->dev, vma, buf->vaddr, | ||
| 205 | buf->dma_addr, buf->size); | ||
| 206 | |||
| 207 | if (ret) { | ||
| 208 | pr_err("Remapping memory failed, error: %d\n", ret); | ||
| 209 | return ret; | ||
| 75 | } | 210 | } |
| 211 | |||
| 212 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | ||
| 213 | vma->vm_private_data = &buf->handler; | ||
| 214 | vma->vm_ops = &vb2_common_vm_ops; | ||
| 215 | |||
| 216 | vma->vm_ops->open(vma); | ||
| 217 | |||
| 218 | pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n", | ||
| 219 | __func__, (unsigned long)buf->dma_addr, vma->vm_start, | ||
| 220 | buf->size); | ||
| 221 | |||
| 222 | return 0; | ||
| 76 | } | 223 | } |
| 77 | 224 | ||
| 78 | static void *vb2_dma_contig_cookie(void *buf_priv) | 225 | /*********************************************/ |
| 226 | /* DMABUF ops for exporters */ | ||
| 227 | /*********************************************/ | ||
| 228 | |||
| 229 | struct vb2_dc_attachment { | ||
| 230 | struct sg_table sgt; | ||
| 231 | enum dma_data_direction dir; | ||
| 232 | }; | ||
| 233 | |||
| 234 | static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct device *dev, | ||
| 235 | struct dma_buf_attachment *dbuf_attach) | ||
| 79 | { | 236 | { |
| 80 | struct vb2_dc_buf *buf = buf_priv; | 237 | struct vb2_dc_attachment *attach; |
| 238 | unsigned int i; | ||
| 239 | struct scatterlist *rd, *wr; | ||
| 240 | struct sg_table *sgt; | ||
| 241 | struct vb2_dc_buf *buf = dbuf->priv; | ||
| 242 | int ret; | ||
| 81 | 243 | ||
| 82 | return &buf->dma_addr; | 244 | attach = kzalloc(sizeof(*attach), GFP_KERNEL); |
| 245 | if (!attach) | ||
| 246 | return -ENOMEM; | ||
| 247 | |||
| 248 | sgt = &attach->sgt; | ||
| 249 | /* Copy the buf->base_sgt scatter list to the attachment, as we can't | ||
| 250 | * map the same scatter list to multiple attachments at the same time. | ||
| 251 | */ | ||
| 252 | ret = sg_alloc_table(sgt, buf->sgt_base->orig_nents, GFP_KERNEL); | ||
| 253 | if (ret) { | ||
| 254 | kfree(attach); | ||
| 255 | return -ENOMEM; | ||
| 256 | } | ||
| 257 | |||
| 258 | rd = buf->sgt_base->sgl; | ||
| 259 | wr = sgt->sgl; | ||
| 260 | for (i = 0; i < sgt->orig_nents; ++i) { | ||
| 261 | sg_set_page(wr, sg_page(rd), rd->length, rd->offset); | ||
| 262 | rd = sg_next(rd); | ||
| 263 | wr = sg_next(wr); | ||
| 264 | } | ||
| 265 | |||
| 266 | attach->dir = DMA_NONE; | ||
| 267 | dbuf_attach->priv = attach; | ||
| 268 | |||
| 269 | return 0; | ||
| 83 | } | 270 | } |
| 84 | 271 | ||
| 85 | static void *vb2_dma_contig_vaddr(void *buf_priv) | 272 | static void vb2_dc_dmabuf_ops_detach(struct dma_buf *dbuf, |
| 273 | struct dma_buf_attachment *db_attach) | ||
| 86 | { | 274 | { |
| 87 | struct vb2_dc_buf *buf = buf_priv; | 275 | struct vb2_dc_attachment *attach = db_attach->priv; |
| 88 | if (!buf) | 276 | struct sg_table *sgt; |
| 89 | return NULL; | 277 | |
| 278 | if (!attach) | ||
| 279 | return; | ||
| 280 | |||
| 281 | sgt = &attach->sgt; | ||
| 282 | |||
| 283 | /* release the scatterlist cache */ | ||
| 284 | if (attach->dir != DMA_NONE) | ||
| 285 | dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, | ||
| 286 | attach->dir); | ||
| 287 | sg_free_table(sgt); | ||
| 288 | kfree(attach); | ||
| 289 | db_attach->priv = NULL; | ||
| 290 | } | ||
| 291 | |||
| 292 | static struct sg_table *vb2_dc_dmabuf_ops_map( | ||
| 293 | struct dma_buf_attachment *db_attach, enum dma_data_direction dir) | ||
| 294 | { | ||
| 295 | struct vb2_dc_attachment *attach = db_attach->priv; | ||
| 296 | /* stealing dmabuf mutex to serialize map/unmap operations */ | ||
| 297 | struct mutex *lock = &db_attach->dmabuf->lock; | ||
| 298 | struct sg_table *sgt; | ||
| 299 | int ret; | ||
| 300 | |||
| 301 | mutex_lock(lock); | ||
| 302 | |||
| 303 | sgt = &attach->sgt; | ||
| 304 | /* return previously mapped sg table */ | ||
| 305 | if (attach->dir == dir) { | ||
| 306 | mutex_unlock(lock); | ||
| 307 | return sgt; | ||
| 308 | } | ||
| 309 | |||
| 310 | /* release any previous cache */ | ||
| 311 | if (attach->dir != DMA_NONE) { | ||
| 312 | dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, | ||
| 313 | attach->dir); | ||
| 314 | attach->dir = DMA_NONE; | ||
| 315 | } | ||
| 316 | |||
| 317 | /* mapping to the client with new direction */ | ||
| 318 | ret = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, dir); | ||
| 319 | if (ret <= 0) { | ||
| 320 | pr_err("failed to map scatterlist\n"); | ||
| 321 | mutex_unlock(lock); | ||
| 322 | return ERR_PTR(-EIO); | ||
| 323 | } | ||
| 324 | |||
| 325 | attach->dir = dir; | ||
| 326 | |||
| 327 | mutex_unlock(lock); | ||
| 328 | |||
| 329 | return sgt; | ||
| 330 | } | ||
| 331 | |||
| 332 | static void vb2_dc_dmabuf_ops_unmap(struct dma_buf_attachment *db_attach, | ||
| 333 | struct sg_table *sgt, enum dma_data_direction dir) | ||
| 334 | { | ||
| 335 | /* nothing to be done here */ | ||
| 336 | } | ||
| 337 | |||
| 338 | static void vb2_dc_dmabuf_ops_release(struct dma_buf *dbuf) | ||
| 339 | { | ||
| 340 | /* drop reference obtained in vb2_dc_get_dmabuf */ | ||
| 341 | vb2_dc_put(dbuf->priv); | ||
| 342 | } | ||
| 343 | |||
| 344 | static void *vb2_dc_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum) | ||
| 345 | { | ||
| 346 | struct vb2_dc_buf *buf = dbuf->priv; | ||
| 347 | |||
| 348 | return buf->vaddr + pgnum * PAGE_SIZE; | ||
| 349 | } | ||
| 350 | |||
| 351 | static void *vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf) | ||
| 352 | { | ||
| 353 | struct vb2_dc_buf *buf = dbuf->priv; | ||
| 90 | 354 | ||
| 91 | return buf->vaddr; | 355 | return buf->vaddr; |
| 92 | } | 356 | } |
| 93 | 357 | ||
| 94 | static unsigned int vb2_dma_contig_num_users(void *buf_priv) | 358 | static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf, |
| 359 | struct vm_area_struct *vma) | ||
| 95 | { | 360 | { |
| 96 | struct vb2_dc_buf *buf = buf_priv; | 361 | return vb2_dc_mmap(dbuf->priv, vma); |
| 362 | } | ||
| 97 | 363 | ||
| 98 | return atomic_read(&buf->refcount); | 364 | static struct dma_buf_ops vb2_dc_dmabuf_ops = { |
| 365 | .attach = vb2_dc_dmabuf_ops_attach, | ||
| 366 | .detach = vb2_dc_dmabuf_ops_detach, | ||
| 367 | .map_dma_buf = vb2_dc_dmabuf_ops_map, | ||
| 368 | .unmap_dma_buf = vb2_dc_dmabuf_ops_unmap, | ||
| 369 | .kmap = vb2_dc_dmabuf_ops_kmap, | ||
| 370 | .kmap_atomic = vb2_dc_dmabuf_ops_kmap, | ||
| 371 | .vmap = vb2_dc_dmabuf_ops_vmap, | ||
| 372 | .mmap = vb2_dc_dmabuf_ops_mmap, | ||
| 373 | .release = vb2_dc_dmabuf_ops_release, | ||
| 374 | }; | ||
| 375 | |||
| 376 | static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) | ||
| 377 | { | ||
| 378 | int ret; | ||
| 379 | struct sg_table *sgt; | ||
| 380 | |||
| 381 | sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); | ||
| 382 | if (!sgt) { | ||
| 383 | dev_err(buf->dev, "failed to alloc sg table\n"); | ||
| 384 | return NULL; | ||
| 385 | } | ||
| 386 | |||
| 387 | ret = dma_get_sgtable(buf->dev, sgt, buf->vaddr, buf->dma_addr, | ||
| 388 | buf->size); | ||
| 389 | if (ret < 0) { | ||
| 390 | dev_err(buf->dev, "failed to get scatterlist from DMA API\n"); | ||
| 391 | kfree(sgt); | ||
| 392 | return NULL; | ||
| 393 | } | ||
| 394 | |||
| 395 | return sgt; | ||
| 99 | } | 396 | } |
| 100 | 397 | ||
| 101 | static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma) | 398 | static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv) |
| 102 | { | 399 | { |
| 103 | struct vb2_dc_buf *buf = buf_priv; | 400 | struct vb2_dc_buf *buf = buf_priv; |
| 401 | struct dma_buf *dbuf; | ||
| 104 | 402 | ||
| 105 | if (!buf) { | 403 | if (!buf->sgt_base) |
| 106 | printk(KERN_ERR "No buffer to map\n"); | 404 | buf->sgt_base = vb2_dc_get_base_sgt(buf); |
| 107 | return -EINVAL; | 405 | |
| 406 | if (WARN_ON(!buf->sgt_base)) | ||
| 407 | return NULL; | ||
| 408 | |||
| 409 | dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, 0); | ||
| 410 | if (IS_ERR(dbuf)) | ||
| 411 | return NULL; | ||
| 412 | |||
| 413 | /* dmabuf keeps reference to vb2 buffer */ | ||
| 414 | atomic_inc(&buf->refcount); | ||
| 415 | |||
| 416 | return dbuf; | ||
| 417 | } | ||
| 418 | |||
| 419 | /*********************************************/ | ||
| 420 | /* callbacks for USERPTR buffers */ | ||
| 421 | /*********************************************/ | ||
| 422 | |||
| 423 | static inline int vma_is_io(struct vm_area_struct *vma) | ||
| 424 | { | ||
| 425 | return !!(vma->vm_flags & (VM_IO | VM_PFNMAP)); | ||
| 426 | } | ||
| 427 | |||
| 428 | static int vb2_dc_get_user_pages(unsigned long start, struct page **pages, | ||
| 429 | int n_pages, struct vm_area_struct *vma, int write) | ||
| 430 | { | ||
| 431 | if (vma_is_io(vma)) { | ||
| 432 | unsigned int i; | ||
| 433 | |||
| 434 | for (i = 0; i < n_pages; ++i, start += PAGE_SIZE) { | ||
| 435 | unsigned long pfn; | ||
| 436 | int ret = follow_pfn(vma, start, &pfn); | ||
| 437 | |||
| 438 | if (ret) { | ||
| 439 | pr_err("no page for address %lu\n", start); | ||
| 440 | return ret; | ||
| 441 | } | ||
| 442 | pages[i] = pfn_to_page(pfn); | ||
| 443 | } | ||
| 444 | } else { | ||
| 445 | int n; | ||
| 446 | |||
| 447 | n = get_user_pages(current, current->mm, start & PAGE_MASK, | ||
| 448 | n_pages, write, 1, pages, NULL); | ||
| 449 | /* negative error means that no page was pinned */ | ||
| 450 | n = max(n, 0); | ||
| 451 | if (n != n_pages) { | ||
| 452 | pr_err("got only %d of %d user pages\n", n, n_pages); | ||
| 453 | while (n) | ||
| 454 | put_page(pages[--n]); | ||
| 455 | return -EFAULT; | ||
| 456 | } | ||
| 108 | } | 457 | } |
| 109 | 458 | ||
| 110 | return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size, | 459 | return 0; |
| 111 | &vb2_common_vm_ops, &buf->handler); | ||
| 112 | } | 460 | } |
| 113 | 461 | ||
| 114 | static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr, | 462 | static void vb2_dc_put_dirty_page(struct page *page) |
| 115 | unsigned long size, int write) | ||
| 116 | { | 463 | { |
| 464 | set_page_dirty_lock(page); | ||
| 465 | put_page(page); | ||
| 466 | } | ||
| 467 | |||
| 468 | static void vb2_dc_put_userptr(void *buf_priv) | ||
| 469 | { | ||
| 470 | struct vb2_dc_buf *buf = buf_priv; | ||
| 471 | struct sg_table *sgt = buf->dma_sgt; | ||
| 472 | |||
| 473 | dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); | ||
| 474 | if (!vma_is_io(buf->vma)) | ||
| 475 | vb2_dc_sgt_foreach_page(sgt, vb2_dc_put_dirty_page); | ||
| 476 | |||
| 477 | sg_free_table(sgt); | ||
| 478 | kfree(sgt); | ||
| 479 | vb2_put_vma(buf->vma); | ||
| 480 | kfree(buf); | ||
| 481 | } | ||
| 482 | |||
| 483 | static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, | ||
| 484 | unsigned long size, int write) | ||
| 485 | { | ||
| 486 | struct vb2_dc_conf *conf = alloc_ctx; | ||
| 117 | struct vb2_dc_buf *buf; | 487 | struct vb2_dc_buf *buf; |
| 488 | unsigned long start; | ||
| 489 | unsigned long end; | ||
| 490 | unsigned long offset; | ||
| 491 | struct page **pages; | ||
| 492 | int n_pages; | ||
| 493 | int ret = 0; | ||
| 118 | struct vm_area_struct *vma; | 494 | struct vm_area_struct *vma; |
| 119 | dma_addr_t dma_addr = 0; | 495 | struct sg_table *sgt; |
| 120 | int ret; | 496 | unsigned long contig_size; |
| 497 | unsigned long dma_align = dma_get_cache_alignment(); | ||
| 498 | |||
| 499 | /* Only cache aligned DMA transfers are reliable */ | ||
| 500 | if (!IS_ALIGNED(vaddr | size, dma_align)) { | ||
| 501 | pr_debug("user data must be aligned to %lu bytes\n", dma_align); | ||
| 502 | return ERR_PTR(-EINVAL); | ||
| 503 | } | ||
| 504 | |||
| 505 | if (!size) { | ||
| 506 | pr_debug("size is zero\n"); | ||
| 507 | return ERR_PTR(-EINVAL); | ||
| 508 | } | ||
| 121 | 509 | ||
| 122 | buf = kzalloc(sizeof *buf, GFP_KERNEL); | 510 | buf = kzalloc(sizeof *buf, GFP_KERNEL); |
| 123 | if (!buf) | 511 | if (!buf) |
| 124 | return ERR_PTR(-ENOMEM); | 512 | return ERR_PTR(-ENOMEM); |
| 125 | 513 | ||
| 126 | ret = vb2_get_contig_userptr(vaddr, size, &vma, &dma_addr); | 514 | buf->dev = conf->dev; |
| 515 | buf->dma_dir = write ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
| 516 | |||
| 517 | start = vaddr & PAGE_MASK; | ||
| 518 | offset = vaddr & ~PAGE_MASK; | ||
| 519 | end = PAGE_ALIGN(vaddr + size); | ||
| 520 | n_pages = (end - start) >> PAGE_SHIFT; | ||
| 521 | |||
| 522 | pages = kmalloc(n_pages * sizeof(pages[0]), GFP_KERNEL); | ||
| 523 | if (!pages) { | ||
| 524 | ret = -ENOMEM; | ||
| 525 | pr_err("failed to allocate pages table\n"); | ||
| 526 | goto fail_buf; | ||
| 527 | } | ||
| 528 | |||
| 529 | /* current->mm->mmap_sem is taken by videobuf2 core */ | ||
| 530 | vma = find_vma(current->mm, vaddr); | ||
| 531 | if (!vma) { | ||
| 532 | pr_err("no vma for address %lu\n", vaddr); | ||
| 533 | ret = -EFAULT; | ||
| 534 | goto fail_pages; | ||
| 535 | } | ||
| 536 | |||
| 537 | if (vma->vm_end < vaddr + size) { | ||
| 538 | pr_err("vma at %lu is too small for %lu bytes\n", vaddr, size); | ||
| 539 | ret = -EFAULT; | ||
| 540 | goto fail_pages; | ||
| 541 | } | ||
| 542 | |||
| 543 | buf->vma = vb2_get_vma(vma); | ||
| 544 | if (!buf->vma) { | ||
| 545 | pr_err("failed to copy vma\n"); | ||
| 546 | ret = -ENOMEM; | ||
| 547 | goto fail_pages; | ||
| 548 | } | ||
| 549 | |||
| 550 | /* extract page list from userspace mapping */ | ||
| 551 | ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, write); | ||
| 127 | if (ret) { | 552 | if (ret) { |
| 128 | printk(KERN_ERR "Failed acquiring VMA for vaddr 0x%08lx\n", | 553 | pr_err("failed to get user pages\n"); |
| 129 | vaddr); | 554 | goto fail_vma; |
| 130 | kfree(buf); | 555 | } |
| 131 | return ERR_PTR(ret); | 556 | |
| 557 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); | ||
| 558 | if (!sgt) { | ||
| 559 | pr_err("failed to allocate sg table\n"); | ||
| 560 | ret = -ENOMEM; | ||
| 561 | goto fail_get_user_pages; | ||
| 562 | } | ||
| 563 | |||
| 564 | ret = sg_alloc_table_from_pages(sgt, pages, n_pages, | ||
| 565 | offset, size, GFP_KERNEL); | ||
| 566 | if (ret) { | ||
| 567 | pr_err("failed to initialize sg table\n"); | ||
| 568 | goto fail_sgt; | ||
| 132 | } | 569 | } |
| 133 | 570 | ||
| 571 | /* pages are no longer needed */ | ||
| 572 | kfree(pages); | ||
| 573 | pages = NULL; | ||
| 574 | |||
| 575 | sgt->nents = dma_map_sg(buf->dev, sgt->sgl, sgt->orig_nents, | ||
| 576 | buf->dma_dir); | ||
| 577 | if (sgt->nents <= 0) { | ||
| 578 | pr_err("failed to map scatterlist\n"); | ||
| 579 | ret = -EIO; | ||
| 580 | goto fail_sgt_init; | ||
| 581 | } | ||
| 582 | |||
| 583 | contig_size = vb2_dc_get_contiguous_size(sgt); | ||
| 584 | if (contig_size < size) { | ||
| 585 | pr_err("contiguous mapping is too small %lu/%lu\n", | ||
| 586 | contig_size, size); | ||
| 587 | ret = -EFAULT; | ||
| 588 | goto fail_map_sg; | ||
| 589 | } | ||
| 590 | |||
| 591 | buf->dma_addr = sg_dma_address(sgt->sgl); | ||
| 134 | buf->size = size; | 592 | buf->size = size; |
| 135 | buf->dma_addr = dma_addr; | 593 | buf->dma_sgt = sgt; |
| 136 | buf->vma = vma; | ||
| 137 | 594 | ||
| 138 | return buf; | 595 | return buf; |
| 596 | |||
| 597 | fail_map_sg: | ||
| 598 | dma_unmap_sg(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); | ||
| 599 | |||
| 600 | fail_sgt_init: | ||
| 601 | if (!vma_is_io(buf->vma)) | ||
| 602 | vb2_dc_sgt_foreach_page(sgt, put_page); | ||
| 603 | sg_free_table(sgt); | ||
| 604 | |||
| 605 | fail_sgt: | ||
| 606 | kfree(sgt); | ||
| 607 | |||
| 608 | fail_get_user_pages: | ||
| 609 | if (pages && !vma_is_io(buf->vma)) | ||
| 610 | while (n_pages) | ||
| 611 | put_page(pages[--n_pages]); | ||
| 612 | |||
| 613 | fail_vma: | ||
| 614 | vb2_put_vma(buf->vma); | ||
| 615 | |||
| 616 | fail_pages: | ||
| 617 | kfree(pages); /* kfree is NULL-proof */ | ||
| 618 | |||
| 619 | fail_buf: | ||
| 620 | kfree(buf); | ||
| 621 | |||
| 622 | return ERR_PTR(ret); | ||
| 139 | } | 623 | } |
| 140 | 624 | ||
| 141 | static void vb2_dma_contig_put_userptr(void *mem_priv) | 625 | /*********************************************/ |
| 626 | /* callbacks for DMABUF buffers */ | ||
| 627 | /*********************************************/ | ||
| 628 | |||
| 629 | static int vb2_dc_map_dmabuf(void *mem_priv) | ||
| 142 | { | 630 | { |
| 143 | struct vb2_dc_buf *buf = mem_priv; | 631 | struct vb2_dc_buf *buf = mem_priv; |
| 632 | struct sg_table *sgt; | ||
| 633 | unsigned long contig_size; | ||
| 144 | 634 | ||
| 145 | if (!buf) | 635 | if (WARN_ON(!buf->db_attach)) { |
| 636 | pr_err("trying to pin a non attached buffer\n"); | ||
| 637 | return -EINVAL; | ||
| 638 | } | ||
| 639 | |||
| 640 | if (WARN_ON(buf->dma_sgt)) { | ||
| 641 | pr_err("dmabuf buffer is already pinned\n"); | ||
| 642 | return 0; | ||
| 643 | } | ||
| 644 | |||
| 645 | /* get the associated scatterlist for this buffer */ | ||
| 646 | sgt = dma_buf_map_attachment(buf->db_attach, buf->dma_dir); | ||
| 647 | if (IS_ERR_OR_NULL(sgt)) { | ||
| 648 | pr_err("Error getting dmabuf scatterlist\n"); | ||
| 649 | return -EINVAL; | ||
| 650 | } | ||
| 651 | |||
| 652 | /* checking if dmabuf is big enough to store contiguous chunk */ | ||
| 653 | contig_size = vb2_dc_get_contiguous_size(sgt); | ||
| 654 | if (contig_size < buf->size) { | ||
| 655 | pr_err("contiguous chunk is too small %lu/%lu b\n", | ||
| 656 | contig_size, buf->size); | ||
| 657 | dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); | ||
| 658 | return -EFAULT; | ||
| 659 | } | ||
| 660 | |||
| 661 | buf->dma_addr = sg_dma_address(sgt->sgl); | ||
| 662 | buf->dma_sgt = sgt; | ||
| 663 | |||
| 664 | return 0; | ||
| 665 | } | ||
| 666 | |||
| 667 | static void vb2_dc_unmap_dmabuf(void *mem_priv) | ||
| 668 | { | ||
| 669 | struct vb2_dc_buf *buf = mem_priv; | ||
| 670 | struct sg_table *sgt = buf->dma_sgt; | ||
| 671 | |||
| 672 | if (WARN_ON(!buf->db_attach)) { | ||
| 673 | pr_err("trying to unpin a not attached buffer\n"); | ||
| 146 | return; | 674 | return; |
| 675 | } | ||
| 147 | 676 | ||
| 148 | vb2_put_vma(buf->vma); | 677 | if (WARN_ON(!sgt)) { |
| 678 | pr_err("dmabuf buffer is already unpinned\n"); | ||
| 679 | return; | ||
| 680 | } | ||
| 681 | |||
| 682 | dma_buf_unmap_attachment(buf->db_attach, sgt, buf->dma_dir); | ||
| 683 | |||
| 684 | buf->dma_addr = 0; | ||
| 685 | buf->dma_sgt = NULL; | ||
| 686 | } | ||
| 687 | |||
| 688 | static void vb2_dc_detach_dmabuf(void *mem_priv) | ||
| 689 | { | ||
| 690 | struct vb2_dc_buf *buf = mem_priv; | ||
| 691 | |||
| 692 | /* if vb2 works correctly you should never detach mapped buffer */ | ||
| 693 | if (WARN_ON(buf->dma_addr)) | ||
| 694 | vb2_dc_unmap_dmabuf(buf); | ||
| 695 | |||
| 696 | /* detach this attachment */ | ||
| 697 | dma_buf_detach(buf->db_attach->dmabuf, buf->db_attach); | ||
| 149 | kfree(buf); | 698 | kfree(buf); |
| 150 | } | 699 | } |
| 151 | 700 | ||
| 701 | static void *vb2_dc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf, | ||
| 702 | unsigned long size, int write) | ||
| 703 | { | ||
| 704 | struct vb2_dc_conf *conf = alloc_ctx; | ||
| 705 | struct vb2_dc_buf *buf; | ||
| 706 | struct dma_buf_attachment *dba; | ||
| 707 | |||
| 708 | if (dbuf->size < size) | ||
| 709 | return ERR_PTR(-EFAULT); | ||
| 710 | |||
| 711 | buf = kzalloc(sizeof(*buf), GFP_KERNEL); | ||
| 712 | if (!buf) | ||
| 713 | return ERR_PTR(-ENOMEM); | ||
| 714 | |||
| 715 | buf->dev = conf->dev; | ||
| 716 | /* create attachment for the dmabuf with the user device */ | ||
| 717 | dba = dma_buf_attach(dbuf, buf->dev); | ||
| 718 | if (IS_ERR(dba)) { | ||
| 719 | pr_err("failed to attach dmabuf\n"); | ||
| 720 | kfree(buf); | ||
| 721 | return dba; | ||
| 722 | } | ||
| 723 | |||
| 724 | buf->dma_dir = write ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
| 725 | buf->size = size; | ||
| 726 | buf->db_attach = dba; | ||
| 727 | |||
| 728 | return buf; | ||
| 729 | } | ||
| 730 | |||
| 731 | /*********************************************/ | ||
| 732 | /* DMA CONTIG exported functions */ | ||
| 733 | /*********************************************/ | ||
| 734 | |||
| 152 | const struct vb2_mem_ops vb2_dma_contig_memops = { | 735 | const struct vb2_mem_ops vb2_dma_contig_memops = { |
| 153 | .alloc = vb2_dma_contig_alloc, | 736 | .alloc = vb2_dc_alloc, |
| 154 | .put = vb2_dma_contig_put, | 737 | .put = vb2_dc_put, |
| 155 | .cookie = vb2_dma_contig_cookie, | 738 | .get_dmabuf = vb2_dc_get_dmabuf, |
| 156 | .vaddr = vb2_dma_contig_vaddr, | 739 | .cookie = vb2_dc_cookie, |
| 157 | .mmap = vb2_dma_contig_mmap, | 740 | .vaddr = vb2_dc_vaddr, |
| 158 | .get_userptr = vb2_dma_contig_get_userptr, | 741 | .mmap = vb2_dc_mmap, |
| 159 | .put_userptr = vb2_dma_contig_put_userptr, | 742 | .get_userptr = vb2_dc_get_userptr, |
| 160 | .num_users = vb2_dma_contig_num_users, | 743 | .put_userptr = vb2_dc_put_userptr, |
| 744 | .prepare = vb2_dc_prepare, | ||
| 745 | .finish = vb2_dc_finish, | ||
| 746 | .map_dmabuf = vb2_dc_map_dmabuf, | ||
| 747 | .unmap_dmabuf = vb2_dc_unmap_dmabuf, | ||
| 748 | .attach_dmabuf = vb2_dc_attach_dmabuf, | ||
| 749 | .detach_dmabuf = vb2_dc_detach_dmabuf, | ||
| 750 | .num_users = vb2_dc_num_users, | ||
| 161 | }; | 751 | }; |
| 162 | EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); | 752 | EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); |
| 163 | 753 | ||
diff --git a/drivers/media/v4l2-core/videobuf2-memops.c b/drivers/media/v4l2-core/videobuf2-memops.c index 051ea3571b20..81c1ad8b2cf1 100644 --- a/drivers/media/v4l2-core/videobuf2-memops.c +++ b/drivers/media/v4l2-core/videobuf2-memops.c | |||
| @@ -137,46 +137,6 @@ int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, | |||
| 137 | EXPORT_SYMBOL_GPL(vb2_get_contig_userptr); | 137 | EXPORT_SYMBOL_GPL(vb2_get_contig_userptr); |
| 138 | 138 | ||
| 139 | /** | 139 | /** |
| 140 | * vb2_mmap_pfn_range() - map physical pages to userspace | ||
| 141 | * @vma: virtual memory region for the mapping | ||
| 142 | * @paddr: starting physical address of the memory to be mapped | ||
| 143 | * @size: size of the memory to be mapped | ||
| 144 | * @vm_ops: vm operations to be assigned to the created area | ||
| 145 | * @priv: private data to be associated with the area | ||
| 146 | * | ||
| 147 | * Returns 0 on success. | ||
| 148 | */ | ||
| 149 | int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, | ||
| 150 | unsigned long size, | ||
| 151 | const struct vm_operations_struct *vm_ops, | ||
| 152 | void *priv) | ||
| 153 | { | ||
| 154 | int ret; | ||
| 155 | |||
| 156 | size = min_t(unsigned long, vma->vm_end - vma->vm_start, size); | ||
| 157 | |||
| 158 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
| 159 | ret = remap_pfn_range(vma, vma->vm_start, paddr >> PAGE_SHIFT, | ||
| 160 | size, vma->vm_page_prot); | ||
| 161 | if (ret) { | ||
| 162 | printk(KERN_ERR "Remapping memory failed, error: %d\n", ret); | ||
| 163 | return ret; | ||
| 164 | } | ||
| 165 | |||
| 166 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | ||
| 167 | vma->vm_private_data = priv; | ||
| 168 | vma->vm_ops = vm_ops; | ||
| 169 | |||
| 170 | vma->vm_ops->open(vma); | ||
| 171 | |||
| 172 | pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n", | ||
| 173 | __func__, paddr, vma->vm_start, size); | ||
| 174 | |||
| 175 | return 0; | ||
| 176 | } | ||
| 177 | EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range); | ||
| 178 | |||
| 179 | /** | ||
| 180 | * vb2_common_vm_open() - increase refcount of the vma | 140 | * vb2_common_vm_open() - increase refcount of the vma |
| 181 | * @vma: virtual memory region for the mapping | 141 | * @vma: virtual memory region for the mapping |
| 182 | * | 142 | * |
diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c index 94efa04d8d55..a47fd4f589a1 100644 --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c | |||
| @@ -30,6 +30,7 @@ struct vb2_vmalloc_buf { | |||
| 30 | unsigned int n_pages; | 30 | unsigned int n_pages; |
| 31 | atomic_t refcount; | 31 | atomic_t refcount; |
| 32 | struct vb2_vmarea_handler handler; | 32 | struct vb2_vmarea_handler handler; |
| 33 | struct dma_buf *dbuf; | ||
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 35 | static void vb2_vmalloc_put(void *buf_priv); | 36 | static void vb2_vmalloc_put(void *buf_priv); |
| @@ -207,11 +208,66 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct vm_area_struct *vma) | |||
| 207 | return 0; | 208 | return 0; |
| 208 | } | 209 | } |
| 209 | 210 | ||
| 211 | /*********************************************/ | ||
| 212 | /* callbacks for DMABUF buffers */ | ||
| 213 | /*********************************************/ | ||
| 214 | |||
| 215 | static int vb2_vmalloc_map_dmabuf(void *mem_priv) | ||
| 216 | { | ||
| 217 | struct vb2_vmalloc_buf *buf = mem_priv; | ||
| 218 | |||
| 219 | buf->vaddr = dma_buf_vmap(buf->dbuf); | ||
| 220 | |||
| 221 | return buf->vaddr ? 0 : -EFAULT; | ||
| 222 | } | ||
| 223 | |||
| 224 | static void vb2_vmalloc_unmap_dmabuf(void *mem_priv) | ||
| 225 | { | ||
| 226 | struct vb2_vmalloc_buf *buf = mem_priv; | ||
| 227 | |||
| 228 | dma_buf_vunmap(buf->dbuf, buf->vaddr); | ||
| 229 | buf->vaddr = NULL; | ||
| 230 | } | ||
| 231 | |||
| 232 | static void vb2_vmalloc_detach_dmabuf(void *mem_priv) | ||
| 233 | { | ||
| 234 | struct vb2_vmalloc_buf *buf = mem_priv; | ||
| 235 | |||
| 236 | if (buf->vaddr) | ||
| 237 | dma_buf_vunmap(buf->dbuf, buf->vaddr); | ||
| 238 | |||
| 239 | kfree(buf); | ||
| 240 | } | ||
| 241 | |||
| 242 | static void *vb2_vmalloc_attach_dmabuf(void *alloc_ctx, struct dma_buf *dbuf, | ||
| 243 | unsigned long size, int write) | ||
| 244 | { | ||
| 245 | struct vb2_vmalloc_buf *buf; | ||
| 246 | |||
| 247 | if (dbuf->size < size) | ||
| 248 | return ERR_PTR(-EFAULT); | ||
| 249 | |||
| 250 | buf = kzalloc(sizeof(*buf), GFP_KERNEL); | ||
| 251 | if (!buf) | ||
| 252 | return ERR_PTR(-ENOMEM); | ||
| 253 | |||
| 254 | buf->dbuf = dbuf; | ||
| 255 | buf->write = write; | ||
| 256 | buf->size = size; | ||
| 257 | |||
| 258 | return buf; | ||
| 259 | } | ||
| 260 | |||
| 261 | |||
| 210 | const struct vb2_mem_ops vb2_vmalloc_memops = { | 262 | const struct vb2_mem_ops vb2_vmalloc_memops = { |
| 211 | .alloc = vb2_vmalloc_alloc, | 263 | .alloc = vb2_vmalloc_alloc, |
| 212 | .put = vb2_vmalloc_put, | 264 | .put = vb2_vmalloc_put, |
| 213 | .get_userptr = vb2_vmalloc_get_userptr, | 265 | .get_userptr = vb2_vmalloc_get_userptr, |
| 214 | .put_userptr = vb2_vmalloc_put_userptr, | 266 | .put_userptr = vb2_vmalloc_put_userptr, |
| 267 | .map_dmabuf = vb2_vmalloc_map_dmabuf, | ||
| 268 | .unmap_dmabuf = vb2_vmalloc_unmap_dmabuf, | ||
| 269 | .attach_dmabuf = vb2_vmalloc_attach_dmabuf, | ||
| 270 | .detach_dmabuf = vb2_vmalloc_detach_dmabuf, | ||
| 215 | .vaddr = vb2_vmalloc_vaddr, | 271 | .vaddr = vb2_vmalloc_vaddr, |
| 216 | .mmap = vb2_vmalloc_mmap, | 272 | .mmap = vb2_vmalloc_mmap, |
| 217 | .num_users = vb2_vmalloc_num_users, | 273 | .num_users = vb2_vmalloc_num_users, |
