summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx231xx
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cx231xx')
-rw-r--r--linux/drivers/media/video/cx231xx/Kconfig52
-rw-r--r--linux/drivers/media/video/cx231xx/Makefile4
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-audio.c2
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-avcore.c1171
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-cards.c469
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-core.c20
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-i2c.c47
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.c34
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.h8
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-vbi.c4
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-video.c119
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx.h60
12 files changed, 860 insertions, 1130 deletions
diff --git a/linux/drivers/media/video/cx231xx/Kconfig b/linux/drivers/media/video/cx231xx/Kconfig
index 7a6700fb0..477d4ab5e 100644
--- a/linux/drivers/media/video/cx231xx/Kconfig
+++ b/linux/drivers/media/video/cx231xx/Kconfig
@@ -1,35 +1,35 @@
config VIDEO_CX231XX
- tristate "Conexant cx231xx USB video capture support"
- depends on VIDEO_DEV && I2C && INPUT
- select VIDEO_TUNER
- select VIDEO_TVEEPROM
- select VIDEO_IR
- select VIDEOBUF_VMALLOC
- select VIDEO_CX25840
- select VIDEO_CX231XX_ALSA
+ tristate "Conexant cx231xx USB video capture support"
+ depends on VIDEO_DEV && I2C && INPUT
+ select VIDEO_TUNER
+ select VIDEO_TVEEPROM
+ select VIDEO_IR
+ select VIDEOBUF_VMALLOC
+ select VIDEO_CX25840
- ---help---
- This is a video4linux driver for Conexant 231xx USB based TV cards.
+ ---help---
+ This is a video4linux driver for Conexant 231xx USB based TV cards.
- To compile this driver as a module, choose M here: the
- module will be called cx231xx
+ To compile this driver as a module, choose M here: the
+ module will be called cx231xx
config VIDEO_CX231XX_ALSA
- tristate "Conexant Cx231xx ALSA audio module"
- depends on VIDEO_CX231XX && SND
- select SND_PCM
+ tristate "Conexant Cx231xx ALSA audio module"
+ depends on VIDEO_CX231XX && SND
+ select SND_PCM
- ---help---
- This is an ALSA driver for Cx231xx USB based TV cards.
+ ---help---
+ This is an ALSA driver for Cx231xx USB based TV cards.
- To compile this driver as a module, choose M here: the
- module will be called cx231xx-alsa
+ To compile this driver as a module, choose M here: the
+ module will be called cx231xx-alsa
config VIDEO_CX231XX_DVB
- tristate "DVB/ATSC Support for Cx231xx based TV cards"
- depends on VIDEO_CX231XX && DVB_CORE
- select VIDEOBUF_DVB
- select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMISE
- ---help---
- This adds support for DVB cards based on the
- Conexant cx231xx chips.
+ tristate "DVB/ATSC Support for Cx231xx based TV cards"
+ depends on VIDEO_CX231XX && DVB_CORE
+ select VIDEOBUF_DVB
+ select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMISE
+
+ ---help---
+ This adds support for DVB cards based on the
+ Conexant cx231xx chips.
diff --git a/linux/drivers/media/video/cx231xx/Makefile b/linux/drivers/media/video/cx231xx/Makefile
index 1dad93619..755dd0ce6 100644
--- a/linux/drivers/media/video/cx231xx/Makefile
+++ b/linux/drivers/media/video/cx231xx/Makefile
@@ -1,8 +1,10 @@
cx231xx-objs := cx231xx-video.o cx231xx-i2c.o cx231xx-cards.o cx231xx-core.o \
cx231xx-avcore.o cx231xx-pcb-cfg.o cx231xx-vbi.o
+cx231xx-alsa-objs := cx231xx-audio.o
+
obj-$(CONFIG_VIDEO_CX231XX) += cx231xx.o
-obj-$(CONFIG_VIDEO_CX231XX_ALSA) += cx231xx-audio.o
+obj-$(CONFIG_VIDEO_CX231XX_ALSA) += cx231xx-alsa.o
obj-$(CONFIG_VIDEO_CX231XX_DVB) += cx231xx-dvb.o
EXTRA_CFLAGS += -Idrivers/media/video
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-audio.c b/linux/drivers/media/video/cx231xx/cx231xx-audio.c
index b6f099042..0f7fb3ca7 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-audio.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-audio.c
@@ -599,7 +599,7 @@ static int cx231xx_audio_init(struct cx231xx *dev)
bEndpointAddress);
adev->num_alt = uif->num_altsetting;
- cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n",
+ cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
adev->end_point_addr, adev->num_alt);
adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL);
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-avcore.c b/linux/drivers/media/video/cx231xx/cx231xx-avcore.c
index 226299d62..1be3881be 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-avcore.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-avcore.c
@@ -40,54 +40,77 @@
#include "cx231xx.h"
/******************************************************************************
- * C O L I B R I - B L O C K C O N T R O L functions *
+ -: BLOCK ARRANGEMENT :-
+ I2S block ----------------------|
+ [I2S audio] |
+ |
+ Analog Front End --> Direct IF -|-> Cx25840 --> Audio
+ [video & audio] | [Audio]
+ |
+ |-> Cx25840 --> Video
+ [Video]
+
+*******************************************************************************/
+
+/******************************************************************************
+ * A F E - B L O C K C O N T R O L functions *
+ * [ANALOG FRONT END] *
******************************************************************************/
-int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count)
+static int afe_write_byte(struct cx231xx *dev, u16 saddr, u8 data)
+{
+ return cx231xx_write_i2c_data(dev, AFE_DEVICE_ADDRESS,
+ saddr, 2, data, 1);
+}
+
+static int afe_read_byte(struct cx231xx *dev, u16 saddr, u8 *data)
+{
+ int status;
+ u32 temp = 0;
+
+ status = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS,
+ saddr, 2, &temp, 1);
+ *data = (u8) temp;
+ return status;
+}
+
+int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count)
{
int status = 0;
u8 temp = 0;
- u32 colibri_power_status = 0;
+ u8 afe_power_status = 0;
int i = 0;
/* super block initialize */
temp = (u8) (ref_count & 0xff);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_TUNE2, 2, temp, 1);
+ status = afe_write_byte(dev, SUP_BLK_TUNE2, temp);
if (status < 0)
return status;
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_TUNE2, 2,
- &colibri_power_status, 1);
+ status = afe_read_byte(dev, SUP_BLK_TUNE2, &afe_power_status);
if (status < 0)
return status;
temp = (u8) ((ref_count & 0x300) >> 8);
temp |= 0x40;
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_TUNE1, 2, temp, 1);
+ status = afe_write_byte(dev, SUP_BLK_TUNE1, temp);
if (status < 0)
return status;
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_PLL2, 2, 0x0f, 1);
+ status = afe_write_byte(dev, SUP_BLK_PLL2, 0x0f);
if (status < 0)
return status;
/* enable pll */
- while (colibri_power_status != 0x18) {
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2, 0x18, 1);
+ while (afe_power_status != 0x18) {
+ status = afe_write_byte(dev, SUP_BLK_PWRDN, 0x18);
if (status < 0) {
cx231xx_info(
": Init Super Block failed in send cmd\n");
break;
}
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status, 1);
- colibri_power_status &= 0xff;
+ status = afe_read_byte(dev, SUP_BLK_PWRDN, &afe_power_status);
+ afe_power_status &= 0xff;
if (status < 0) {
cx231xx_info(
": Init Super Block failed in receive cmd\n");
@@ -106,101 +129,75 @@ int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count)
return status;
/* start tuning filter */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- SUP_BLK_TUNE3, 2, 0x40, 1);
+ status = afe_write_byte(dev, SUP_BLK_TUNE3, 0x40);
if (status < 0)
return status;
msleep(5);
/* exit tuning */
- status =
- cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_TUNE3,
- 2, 0x00, 1);
+ status = afe_write_byte(dev, SUP_BLK_TUNE3, 0x00);
return status;
}
-int cx231xx_colibri_init_channels(struct cx231xx *dev)
+int cx231xx_afe_init_channels(struct cx231xx *dev)
{
int status = 0;
/* power up all 3 channels, clear pd_buffer */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2, 0x00, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, 0x00, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2, 0x00, 1);
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1, 0x00);
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2, 0x00);
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3, 0x00);
/* Enable quantizer calibration */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_COM_QUANT, 2, 0x02, 1);
+ status = afe_write_byte(dev, ADC_COM_QUANT, 0x02);
/* channel initialize, force modulator (fb) reset */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH1, 2, 0x17, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH2, 2, 0x17, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH3, 2, 0x17, 1);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH1, 0x17);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH2, 0x17);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH3, 0x17);
/* start quantilizer calibration */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_CAL_ATEST_CH1, 2, 0x10, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_CAL_ATEST_CH2, 2, 0x10, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_CAL_ATEST_CH3, 2, 0x10, 1);
+ status = afe_write_byte(dev, ADC_CAL_ATEST_CH1, 0x10);
+ status = afe_write_byte(dev, ADC_CAL_ATEST_CH2, 0x10);
+ status = afe_write_byte(dev, ADC_CAL_ATEST_CH3, 0x10);
msleep(5);
/* exit modulator (fb) reset */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH1, 2, 0x07, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH2, 2, 0x07, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_FB_FRCRST_CH3, 2, 0x07, 1);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH1, 0x07);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH2, 0x07);
+ status = afe_write_byte(dev, ADC_FB_FRCRST_CH3, 0x07);
/* enable the pre_clamp in each channel for single-ended input */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_NTF_PRECLMP_EN_CH1, 2, 0xf0, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_NTF_PRECLMP_EN_CH2, 2, 0xf0, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_NTF_PRECLMP_EN_CH3, 2, 0xf0, 1);
+ status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH1, 0xf0);
+ status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH2, 0xf0);
+ status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH3, 0xf0);
/* use diode instead of resistor, so set term_en to 0, res_en to 0 */
- status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8,
+ status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH1, 3, 7, 0x00);
- status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8,
+ status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH2, 3, 7, 0x00);
- status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8,
+ status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH3, 3, 7, 0x00);
/* dynamic element matching off */
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_DCSERVO_DEM_CH1, 2, 0x03, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_DCSERVO_DEM_CH2, 2, 0x03, 1);
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_DCSERVO_DEM_CH3, 2, 0x03, 1);
+ status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH1, 0x03);
+ status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH2, 0x03);
+ status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH3, 0x03);
return status;
}
-int cx231xx_colibri_setup_AFE_for_baseband(struct cx231xx *dev)
+int cx231xx_afe_setup_AFE_for_baseband(struct cx231xx *dev)
{
- u32 c_value = 0;
+ u8 c_value = 0;
int status = 0;
- status =
- cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, &c_value, 1);
+ status = afe_read_byte(dev, ADC_PWRDN_CLAMP_CH2, &c_value);
c_value &= (~(0x50));
- status =
- cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, c_value, 1);
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2, c_value);
return status;
}
@@ -214,52 +211,44 @@ int cx231xx_colibri_setup_AFE_for_baseband(struct cx231xx *dev)
channel 2 ----- pin 5 to pin8(in reg is 5-8)
channel 3 ----- pin 9 to pin 12(in reg is 9-11)
*/
-int cx231xx_colibri_set_input_mux(struct cx231xx *dev, u32 input_mux)
+int cx231xx_afe_set_input_mux(struct cx231xx *dev, u32 input_mux)
{
u8 ch1_setting = (u8) input_mux;
u8 ch2_setting = (u8) (input_mux >> 8);
u8 ch3_setting = (u8) (input_mux >> 16);
int status = 0;
- u32 value = 0;
+ u8 value = 0;
if (ch1_setting != 0) {
- status =
- cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH1, 2, &value, 1);
+ status = afe_read_byte(dev, ADC_INPUT_CH1, &value);
value &= (!INPUT_SEL_MASK);
value |= (ch1_setting - 1) << 4;
value &= 0xff;
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH1, 2, value, 1);
+ status = afe_write_byte(dev, ADC_INPUT_CH1, value);
}
if (ch2_setting != 0) {
- status =
- cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH2, 2, &value, 1);
+ status = afe_read_byte(dev, ADC_INPUT_CH2, &value);
value &= (!INPUT_SEL_MASK);
value |= (ch2_setting - 1) << 4;
value &= 0xff;
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH2, 2, value, 1);
+ status = afe_write_byte(dev, ADC_INPUT_CH2, value);
}
/* For ch3_setting, the value to put in the register is
7 less than the input number */
if (ch3_setting != 0) {
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH3, 2, &value, 1);
+ status = afe_read_byte(dev, ADC_INPUT_CH3, &value);
value &= (!INPUT_SEL_MASK);
value |= (ch3_setting - 1) << 4;
value &= 0xff;
- status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH3, 2, value, 1);
+ status = afe_write_byte(dev, ADC_INPUT_CH3, value);
}
return status;
}
-int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode)
+int cx231xx_afe_set_mode(struct cx231xx *dev, enum AFE_MODE mode)
{
int status = 0;
@@ -273,7 +262,7 @@ int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode)
/* SetupAFEforLowIF(); */
break;
case AFE_MODE_BASEBAND:
- status = cx231xx_colibri_setup_AFE_for_baseband(dev);
+ status = cx231xx_afe_setup_AFE_for_baseband(dev);
break;
case AFE_MODE_EU_HI_IF:
/* SetupAFEforEuHiIF(); */
@@ -286,110 +275,76 @@ int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode)
break;
}
- if ((mode != dev->colibri_mode) &&
+ if ((mode != dev->afe_mode) &&
(dev->video_input == CX231XX_VMUX_TELEVISION))
- status = cx231xx_colibri_adjust_ref_count(dev,
+ status = cx231xx_afe_adjust_ref_count(dev,
CX231XX_VMUX_TELEVISION);
- dev->colibri_mode = mode;
+ dev->afe_mode = mode;
return status;
}
-int cx231xx_colibri_update_power_control(struct cx231xx *dev,
+int cx231xx_afe_update_power_control(struct cx231xx *dev,
enum AV_MODE avmode)
{
- u32 colibri_power_status = 0;
+ u8 afe_power_status = 0;
int status = 0;
switch (dev->model) {
case CX231XX_BOARD_CNXT_RDE_250:
case CX231XX_BOARD_CNXT_RDU_250:
if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
- while (colibri_power_status != (FLD_PWRDN_TUNING_BIAS |
+ while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
FLD_PWRDN_ENABLE_PLL)) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
+ status = afe_write_byte(dev, SUP_BLK_PWRDN,
FLD_PWRDN_TUNING_BIAS |
- FLD_PWRDN_ENABLE_PLL,
- 1);
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status,
- 1);
+ FLD_PWRDN_ENABLE_PLL);
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
if (status < 0)
break;
}
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2, 0x00,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, 0x00,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2, 0x00,
- 1);
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x00);
} else if (avmode == POLARIS_AVMODE_DIGITAL) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2, 0x70,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, 0x70,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2, 0x70,
- 1);
-
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status, 1);
- colibri_power_status |= FLD_PWRDN_PD_BANDGAP |
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x70);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x70);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x70);
+
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
+ afe_power_status |= FLD_PWRDN_PD_BANDGAP |
FLD_PWRDN_PD_BIAS |
FLD_PWRDN_PD_TUNECK;
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- colibri_power_status, 1);
+ status |= afe_write_byte(dev, SUP_BLK_PWRDN,
+ afe_power_status);
} else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) {
- while (colibri_power_status != (FLD_PWRDN_TUNING_BIAS |
+ while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
FLD_PWRDN_ENABLE_PLL)) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
+ status = afe_write_byte(dev, SUP_BLK_PWRDN,
FLD_PWRDN_TUNING_BIAS |
- FLD_PWRDN_ENABLE_PLL,
- 1);
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status,
- 1);
+ FLD_PWRDN_ENABLE_PLL);
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
if (status < 0)
break;
}
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2, 0x00,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2, 0x00,
- 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2, 0x00,
- 1);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x00);
} else {
cx231xx_info("Invalid AV mode input\n");
status = -1;
@@ -397,92 +352,56 @@ int cx231xx_colibri_update_power_control(struct cx231xx *dev,
break;
default:
if (avmode == POLARIS_AVMODE_ANALOGT_TV) {
- while (colibri_power_status != (FLD_PWRDN_TUNING_BIAS |
+ while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
FLD_PWRDN_ENABLE_PLL)) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
+ status = afe_write_byte(dev, SUP_BLK_PWRDN,
FLD_PWRDN_TUNING_BIAS |
- FLD_PWRDN_ENABLE_PLL,
- 1);
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status,
- 1);
+ FLD_PWRDN_ENABLE_PLL);
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
if (status < 0)
break;
}
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2,
- 0x40, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2,
- 0x40, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2,
- 0x00, 1);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x40);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x40);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x00);
} else if (avmode == POLARIS_AVMODE_DIGITAL) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2,
- 0x70, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2,
- 0x70, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2,
- 0x70, 1);
-
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status,
- 1);
- colibri_power_status |= FLD_PWRDN_PD_BANDGAP |
+ status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x70);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x70);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x70);
+
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
+ afe_power_status |= FLD_PWRDN_PD_BANDGAP |
FLD_PWRDN_PD_BIAS |
FLD_PWRDN_PD_TUNECK;
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- colibri_power_status,
- 1);
+ status |= afe_write_byte(dev, SUP_BLK_PWRDN,
+ afe_power_status);
} else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) {
- while (colibri_power_status != (FLD_PWRDN_TUNING_BIAS |
+ while (afe_power_status != (FLD_PWRDN_TUNING_BIAS |
FLD_PWRDN_ENABLE_PLL)) {
- status = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
+ status = afe_write_byte(dev, SUP_BLK_PWRDN,
FLD_PWRDN_TUNING_BIAS |
- FLD_PWRDN_ENABLE_PLL,
- 1);
- status |= cx231xx_read_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- SUP_BLK_PWRDN, 2,
- &colibri_power_status,
- 1);
+ FLD_PWRDN_ENABLE_PLL);
+ status |= afe_read_byte(dev, SUP_BLK_PWRDN,
+ &afe_power_status);
if (status < 0)
break;
}
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH1, 2,
- 0x00, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH2, 2,
- 0x00, 1);
- status |= cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
- ADC_PWRDN_CLAMP_CH3, 2,
- 0x40, 1);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2,
+ 0x00);
+ status |= afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3,
+ 0x40);
} else {
cx231xx_info("Invalid AV mode input\n");
status = -1;
@@ -492,48 +411,44 @@ int cx231xx_colibri_update_power_control(struct cx231xx *dev,
return status;
}
-int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input)
+int cx231xx_afe_adjust_ref_count(struct cx231xx *dev, u32 video_input)
{
- u32 input_mode = 0;
- u32 ntf_mode = 0;
+ u8 input_mode = 0;
+ u8 ntf_mode = 0;
int status = 0;
dev->video_input = video_input;
if (video_input == CX231XX_VMUX_TELEVISION) {
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH3, 2, &input_mode, 1);
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_NTF_PRECLMP_EN_CH3, 2, &ntf_mode,
- 1);
+ status = afe_read_byte(dev, ADC_INPUT_CH3, &input_mode);
+ status = afe_read_byte(dev, ADC_NTF_PRECLMP_EN_CH3,
+ &ntf_mode);
} else {
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_INPUT_CH1, 2, &input_mode, 1);
- status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
- ADC_NTF_PRECLMP_EN_CH1, 2, &ntf_mode,
- 1);
+ status = afe_read_byte(dev, ADC_INPUT_CH1, &input_mode);
+ status = afe_read_byte(dev, ADC_NTF_PRECLMP_EN_CH1,
+ &ntf_mode);
}
input_mode = (ntf_mode & 0x3) | ((input_mode & 0x6) << 1);
switch (input_mode) {
case SINGLE_ENDED:
- dev->colibri_ref_count = 0x23C;
+ dev->afe_ref_count = 0x23C;
break;
case LOW_IF:
- dev->colibri_ref_count = 0x24C;
+ dev->afe_ref_count = 0x24C;
break;
case EU_IF:
- dev->colibri_ref_count = 0x258;
+ dev->afe_ref_count = 0x258;
break;
case US_IF:
- dev->colibri_ref_count = 0x260;
+ dev->afe_ref_count = 0x260;
break;
default:
break;
}
- status = cx231xx_colibri_init_super_block(dev, dev->colibri_ref_count);
+ status = cx231xx_afe_init_super_block(dev, dev->afe_ref_count);
return status;
}
@@ -541,6 +456,35 @@ int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input)
/******************************************************************************
* V I D E O / A U D I O D E C O D E R C O N T R O L functions *
******************************************************************************/
+static int vid_blk_write_byte(struct cx231xx *dev, u16 saddr, u8 data)
+{
+ return cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS,
+ saddr, 2, data, 1);
+}
+
+static int vid_blk_read_byte(struct cx231xx *dev, u16 saddr, u8 *data)
+{
+ int status;
+ u32 temp = 0;
+
+ status = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
+ saddr, 2, &temp, 1);
+ *data = (u8) temp;
+ return status;
+}
+
+static int vid_blk_write_word(struct cx231xx *dev, u16 saddr, u32 data)
+{
+ return cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS,
+ saddr, 2, data, 4);
+}
+
+static int vid_blk_read_word(struct cx231xx *dev, u16 saddr, u32 *data)
+{
+ return cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
+ saddr, 2, data, 4);
+}
+
int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
{
int status = 0;
@@ -601,29 +545,27 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
u32 value = 0;
if (pin_type != dev->video_input) {
- status = cx231xx_colibri_adjust_ref_count(dev, pin_type);
+ status = cx231xx_afe_adjust_ref_count(dev, pin_type);
if (status < 0) {
cx231xx_errdev("%s: adjust_ref_count :Failed to set"
- "Colibri input mux - errCode [%d]!\n",
+ "AFE input mux - errCode [%d]!\n",
__func__, status);
return status;
}
}
- /* call colibri block to set video inputs */
- status = cx231xx_colibri_set_input_mux(dev, input);
+ /* call afe block to set video inputs */
+ status = cx231xx_afe_set_input_mux(dev, input);
if (status < 0) {
cx231xx_errdev("%s: set_input_mux :Failed to set"
- " Colibri input mux - errCode [%d]!\n",
+ " AFE input mux - errCode [%d]!\n",
__func__, status);
return status;
}
switch (pin_type) {
case CX231XX_VMUX_COMPOSITE1:
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, &value, 4);
+ status = vid_blk_read_word(dev, AFE_CTRL, &value);
value |= (0 << 13) | (1 << 4);
value &= ~(1 << 5);
@@ -631,18 +573,15 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value &= (~(0x1ff8000));
/* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */
value |= 0x1000000;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, value, 4);
+ status = vid_blk_write_word(dev, AFE_CTRL, value);
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2, &value, 4);
+ status = vid_blk_read_word(dev, OUT_CTRL1, &value);
value |= (1 << 7);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2, value, 4);
+ status = vid_blk_write_word(dev, OUT_CTRL1, value);
/* Set vip 1.1 output mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
OUT_CTRL1,
FLD_OUT_MODE,
OUT_MODE_VIP11);
@@ -657,8 +596,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
}
/* Read the DFE_CTRL1 register */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2, &value, 4);
+ status = vid_blk_read_word(dev, DFE_CTRL1, &value);
/* enable the VBI_GATE_EN */
value |= FLD_VBI_GATE_EN;
@@ -667,35 +605,31 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value |= FLD_VGA_AUTO_EN;
/* Write it back */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2, value, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL1, value);
/* Disable auto config of registers */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_ACFG_DIS,
cx231xx_set_field(FLD_ACFG_DIS, 1));
/* Set CVBS input mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_INPUT_MODE,
cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0));
break;
case CX231XX_VMUX_SVIDEO:
/* Disable the use of DIF */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, &value, 4);
+ status = vid_blk_read_word(dev, AFE_CTRL, &value);
/* set [24:23] [22:15] to 0 */
value &= (~(0x1ff8000));
/* set FUNC_MODE[24:23] = 2
IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */
value |= 0x1000010;
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, value, 4);
+ status = vid_blk_write_word(dev, AFE_CTRL, value);
/* Tell DIF object to go to baseband mode */
status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
@@ -707,9 +641,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
}
/* Read the DFE_CTRL1 register */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2, &value, 4);
+ status = vid_blk_read_word(dev, DFE_CTRL1, &value);
/* enable the VBI_GATE_EN */
value |= FLD_VBI_GATE_EN;
@@ -718,27 +650,23 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value |= FLD_VGA_AUTO_EN;
/* Write it back */
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2, value, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL1, value);
/* Disable auto config of registers */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_ACFG_DIS,
cx231xx_set_field(FLD_ACFG_DIS, 1));
/* Set YC input mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL,
FLD_INPUT_MODE,
cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_YC_1));
/* Chroma to ADC2 */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, &value, 4);
+ status = vid_blk_read_word(dev, AFE_CTRL, &value);
value |= FLD_CHROMA_IN_SEL; /* set the chroma in select */
/* Clear VGA_SEL_CH2 and VGA_SEL_CH3 (bits 7 and 8)
@@ -746,11 +674,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
rather than audio. Only one of the two will be in use. */
value &= ~(FLD_VGA_SEL_CH2 | FLD_VGA_SEL_CH3);
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2, value, 4);
+ status = vid_blk_write_word(dev, AFE_CTRL, value);
- status = cx231xx_colibri_set_mode(dev, AFE_MODE_BASEBAND);
+ status = cx231xx_afe_set_mode(dev, AFE_MODE_BASEBAND);
break;
case CX231XX_VMUX_TELEVISION:
case CX231XX_VMUX_CABLE:
@@ -760,10 +686,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
case CX231XX_BOARD_CNXT_RDU_250:
/* Disable the use of DIF */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, AFE_CTRL, &value);
value |= (0 << 13) | (1 << 4);
value &= ~(1 << 5);
@@ -771,24 +694,15 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value &= (~(0x1FF8000));
/* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */
value |= 0x1000000;
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2,
- value, 4);
-
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2,
- &value, 4);
+ status = vid_blk_write_word(dev, AFE_CTRL, value);
+
+ status = vid_blk_read_word(dev, OUT_CTRL1, &value);
value |= (1 << 7);
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2,
- value, 4);
+ status = vid_blk_write_word(dev, OUT_CTRL1, value);
/* Set vip 1.1 output mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
OUT_CTRL1, FLD_OUT_MODE,
OUT_MODE_VIP11);
@@ -803,10 +717,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
}
/* Read the DFE_CTRL1 register */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, DFE_CTRL1, &value);
/* enable the VBI_GATE_EN */
value |= FLD_VBI_GATE_EN;
@@ -815,20 +726,17 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value |= FLD_VGA_AUTO_EN;
/* Write it back */
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2,
- value, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL1, value);
/* Disable auto config of registers */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_ACFG_DIS,
cx231xx_set_field(FLD_ACFG_DIS, 1));
/* Set CVBS input mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_INPUT_MODE,
cx231xx_set_field(FLD_INPUT_MODE,
INPUT_MODE_CVBS_0));
@@ -846,25 +754,16 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
}
/* Make sure bypass is cleared */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DIF_MISC_CTRL,
- 2, &value, 4);
+ status = vid_blk_read_word(dev, DIF_MISC_CTRL, &value);
/* Clear the bypass bit */
value &= ~FLD_DIF_DIF_BYPASS;
/* Enable the use of the DIF block */
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DIF_MISC_CTRL,
- 2, value, 4);
+ status = vid_blk_write_word(dev, DIF_MISC_CTRL, value);
/* Read the DFE_CTRL1 register */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, DFE_CTRL1, &value);
/* Disable the VBI_GATE_EN */
value &= ~FLD_VBI_GATE_EN;
@@ -874,10 +773,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value |= FLD_VGA_AUTO_EN | FLD_AGC_AUTO_EN | 0x00200000;
/* Write it back */
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2,
- value, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL1, value);
/* Wait until AGC locks up */
msleep(1);
@@ -886,39 +782,30 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
value &= ~(FLD_VGA_AUTO_EN);
/* Write it back */
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL1, 2,
- value, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL1, value);
/* Enable Polaris B0 AGC output */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- PIN_CTRL, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, PIN_CTRL, &value);
value |= (FLD_OEF_AGC_RF) |
(FLD_OEF_AGC_IFVGA) |
(FLD_OEF_AGC_IF);
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- PIN_CTRL, 2,
- value, 4);
+ status = vid_blk_write_word(dev, PIN_CTRL, value);
/* Set vip 1.1 output mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
OUT_CTRL1, FLD_OUT_MODE,
OUT_MODE_VIP11);
/* Disable auto config of registers */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_ACFG_DIS,
cx231xx_set_field(FLD_ACFG_DIS, 1));
/* Set CVBS input mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
MODE_CTRL, FLD_INPUT_MODE,
cx231xx_set_field(FLD_INPUT_MODE,
INPUT_MODE_CVBS_0));
@@ -928,17 +815,11 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
/* Clear clamp for channels 2 and 3 (bit 16-17) */
/* Clear droop comp (bit 19-20) */
/* Set VGA_SEL (for audio control) (bit 7-8) */
- status = cx231xx_read_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, AFE_CTRL, &value);
value |= FLD_VGA_SEL_CH3 | FLD_VGA_SEL_CH2;
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AFE_CTRL, 2,
- value, 4);
+ status = vid_blk_write_word(dev, AFE_CTRL, value);
break;
}
@@ -947,17 +828,14 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev,
/* Set raw VBI mode */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
OUT_CTRL1, FLD_VBIHACTRAW_EN,
cx231xx_set_field(FLD_VBIHACTRAW_EN, 1));
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2,
- &value, 4);
+ status = vid_blk_read_word(dev, OUT_CTRL1, &value);
if (value & 0x02) {
value |= (1 << 19);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- OUT_CTRL1, 2, value, 4);
+ status = vid_blk_write_word(dev, OUT_CTRL1, value);
}
return status;
@@ -976,9 +854,7 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
(unsigned int)dev->norm);
/* Change the DFE_CTRL3 bp_percent to fix flagging */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DFE_CTRL3, 2,
- 0xCD3F0280, 4);
+ status = vid_blk_write_word(dev, DFE_CTRL3, 0xCD3F0280);
if (dev->norm & (V4L2_STD_NTSC | V4L2_STD_PAL_M)) {
cx231xx_info("do_mode_ctrl_overrides NTSC\n");
@@ -986,22 +862,22 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
/* Move the close caption lines out of active video,
adjust the active video start point */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
VERT_TIM_CTRL,
FLD_VBLANK_CNT, 0x18);
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
VERT_TIM_CTRL,
FLD_VACTIVE_CNT,
0x1E6000);
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
VERT_TIM_CTRL,
FLD_V656BLANK_CNT,
0x1E000000);
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
HORIZ_TIM_CTRL,
FLD_HBLANK_CNT,
cx231xx_set_field
@@ -1009,12 +885,12 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
} else if (dev->norm & V4L2_STD_SECAM) {
cx231xx_info("do_mode_ctrl_overrides SECAM\n");
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
VERT_TIM_CTRL,
FLD_VBLANK_CNT, 0x24);
/* Adjust the active video horizontal start point */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
HORIZ_TIM_CTRL,
FLD_HBLANK_CNT,
cx231xx_set_field
@@ -1022,12 +898,12 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
} else {
cx231xx_info("do_mode_ctrl_overrides PAL\n");
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
VERT_TIM_CTRL,
FLD_VBLANK_CNT, 0x24);
/* Adjust the active video horizontal start point */
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
HORIZ_TIM_CTRL,
FLD_HBLANK_CNT,
cx231xx_set_field
@@ -1047,7 +923,7 @@ int cx231xx_set_audio_input(struct cx231xx *dev, u8 input)
ainput = AUDIO_INPUT_TUNER_TV;
break;
case CX231XX_AMUX_LINE_IN:
- status = cx231xx_flatiron_set_audio_input(dev, input);
+ status = cx231xx_i2s_blk_set_audio_input(dev, input);
ainput = AUDIO_INPUT_LINE;
break;
default:
@@ -1064,71 +940,55 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
{
u32 dwval;
int status;
- u32 gen_ctrl;
+ u8 gen_ctrl;
u32 value = 0;
/* Put it in soft reset */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- GENERAL_CTL, 2, &gen_ctrl, 1);
+ status = vid_blk_read_byte(dev, GENERAL_CTL, &gen_ctrl);
gen_ctrl |= 1;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- GENERAL_CTL, 2, gen_ctrl, 1);
+ status = vid_blk_write_byte(dev, GENERAL_CTL, gen_ctrl);
switch (audio_input) {
case AUDIO_INPUT_LINE:
/* setup AUD_IO control from Merlin paralle output */
value = cx231xx_set_field(FLD_AUD_CHAN1_SRC,
AUD_CHAN_SRC_PARALLEL);
- status = cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
- AUD_IO_CTRL, 2, value, 4);
+ status = vid_blk_write_word(dev, AUD_IO_CTRL, value);
/* setup input to Merlin, SRC2 connect to AC97
bypass upsample-by-2, slave mode, sony mode, left justify
adr 091c, dat 01000000 */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- AC97_CTL,
- 2, &dwval, 4);
+ status = vid_blk_read_word(dev, AC97_CTL, &dwval);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- AC97_CTL, 2,
- (dwval | FLD_AC97_UP2X_BYPASS), 4);
+ status = vid_blk_write_word(dev, AC97_CTL,
+ (dwval | FLD_AC97_UP2X_BYPASS));
/* select the parallel1 and SRC3 */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- BAND_OUT_SEL, 2,
+ status = vid_blk_write_word(dev, BAND_OUT_SEL,
cx231xx_set_field(FLD_SRC3_IN_SEL, 0x0) |
cx231xx_set_field(FLD_SRC3_CLK_SEL, 0x0) |
- cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x0),
- 4);
+ cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x0));
/* unmute all, AC97 in, independence mode
adr 08d0, data 0x00063073 */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_CTL1, 2, 0x00063073, 4);
+ status = vid_blk_write_word(dev, PATH1_CTL1, 0x00063073);
/* set AVC maximum threshold, adr 08d4, dat ffff0024 */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_VOL_CTL, 2, &dwval, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_VOL_CTL, 2,
- (dwval | FLD_PATH1_AVC_THRESHOLD),
- 4);
+ status = vid_blk_read_word(dev, PATH1_VOL_CTL, &dwval);
+ status = vid_blk_write_word(dev, PATH1_VOL_CTL,
+ (dwval | FLD_PATH1_AVC_THRESHOLD));
/* set SC maximum threshold, adr 08ec, dat ffffb3a3 */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_SC_CTL, 2, &dwval, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_SC_CTL, 2,
- (dwval | FLD_PATH1_SC_THRESHOLD), 4);
+ status = vid_blk_read_word(dev, PATH1_SC_CTL, &dwval);
+ status = vid_blk_write_word(dev, PATH1_SC_CTL,
+ (dwval | FLD_PATH1_SC_THRESHOLD));
break;
case AUDIO_INPUT_TUNER_TV:
default:
/* Setup SRC sources and clocks */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- BAND_OUT_SEL, 2,
+ status = vid_blk_write_word(dev, BAND_OUT_SEL,
cx231xx_set_field(FLD_SRC6_IN_SEL, 0x00) |
cx231xx_set_field(FLD_SRC6_CLK_SEL, 0x01) |
cx231xx_set_field(FLD_SRC5_IN_SEL, 0x00) |
@@ -1141,29 +1001,26 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
cx231xx_set_field(FLD_AC97_SRC_SEL, 0x03) |
cx231xx_set_field(FLD_I2S_SRC_SEL, 0x00) |
cx231xx_set_field(FLD_PARALLEL2_SRC_SEL, 0x02) |
- cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x01), 4);
+ cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x01));
/* Setup the AUD_IO control */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- AUD_IO_CTRL, 2,
+ status = vid_blk_write_word(dev, AUD_IO_CTRL,
cx231xx_set_field(FLD_I2S_PORT_DIR, 0x00) |
cx231xx_set_field(FLD_I2S_OUT_SRC, 0x00) |
cx231xx_set_field(FLD_AUD_CHAN3_SRC, 0x00) |
cx231xx_set_field(FLD_AUD_CHAN2_SRC, 0x00) |
- cx231xx_set_field(FLD_AUD_CHAN1_SRC, 0x03), 4);
+ cx231xx_set_field(FLD_AUD_CHAN1_SRC, 0x03));
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_CTL1, 2, 0x1F063870, 4);
+ status = vid_blk_write_word(dev, PATH1_CTL1, 0x1F063870);
/* setAudioStandard(_audio_standard); */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_CTL1, 2, 0x00063870, 4);
+ status = vid_blk_write_word(dev, PATH1_CTL1, 0x00063870);
switch (dev->model) {
case CX231XX_BOARD_CNXT_RDE_250:
case CX231XX_BOARD_CNXT_RDU_250:
status = cx231xx_read_modify_write_i2c_dword(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
CHIP_CTRL,
FLD_SIF_EN,
cx231xx_set_field(FLD_SIF_EN, 1));
@@ -1181,17 +1038,14 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
break;
case AUDIO_INPUT_MUTE:
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- PATH1_CTL1, 2, 0x1F011012, 4);
+ status = vid_blk_write_word(dev, PATH1_CTL1, 0x1F011012);
break;
}
/* Take it out of soft reset */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- GENERAL_CTL, 2, &gen_ctrl, 1);
+ status = vid_blk_read_byte(dev, GENERAL_CTL, &gen_ctrl);
gen_ctrl &= ~1;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- GENERAL_CTL, 2, gen_ctrl, 1);
+ status = vid_blk_write_byte(dev, GENERAL_CTL, gen_ctrl);
return status;
}
@@ -1209,12 +1063,10 @@ int cx231xx_resolution_set(struct cx231xx *dev)
get_scale(dev, width, height, &hscale, &vscale);
/* set horzontal scale */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- HSCALE_CTRL, 2, hscale, 4);
+ status = vid_blk_write_word(dev, HSCALE_CTRL, hscale);
/* set vertical scale */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- VSCALE_CTRL, 2, vscale, 4);
+ status = vid_blk_write_word(dev, VSCALE_CTRL, vscale);
return status;
}
@@ -1227,11 +1079,9 @@ int cx231xx_init_ctrl_pin_status(struct cx231xx *dev)
u32 value;
int status = 0;
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL,
- 2, &value, 4);
+ status = vid_blk_read_word(dev, PIN_CTRL, &value);
value |= (~dev->board.ctl_pin_status_mask);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL,
- 2, value, 4);
+ status = vid_blk_write_word(dev, PIN_CTRL, value);
return status;
}
@@ -1296,82 +1146,82 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode,
/* C2HH */
/* lo if big signal */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1);
/* FUNC_MODE = DIF */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode);
/* IF_MODE */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF);
/* no inv */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1);
} else if (standard != DIF_USE_BASEBAND) {
if (standard & V4L2_STD_MN) {
/* lo if big signal */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1);
/* FUNC_MODE = DIF */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 23, 24,
function_mode);
/* IF_MODE */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb);
/* no inv */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1);
/* 0x124, AUD_CHAN1_SRC = 0x3 */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AUD_IO_CTRL, 0, 31, 0x00000003);
} else if ((standard == V4L2_STD_PAL_I) |
(standard & V4L2_STD_SECAM)) {
/* C2HH setup */
/* lo if big signal */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1);
/* FUNC_MODE = DIF */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 23, 24,
function_mode);
/* IF_MODE */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF);
/* no inv */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1);
} else {
/* default PAL BG */
/* C2HH setup */
/* lo if big signal */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1);
/* FUNC_MODE = DIF */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 23, 24,
function_mode);
/* IF_MODE */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE);
/* no inv */
status = cx231xx_reg_mask_write(dev,
- HAMMERHEAD_I2C_ADDRESS, 32,
+ VID_BLK_I2C_ADDRESS, 32,
AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1);
}
}
@@ -1387,9 +1237,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
cx231xx_info("%s: setStandard to %x\n", __func__, standard);
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_MISC_CTRL, 2, &dif_misc_ctrl_value,
- 4);
+ status = vid_blk_read_word(dev, DIF_MISC_CTRL, &dif_misc_ctrl_value);
if (standard != DIF_USE_BASEBAND)
dev->norm = standard;
@@ -1408,182 +1256,154 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
if (standard == DIF_USE_BASEBAND) { /* base band */
/* There is a different SRC_PHASE_INC value
for baseband vs. DIF */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_PHASE_INC, 2, 0xDF7DF83,
- 4);
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_MISC_CTRL, 2,
- &dif_misc_ctrl_value, 4);
+ status = vid_blk_write_word(dev, DIF_SRC_PHASE_INC, 0xDF7DF83);
+ status = vid_blk_read_word(dev, DIF_MISC_CTRL,
+ &dif_misc_ctrl_value);
dif_misc_ctrl_value |= FLD_DIF_DIF_BYPASS;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_MISC_CTRL, 2,
- dif_misc_ctrl_value, 4);
+ status = vid_blk_write_word(dev, DIF_MISC_CTRL,
+ dif_misc_ctrl_value);
} else if (standard & V4L2_STD_PAL_D) {
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL, 0, 31, 0x6503bc0c);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL1, 0, 31, 0xbd038c85);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL2, 0, 31, 0x1db4640a);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL3, 0, 31, 0x00008800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_REF, 0, 31, 0x444C1380);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_IF, 0, 31, 0xDA302600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_INT, 0, 31, 0xDA261700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_RF, 0, 31, 0xDA262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_INT_CURRENT, 0, 31,
0x26001700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_RF_CURRENT, 0, 31,
0x00002660);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VIDEO_AGC_CTRL, 0, 31,
0x72500800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VID_AUD_OVERRIDE, 0, 31,
0x27000100);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AV_SEP_CTRL, 0, 31, 0x3F3934EA);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_COMP_FLT_CTRL, 0, 31,
0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_PHASE_INC, 0, 31,
0x1befbf06);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_GAIN_CONTROL, 0, 31,
0x000035e8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_RPT_VARIANCE, 0, 31, 0x00000000);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
dif_misc_ctrl_value |= 0x3a023F11;
} else if (standard & V4L2_STD_PAL_I) {
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL, 0, 31, 0x6503bc0c);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL1, 0, 31, 0xbd038c85);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL2, 0, 31, 0x1db4640a);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL3, 0, 31, 0x00008800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_REF, 0, 31, 0x444C1380);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_IF, 0, 31, 0xDA302600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_INT, 0, 31, 0xDA261700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_RF, 0, 31, 0xDA262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_INT_CURRENT, 0, 31,
0x26001700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_RF_CURRENT, 0, 31,
0x00002660);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VIDEO_AGC_CTRL, 0, 31,
0x72500800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VID_AUD_OVERRIDE, 0, 31,
0x27000100);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AV_SEP_CTRL, 0, 31, 0x5F39A934);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_COMP_FLT_CTRL, 0, 31,
0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_PHASE_INC, 0, 31,
0x1befbf06);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_GAIN_CONTROL, 0, 31,
0x000035e8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_RPT_VARIANCE, 0, 31, 0x00000000);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
dif_misc_ctrl_value |= 0x3a033F11;
} else if (standard & V4L2_STD_PAL_M) {
/* improved Low Frequency Phase Noise */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL, 2, 0xFF01FF0C, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL1, 2, 0xbd038c85,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL2, 2, 0x1db4640a, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL3, 2, 0x00008800, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, 0x444C1380, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_INT_CURRENT, 2,
- 0x26001700, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_RF_CURRENT, 2, 0x00002660,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VIDEO_AGC_CTRL, 2, 0x72500800,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VID_AUD_OVERRIDE, 2, 0x27000100,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AV_SEP_CTRL, 2, 0x012c405d, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_GAIN_CONTROL, 2, 0x000035e8,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SOFT_RST_CTRL_REVB, 2,
- 0x00000000, 4);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL, 0xFF01FF0C);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL1, 0xbd038c85);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL2, 0x1db4640a);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL3, 0x00008800);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_REF, 0x444C1380);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_INT_CURRENT,
+ 0x26001700);
+ status = vid_blk_write_word(dev, DIF_AGC_RF_CURRENT,
+ 0x00002660);
+ status = vid_blk_write_word(dev, DIF_VIDEO_AGC_CTRL,
+ 0x72500800);
+ status = vid_blk_write_word(dev, DIF_VID_AUD_OVERRIDE,
+ 0x27000100);
+ status = vid_blk_write_word(dev, DIF_AV_SEP_CTRL, 0x012c405d);
+ status = vid_blk_write_word(dev, DIF_COMP_FLT_CTRL,
+ 0x009f50c1);
+ status = vid_blk_write_word(dev, DIF_SRC_PHASE_INC,
+ 0x1befbf06);
+ status = vid_blk_write_word(dev, DIF_SRC_GAIN_CONTROL,
+ 0x000035e8);
+ status = vid_blk_write_word(dev, DIF_SOFT_RST_CTRL_REVB,
+ 0x00000000);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
dif_misc_ctrl_value |= 0x3A0A3F10;
} else if (standard & (V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) {
/* improved Low Frequency Phase Noise */
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL, 2, 0xFF01FF0C, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL1, 2, 0xbd038c85, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL2, 2, 0x1db4640a, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL3, 2, 0x00008800, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, 0x444C1380, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_INT_CURRENT, 2,
- 0x26001700, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_RF_CURRENT, 2, 0x00002660,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VIDEO_AGC_CTRL, 2, 0x72500800,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VID_AUD_OVERRIDE, 2, 0x27000100,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AV_SEP_CTRL, 2, 0x012c405d, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_GAIN_CONTROL, 2, 0x000035e8,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SOFT_RST_CTRL_REVB, 2,
- 0x00000000, 4);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL, 0xFF01FF0C);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL1, 0xbd038c85);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL2, 0x1db4640a);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL3, 0x00008800);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_REF, 0x444C1380);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_INT_CURRENT,
+ 0x26001700);
+ status = vid_blk_write_word(dev, DIF_AGC_RF_CURRENT,
+ 0x00002660);
+ status = vid_blk_write_word(dev, DIF_VIDEO_AGC_CTRL,
+ 0x72500800);
+ status = vid_blk_write_word(dev, DIF_VID_AUD_OVERRIDE,
+ 0x27000100);
+ status = vid_blk_write_word(dev, DIF_AV_SEP_CTRL,
+ 0x012c405d);
+ status = vid_blk_write_word(dev, DIF_COMP_FLT_CTRL,
+ 0x009f50c1);
+ status = vid_blk_write_word(dev, DIF_SRC_PHASE_INC,
+ 0x1befbf06);
+ status = vid_blk_write_word(dev, DIF_SRC_GAIN_CONTROL,
+ 0x000035e8);
+ status = vid_blk_write_word(dev, DIF_SOFT_RST_CTRL_REVB,
+ 0x00000000);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
dif_misc_ctrl_value = 0x3A093F10;
@@ -1591,45 +1411,45 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
(V4L2_STD_SECAM_B | V4L2_STD_SECAM_D | V4L2_STD_SECAM_G |
V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1)) {
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL, 0, 31, 0x6503bc0c);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL1, 0, 31, 0xbd038c85);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL2, 0, 31, 0x1db4640a);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL3, 0, 31, 0x00008800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_REF, 0, 31, 0x888C0380);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_IF, 0, 31, 0xe0262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_INT, 0, 31, 0xc2171700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_RF, 0, 31, 0xc2262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_INT_CURRENT, 0, 31,
0x26001700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_RF_CURRENT, 0, 31,
0x00002660);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VID_AUD_OVERRIDE, 0, 31,
0x27000100);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_COMP_FLT_CTRL, 0, 31,
0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_PHASE_INC, 0, 31,
0x1befbf06);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_GAIN_CONTROL, 0, 31,
0x000035e8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_RPT_VARIANCE, 0, 31, 0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VIDEO_AGC_CTRL, 0, 31,
0xf4000000);
@@ -1638,45 +1458,45 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
dif_misc_ctrl_value |= 0x3a023F11;
} else if (standard & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) {
/* Is it SECAM_L1? */
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL, 0, 31, 0x6503bc0c);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL1, 0, 31, 0xbd038c85);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL2, 0, 31, 0x1db4640a);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL3, 0, 31, 0x00008800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_REF, 0, 31, 0x888C0380);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_IF, 0, 31, 0xe0262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_INT, 0, 31, 0xc2171700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_RF, 0, 31, 0xc2262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_INT_CURRENT, 0, 31,
0x26001700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_RF_CURRENT, 0, 31,
0x00002660);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VID_AUD_OVERRIDE, 0, 31,
0x27000100);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_COMP_FLT_CTRL, 0, 31,
0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_PHASE_INC, 0, 31,
0x1befbf06);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_GAIN_CONTROL, 0, 31,
0x000035e8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_RPT_VARIANCE, 0, 31, 0x00000000);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VIDEO_AGC_CTRL, 0, 31,
0xf2560000);
@@ -1694,91 +1514,78 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
the pll freq word is 0x03420c49
*/
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL, 2, 0x6503BC0C, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL1, 2, 0xBD038C85, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL2, 2, 0x1DB4640A, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_PLL_CTRL3, 2, 0x00008800, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, 0x444C0380, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_INT_CURRENT, 2,
- 0x26001700, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_RF_CURRENT, 2, 0x00002660,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VIDEO_AGC_CTRL, 2, 0x04000800,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_VID_AUD_OVERRIDE, 2, 0x27000100,
- 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AV_SEP_CTRL, 2, 0x01296e1f, 4);
-
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_SRC_GAIN_CONTROL, 2, 0x000035e8,
- 4);
-
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_CTRL_IF, 2, 0xC2262600, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_CTRL_INT, 2, 0xC2262600, 4);
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_CTRL_RF, 2, 0xC2262600, 4);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL, 0x6503BC0C);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL1, 0xBD038C85);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL2, 0x1DB4640A);
+ status = vid_blk_write_word(dev, DIF_PLL_CTRL3, 0x00008800);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_REF, 0x444C0380);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_INT_CURRENT,
+ 0x26001700);
+ status = vid_blk_write_word(dev, DIF_AGC_RF_CURRENT,
+ 0x00002660);
+ status = vid_blk_write_word(dev, DIF_VIDEO_AGC_CTRL,
+ 0x04000800);
+ status = vid_blk_write_word(dev, DIF_VID_AUD_OVERRIDE,
+ 0x27000100);
+ status = vid_blk_write_word(dev, DIF_AV_SEP_CTRL, 0x01296e1f);
+
+ status = vid_blk_write_word(dev, DIF_COMP_FLT_CTRL,
+ 0x009f50c1);
+ status = vid_blk_write_word(dev, DIF_SRC_PHASE_INC,
+ 0x1befbf06);
+ status = vid_blk_write_word(dev, DIF_SRC_GAIN_CONTROL,
+ 0x000035e8);
+
+ status = vid_blk_write_word(dev, DIF_AGC_CTRL_IF, 0xC2262600);
+ status = vid_blk_write_word(dev, DIF_AGC_CTRL_INT,
+ 0xC2262600);
+ status = vid_blk_write_word(dev, DIF_AGC_CTRL_RF, 0xC2262600);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
dif_misc_ctrl_value |= 0x3a003F10;
} else {
/* default PAL BG */
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL, 0, 31, 0x6503bc0c);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL1, 0, 31, 0xbd038c85);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL2, 0, 31, 0x1db4640a);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_PLL_CTRL3, 0, 31, 0x00008800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_REF, 0, 31, 0x444C1380);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_IF, 0, 31, 0xDA302600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_INT, 0, 31, 0xDA261700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_CTRL_RF, 0, 31, 0xDA262600);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_IF_INT_CURRENT, 0, 31,
0x26001700);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AGC_RF_CURRENT, 0, 31,
0x00002660);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VIDEO_AGC_CTRL, 0, 31,
0x72500800);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_VID_AUD_OVERRIDE, 0, 31,
0x27000100);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_AV_SEP_CTRL, 0, 31, 0x3F3530EC);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_COMP_FLT_CTRL, 0, 31,
0x00A653A8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_PHASE_INC, 0, 31,
0x1befbf06);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_SRC_GAIN_CONTROL, 0, 31,
0x000035e8);
- status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32,
+ status = cx231xx_reg_mask_write(dev, VID_BLK_I2C_ADDRESS, 32,
DIF_RPT_VARIANCE, 0, 31, 0x00000000);
/* Save the Spec Inversion value */
dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
@@ -1796,9 +1603,7 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
dif_misc_ctrl_value = 0x7a080000;
/* Write the calculated value for misc ontrol register */
- status =
- cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, DIF_MISC_CTRL,
- 2, dif_misc_ctrl_value, 4);
+ status = vid_blk_write_word(dev, DIF_MISC_CTRL, dif_misc_ctrl_value);
return status;
}
@@ -1809,13 +1614,11 @@ int cx231xx_tuner_pre_channel_change(struct cx231xx *dev)
u32 dwval;
/* Set the RF and IF k_agc values to 3 */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, &dwval, 4);
+ status = vid_blk_read_word(dev, DIF_AGC_IF_REF, &dwval);
dwval &= ~(FLD_DIF_K_AGC_RF | FLD_DIF_K_AGC_IF);
dwval |= 0x33000000;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, dwval, 4);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_REF, dwval);
return status;
}
@@ -1827,8 +1630,7 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev)
/* Set the RF and IF k_agc values to 4 for PAL/NTSC and 8 for
* SECAM L/B/D standards */
- status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, &dwval, 4);
+ status = vid_blk_read_word(dev, DIF_AGC_IF_REF, &dwval);
dwval &= ~(FLD_DIF_K_AGC_RF | FLD_DIF_K_AGC_IF);
if (dev->norm & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_B |
@@ -1837,63 +1639,62 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev)
else
dwval |= 0x44000000;
- status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
- DIF_AGC_IF_REF, 2, dwval, 4);
+ status = vid_blk_write_word(dev, DIF_AGC_IF_REF, dwval);
return status;
}
/******************************************************************************
- * F L A T I R O N - B L O C K C O N T R O L functions *
+ * I 2 S - B L O C K C O N T R O L functions *
******************************************************************************/
-int cx231xx_flatiron_initialize(struct cx231xx *dev)
+int cx231xx_i2s_blk_initialize(struct cx231xx *dev)
{
int status = 0;
u32 value;
- status = cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL1, 1, &value, 1);
/* enables clock to delta-sigma and decimation filter */
value |= 0x80;
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL1, 1, value, 1);
/* power up all channel */
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL2, 1, 0x00, 1);
return status;
}
-int cx231xx_flatiron_update_power_control(struct cx231xx *dev,
+int cx231xx_i2s_blk_update_power_control(struct cx231xx *dev,
enum AV_MODE avmode)
{
int status = 0;
u32 value = 0;
if (avmode != POLARIS_AVMODE_ENXTERNAL_AV) {
- status = cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL2, 1, &value, 1);
value |= 0xfe;
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL2, 1, value, 1);
} else {
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL2, 1, 0x00, 1);
}
return status;
}
-/* set flatiron for audio input types */
-int cx231xx_flatiron_set_audio_input(struct cx231xx *dev, u8 audio_input)
+/* set i2s_blk for audio input types */
+int cx231xx_i2s_blk_set_audio_input(struct cx231xx *dev, u8 audio_input)
{
int status = 0;
switch (audio_input) {
case CX231XX_AMUX_LINE_IN:
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL2, 1, 0x00, 1);
- status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ status = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
CH_PWR_CTRL1, 1, 0x80, 1);
break;
case CX231XX_AMUX_VIDEO:
@@ -2114,11 +1915,11 @@ int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode)
msleep(PWR_SLEEP_INTERVAL);
}
- /* update power control for colibri */
- status = cx231xx_colibri_update_power_control(dev, mode);
+ /* update power control for afe */
+ status = cx231xx_afe_update_power_control(dev, mode);
- /* update power control for flatiron */
- status = cx231xx_flatiron_update_power_control(dev, mode);
+ /* update power control for i2s_blk */
+ status = cx231xx_i2s_blk_update_power_control(dev, mode);
status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value,
4);
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-cards.c b/linux/drivers/media/video/cx231xx/cx231xx-cards.c
index bc8e375ca..d1872988a 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -169,11 +169,11 @@ const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
/* table of devices that work with this driver */
struct usb_device_id cx231xx_id_table[] = {
- {USB_DEVICE(0x0572, 0x58A0),
+ {USB_DEVICE(0x0572, 0x5A3C),
.driver_info = CX231XX_BOARD_UNKNOWN},
{USB_DEVICE(0x0572, 0x58A2),
.driver_info = CX231XX_BOARD_CNXT_RDE_250},
- {USB_DEVICE(0x0572, 0x5A3C),
+ {USB_DEVICE(0x0572, 0x58A1),
.driver_info = CX231XX_BOARD_CNXT_RDU_250},
{},
};
@@ -225,7 +225,6 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
cx231xx_info("Identified as %s (card=%d)\n",
dev->board.name, dev->model);
- cx231xx_info("Precard: Board is %s\n", dev->board.name);
/* set the direction for GPIO pins */
cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1);
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1);
@@ -244,8 +243,6 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
}
-#if 0 /* Keep */
-
static void cx231xx_config_tuner(struct cx231xx *dev)
{
struct tuner_setup tun_setup;
@@ -259,8 +256,8 @@ static void cx231xx_config_tuner(struct cx231xx *dev)
tun_setup.addr = dev->tuner_addr;
tun_setup.tuner_callback = cx231xx_tuner_callback;
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], TUNER_SET_TYPE_ADDR,
- &tun_setup);
+ tuner_call(dev, tuner, s_type_addr, &tun_setup);
+
#if 0 /* Keep */
if (tun_setup.type == TUNER_XC5000) {
static struct xc2028_ctrl ctrl = {
@@ -272,20 +269,17 @@ static void cx231xx_config_tuner(struct cx231xx *dev)
.tuner = dev->tuner_type,
.priv = &ctrl,
};
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], TUNER_SET_CONFIG,
- &cfg);
+ tuner_call(dev, tuner, s_config, &cfg);
}
#endif
-
/* configure tuner */
f.tuner = 0;
f.type = V4L2_TUNER_ANALOG_TV;
f.frequency = 9076; /* just a magic number */
dev->ctl_freq = f.frequency;
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, &f);
-}
+ call_all(dev, tuner, s_frequency, &f);
-#endif
+}
/* ----------------------------------------------------------------------- */
void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir)
@@ -309,40 +303,37 @@ void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir)
void cx231xx_card_setup(struct cx231xx *dev)
{
+
cx231xx_set_model(dev);
dev->tuner_type = cx231xx_boards[dev->model].tuner_type;
if (cx231xx_boards[dev->model].tuner_addr)
dev->tuner_addr = cx231xx_boards[dev->model].tuner_addr;
- cx231xx_info(": tuner type %d, tuner address %d \n",
- dev->tuner_type, dev->tuner_addr);
-
- /* Do card specific if any */
- switch (dev->model) {
- case CX231XX_BOARD_CNXT_RDE_250:
- /* do card specific GPIO settings if required */
- cx231xx_info("Board is Conexnat RDE 250\n");
- break;
- case CX231XX_BOARD_CNXT_RDU_250:
- /* do card specific GPIO settings if required */
- cx231xx_info("Board is Conexnat RDU 250\n");
- break;
- }
-
/* request some modules */
if (dev->board.decoder == CX231XX_AVDECODER) {
- cx231xx_info(": Requesting cx25840 module\n");
- request_module("cx25840");
+ dev->sd_cx25840 =
+ v4l2_i2c_new_subdev(&dev->i2c_bus[0].i2c_adap,
+ "cx25840", "cx25840", 0x88 >> 1);
+ if (dev->sd_cx25840 == NULL)
+ cx231xx_info("cx25840 subdev registration failure\n");
+ cx25840_call(dev, core, init, 0);
+
}
-#if 0 /* Keep */
+
if (dev->board.tuner_type != TUNER_ABSENT) {
- cx231xx_info(": Requesting Tuner module\n");
- request_module("tuner");
+ dev->sd_tuner =
+ v4l2_i2c_new_subdev(&dev->i2c_bus[1].i2c_adap,
+ "tuner", "tuner", 0xc2 >> 1);
+ if (dev->sd_tuner == NULL)
+ cx231xx_info("tuner subdev registration failure\n");
+
+ cx231xx_config_tuner(dev);
}
cx231xx_config_tuner(dev);
+#if 0 /* Keep */
/* TBD IR will be added later */
cx231xx_ir_init(dev);
#endif
@@ -372,7 +363,7 @@ void cx231xx_config_i2c(struct cx231xx *dev)
route.input = INPUT(dev->video_input)->vmux;
route.output = 0;
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_STREAMON, NULL);
+ call_all(dev, video, s_stream, 1);
}
/*
@@ -560,16 +551,16 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
udev = usb_get_dev(interface_to_usbdev(interface));
ifnum = interface->altsetting[0].desc.bInterfaceNumber;
- cx231xx_info(": Interface Number %d\n", ifnum);
-
- /* Interface number 0 - IR interface */
- if (ifnum == 0) {
+ if (!ifnum) {
+ /*
+ * Interface number 0 - IR interface
+ */
/* Check to see next free device and mark as used */
nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
cx231xx_devused |= 1 << nr;
if (nr >= CX231XX_MAXBOARDS) {
- cx231xx_info(": Supports only %i cx231xx boards.\n",
+ cx231xx_err(DRIVER_NAME ": Supports only %i cx231xx boards.\n",
CX231XX_MAXBOARDS);
cx231xx_devused &= ~(1 << nr);
return -ENOMEM;
@@ -602,42 +593,46 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
/* get maximum no.of IAD interfaces */
assoc_desc = udev->actconfig->intf_assoc[0];
dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
- cx231xx_info("Found IAD interface count %d\n",
- dev->max_iad_interface_count);
/* init CIR module TBD */
/* store the current interface */
lif = interface;
- } else if (ifnum == 1) {
-
- /* Get dev structure first */
- dev = usb_get_intfdata(udev->actconfig->interface[0]);
- if (dev == NULL) {
- cx231xx_err(DRIVER_NAME ": out of first interface!\n");
- return -ENODEV;
+ switch (udev->speed) {
+ case USB_SPEED_LOW:
+ speed = "1.5";
+ break;
+ case USB_SPEED_UNKNOWN:
+ case USB_SPEED_FULL:
+ speed = "12";
+ break;
+ case USB_SPEED_HIGH:
+ speed = "480";
+ break;
+ default:
+ speed = "unknown";
}
- /* store the interface 0 back */
- lif = udev->actconfig->interface[0];
-
- /* increment interface count */
- dev->interface_count++;
-
- /* get device number */
- nr = dev->devno;
+ if (udev->manufacturer)
+ strlcpy(descr, udev->manufacturer, sizeof(descr));
- assoc_desc = udev->actconfig->intf_assoc[0];
- if (assoc_desc->bFirstInterface == ifnum) {
- cx231xx_info
- ("Found IAD interface match: AV Desc Start!! \n");
- } else {
- cx231xx_err(" Not found matching interface\n");
- return -ENODEV;
+ if (udev->product) {
+ if (*descr)
+ strlcat(descr, " ", sizeof(descr));
+ strlcat(descr, udev->product, sizeof(descr));
}
+ if (*descr)
+ strlcat(descr, " ", sizeof(descr));
- } else if (ifnum >= 2) {
+ cx231xx_info("New device %s@ %s Mbps "
+ "(%04x:%04x) with %d interfaces\n",
+ descr,
+ speed,
+ le16_to_cpu(udev->descriptor.idVendor),
+ le16_to_cpu(udev->descriptor.idProduct),
+ dev->max_iad_interface_count);
+ } else {
/* Get dev structure first */
dev = usb_get_intfdata(udev->actconfig->interface[0]);
if (dev == NULL) {
@@ -654,220 +649,196 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
/* get device number */
nr = dev->devno;
- /* set skip interface */
- if ((dev->interface_count - 1) != dev->max_iad_interface_count)
- skip_interface = 1; /* set skipping */
- else {
- cx231xx_info
- ("Found IAD interface no. match with AV Device no.!\n");
+ /*
+ * set skip interface, for all interfaces but
+ * interface 1 and the last one
+ */
+ if ((ifnum != 1) && ((dev->interface_count - 1)
+ != dev->max_iad_interface_count))
+ skip_interface = 1;
+
+ if (ifnum == 1) {
+ assoc_desc = udev->actconfig->intf_assoc[0];
+ if (assoc_desc->bFirstInterface != ifnum) {
+ cx231xx_err(DRIVER_NAME ": Not found "
+ "matching IAD interface\n");
+ return -ENODEV;
+ }
}
}
- switch (udev->speed) {
- case USB_SPEED_LOW:
- speed = "1.5";
- break;
- case USB_SPEED_UNKNOWN:
- case USB_SPEED_FULL:
- speed = "12";
- break;
- case USB_SPEED_HIGH:
- speed = "480";
- break;
- default:
- speed = "unknown";
- }
+ if (skip_interface)
+ return -ENODEV;
- if (udev->manufacturer)
- strlcpy(descr, udev->manufacturer, sizeof(descr));
+ cx231xx_info("registering interface %d\n", ifnum);
- if (udev->product) {
- if (*descr)
- strlcat(descr, " ", sizeof(descr));
- strlcat(descr, udev->product, sizeof(descr));
- }
- if (*descr)
- strlcat(descr, " ", sizeof(descr));
+ /* save our data pointer in this interface device */
+ usb_set_intfdata(lif, dev);
- cx231xx_info("New device %s@ %s Mbps "
- "(%04x:%04x, interface %d, class %d)\n",
- descr,
- speed,
- le16_to_cpu(udev->descriptor.idVendor),
- le16_to_cpu(udev->descriptor.idProduct),
- ifnum, interface->altsetting->desc.bInterfaceNumber);
-
- /* AV device initialization */
- if ((dev->interface_count - 1) == dev->max_iad_interface_count) {
- cx231xx_info(" Calling init_dev\n");
- /* allocate device struct */
- retval = cx231xx_init_dev(&dev, udev, nr);
- if (retval) {
- cx231xx_devused &= ~(1 << dev->devno);
- kfree(dev);
+ if ((dev->interface_count - 1) != dev->max_iad_interface_count)
+ return 0;
- return retval;
- }
+ /*
+ * AV device initialization - only done at the last interface
+ */
- /* compute alternate max packet sizes for video */
- uif =
- udev->actconfig->interface[dev->current_pcb_config.
- hs_config_info[0].interface_info.
- video_index + 1];
+ /* Create v4l2 device */
+ snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
+ "%s-%03d", "cx231xx", nr);
+ retval = v4l2_device_register(&udev->dev, &dev->v4l2_dev);
+ if (retval) {
+ cx231xx_errdev("v4l2_device_register failed\n");
+ cx231xx_devused &= ~(1 << nr);
+ kfree(dev);
+ return -EIO;
+ }
- dev->video_mode.end_point_addr =
- le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.
- bEndpointAddress);
+ /* allocate device struct */
+ retval = cx231xx_init_dev(&dev, udev, nr);
+ if (retval) {
+ cx231xx_devused &= ~(1 << dev->devno);
+ v4l2_device_unregister(&dev->v4l2_dev);
+ kfree(dev);
+ return retval;
+ }
- dev->video_mode.num_alt = uif->num_altsetting;
- cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n",
- dev->video_mode.end_point_addr,
- dev->video_mode.num_alt);
- dev->video_mode.alt_max_pkt_size =
- kmalloc(32 * dev->video_mode.num_alt, GFP_KERNEL);
+ /* compute alternate max packet sizes for video */
+ uif = udev->actconfig->interface[dev->current_pcb_config.
+ hs_config_info[0].interface_info.video_index + 1];
- if (dev->video_mode.alt_max_pkt_size == NULL) {
- cx231xx_errdev("out of memory!\n");
- cx231xx_devused &= ~(1 << nr);
- kfree(dev);
- return -ENOMEM;
- }
+ dev->video_mode.end_point_addr = le16_to_cpu(uif->altsetting[0].
+ endpoint[isoc_pipe].desc.bEndpointAddress);
- for (i = 0; i < dev->video_mode.num_alt; i++) {
- u16 tmp =
- le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
- desc.wMaxPacketSize);
- dev->video_mode.alt_max_pkt_size[i] =
- (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
- cx231xx_info("Alternate setting %i, max size= %i\n", i,
- dev->video_mode.alt_max_pkt_size[i]);
- }
+ dev->video_mode.num_alt = uif->num_altsetting;
+ cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
+ dev->video_mode.end_point_addr,
+ dev->video_mode.num_alt);
+ dev->video_mode.alt_max_pkt_size =
+ kmalloc(32 * dev->video_mode.num_alt, GFP_KERNEL);
- /* compute alternate max packet sizes for vbi */
- uif =
- udev->actconfig->interface[dev->current_pcb_config.
- hs_config_info[0].interface_info.
- vanc_index + 1];
+ if (dev->video_mode.alt_max_pkt_size == NULL) {
+ cx231xx_errdev("out of memory!\n");
+ cx231xx_devused &= ~(1 << nr);
+ v4l2_device_unregister(&dev->v4l2_dev);
+ kfree(dev);
+ return -ENOMEM;
+ }
- dev->vbi_mode.end_point_addr =
- le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.
- bEndpointAddress);
+ for (i = 0; i < dev->video_mode.num_alt; i++) {
+ u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
+ desc.wMaxPacketSize);
+ dev->video_mode.alt_max_pkt_size[i] =
+ (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
+ cx231xx_info("Alternate setting %i, max size= %i\n", i,
+ dev->video_mode.alt_max_pkt_size[i]);
+ }
- dev->vbi_mode.num_alt = uif->num_altsetting;
- cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n",
- dev->vbi_mode.end_point_addr,
- dev->vbi_mode.num_alt);
- dev->vbi_mode.alt_max_pkt_size =
- kmalloc(32 * dev->vbi_mode.num_alt, GFP_KERNEL);
+ /* compute alternate max packet sizes for vbi */
+ uif = udev->actconfig->interface[dev->current_pcb_config.
+ hs_config_info[0].interface_info.
+ vanc_index + 1];
+
+ dev->vbi_mode.end_point_addr =
+ le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.
+ bEndpointAddress);
+
+ dev->vbi_mode.num_alt = uif->num_altsetting;
+ cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
+ dev->vbi_mode.end_point_addr,
+ dev->vbi_mode.num_alt);
+ dev->vbi_mode.alt_max_pkt_size =
+ kmalloc(32 * dev->vbi_mode.num_alt, GFP_KERNEL);
+
+ if (dev->vbi_mode.alt_max_pkt_size == NULL) {
+ cx231xx_errdev("out of memory!\n");
+ cx231xx_devused &= ~(1 << nr);
+ v4l2_device_unregister(&dev->v4l2_dev);
+ kfree(dev);
+ return -ENOMEM;
+ }
- if (dev->vbi_mode.alt_max_pkt_size == NULL) {
- cx231xx_errdev("out of memory!\n");
- cx231xx_devused &= ~(1 << nr);
- kfree(dev);
- return -ENOMEM;
- }
+ for (i = 0; i < dev->vbi_mode.num_alt; i++) {
+ u16 tmp =
+ le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
+ desc.wMaxPacketSize);
+ dev->vbi_mode.alt_max_pkt_size[i] =
+ (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
+ cx231xx_info("Alternate setting %i, max size= %i\n", i,
+ dev->vbi_mode.alt_max_pkt_size[i]);
+ }
- for (i = 0; i < dev->vbi_mode.num_alt; i++) {
- u16 tmp =
- le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
- desc.wMaxPacketSize);
- dev->vbi_mode.alt_max_pkt_size[i] =
- (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
- cx231xx_info("Alternate setting %i, max size= %i\n", i,
- dev->vbi_mode.alt_max_pkt_size[i]);
- }
+ /* compute alternate max packet sizes for sliced CC */
+ uif = udev->actconfig->interface[dev->current_pcb_config.
+ hs_config_info[0].interface_info.
+ hanc_index + 1];
+
+ dev->sliced_cc_mode.end_point_addr =
+ le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.
+ bEndpointAddress);
+
+ dev->sliced_cc_mode.num_alt = uif->num_altsetting;
+ cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
+ dev->sliced_cc_mode.end_point_addr,
+ dev->sliced_cc_mode.num_alt);
+ dev->sliced_cc_mode.alt_max_pkt_size =
+ kmalloc(32 * dev->sliced_cc_mode.num_alt, GFP_KERNEL);
+
+ if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) {
+ cx231xx_errdev("out of memory!\n");
+ cx231xx_devused &= ~(1 << nr);
+ v4l2_device_unregister(&dev->v4l2_dev);
+ kfree(dev);
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) {
+ u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
+ desc.wMaxPacketSize);
+ dev->sliced_cc_mode.alt_max_pkt_size[i] =
+ (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
+ cx231xx_info("Alternate setting %i, max size= %i\n", i,
+ dev->sliced_cc_mode.alt_max_pkt_size[i]);
+ }
- /* compute alternate max packet sizes for sliced CC */
- uif =
- udev->actconfig->interface[dev->current_pcb_config.
- hs_config_info[0].interface_info.
- hanc_index + 1];
+ if (dev->current_pcb_config.ts1_source != 0xff) {
+ /* compute alternate max packet sizes for TS1 */
+ uif = udev->actconfig->interface[dev->current_pcb_config.
+ hs_config_info[0].
+ interface_info.
+ ts1_index + 1];
- dev->sliced_cc_mode.end_point_addr =
- le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].desc.
- bEndpointAddress);
+ dev->ts1_mode.end_point_addr =
+ le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].
+ desc.bEndpointAddress);
- dev->sliced_cc_mode.num_alt = uif->num_altsetting;
- cx231xx_info(": EndPoint Addr 0x%x, Alternate settings: %i\n",
- dev->sliced_cc_mode.end_point_addr,
- dev->sliced_cc_mode.num_alt);
- dev->sliced_cc_mode.alt_max_pkt_size =
- kmalloc(32 * dev->sliced_cc_mode.num_alt, GFP_KERNEL);
+ dev->ts1_mode.num_alt = uif->num_altsetting;
+ cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
+ dev->ts1_mode.end_point_addr,
+ dev->ts1_mode.num_alt);
+ dev->ts1_mode.alt_max_pkt_size =
+ kmalloc(32 * dev->ts1_mode.num_alt, GFP_KERNEL);
- if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) {
+ if (dev->ts1_mode.alt_max_pkt_size == NULL) {
cx231xx_errdev("out of memory!\n");
cx231xx_devused &= ~(1 << nr);
+ v4l2_device_unregister(&dev->v4l2_dev);
kfree(dev);
return -ENOMEM;
}
- for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) {
- u16 tmp =
- le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
- desc.wMaxPacketSize);
- dev->sliced_cc_mode.alt_max_pkt_size[i] =
- (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
- cx231xx_info("Alternate setting %i, max size= %i\n", i,
- dev->sliced_cc_mode.alt_max_pkt_size[i]);
- }
-
- if (dev->current_pcb_config.ts1_source != 0xff) {
-
- /* compute alternate max packet sizes for TS1 */
- uif =
- udev->actconfig->interface[dev->current_pcb_config.
- hs_config_info[0].
- interface_info.
- ts1_index + 1];
-
- dev->ts1_mode.end_point_addr =
- le16_to_cpu(uif->altsetting[0].endpoint[isoc_pipe].
- desc.bEndpointAddress);
-
- dev->ts1_mode.num_alt = uif->num_altsetting;
- cx231xx_info
- (": EndPoint Addr 0x%x, Alternate settings: %i\n",
- dev->ts1_mode.end_point_addr,
- dev->ts1_mode.num_alt);
- dev->ts1_mode.alt_max_pkt_size =
- kmalloc(32 * dev->ts1_mode.num_alt, GFP_KERNEL);
-
- if (dev->ts1_mode.alt_max_pkt_size == NULL) {
- cx231xx_errdev("out of memory!\n");
- cx231xx_devused &= ~(1 << nr);
- kfree(dev);
- return -ENOMEM;
- }
-
- for (i = 0; i < dev->ts1_mode.num_alt; i++) {
- u16 tmp =
- le16_to_cpu(uif->altsetting[i].
+ for (i = 0; i < dev->ts1_mode.num_alt; i++) {
+ u16 tmp = le16_to_cpu(uif->altsetting[i].
endpoint[isoc_pipe].desc.
wMaxPacketSize);
- dev->ts1_mode.alt_max_pkt_size[i] =
- (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) +
- 1);
- cx231xx_info
- ("Alternate setting %i, max size= %i\n", i,
+ dev->ts1_mode.alt_max_pkt_size[i] =
+ (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
+ cx231xx_info("Alternate setting %i, max size= %i\n", i,
dev->ts1_mode.alt_max_pkt_size[i]);
- }
}
-
}
- /* save our data pointer in this interface device */
- usb_set_intfdata(lif, dev);
-
/* load other modules required */
- if ((dev->interface_count - 1) == dev->max_iad_interface_count) {
- cx231xx_info("Calling request modules\n");
- request_modules(dev);
- }
-
- if (skip_interface) {
- cx231xx_info("Skipping the interface\n");
- return -ENODEV;
- }
+ request_modules(dev);
return 0;
}
@@ -887,6 +858,12 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
if (!dev)
return;
+ if (!dev->udev)
+ return;
+
+ /* delete v4l2 device */
+ v4l2_device_unregister(&dev->v4l2_dev);
+
/* wait until all current v4l2 io is finished then deallocate
resources */
mutex_lock(&dev->lock);
@@ -932,9 +909,7 @@ static int __init cx231xx_module_init(void)
{
int result;
- printk(KERN_INFO DRIVER_NAME " v4l2 driver version %d.%d.%d loaded\n",
- (CX231XX_VERSION_CODE >> 16) & 0xff,
- (CX231XX_VERSION_CODE >> 8) & 0xff, CX231XX_VERSION_CODE & 0xff);
+ printk(KERN_INFO DRIVER_NAME " v4l2 driver loaded.\n");
/* register this driver with the USB subsystem */
result = usb_register(&cx231xx_usb_driver);
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-core.c b/linux/drivers/media/video/cx231xx/cx231xx-core.c
index 2aec3a842..70478aa8b 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-core.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-core.c
@@ -125,7 +125,7 @@ int cx231xx_register_extension(struct cx231xx_ops *ops)
if (dev)
ops->init(dev);
}
- cx231xx_info("Cx231xx: Initialized (%s) extension\n", ops->name);
+ printk(KERN_INFO DRIVER_NAME ": %s initialized\n", ops->name);
mutex_unlock(&cx231xx_extension_devlist_lock);
mutex_unlock(&cx231xx_devlist_mutex);
return 0;
@@ -143,7 +143,7 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops)
}
mutex_lock(&cx231xx_extension_devlist_lock);
- cx231xx_info("Cx231xx: Removed (%s) extension\n", ops->name);
+ printk(KERN_INFO DRIVER_NAME ": %s removed\n", ops->name);
list_del(&ops->next);
mutex_unlock(&cx231xx_extension_devlist_lock);
mutex_unlock(&cx231xx_devlist_mutex);
@@ -906,7 +906,7 @@ int cx231xx_dev_init(struct cx231xx *dev)
/* init hardware */
/* Note : with out calling set power mode function,
- colibri can not be set up correctly */
+ afe can not be set up correctly */
errCode = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV);
if (errCode < 0) {
cx231xx_errdev
@@ -916,17 +916,17 @@ int cx231xx_dev_init(struct cx231xx *dev)
}
/* initialize Colibri block */
- errCode = cx231xx_colibri_init_super_block(dev, 0x23c);
+ errCode = cx231xx_afe_init_super_block(dev, 0x23c);
if (errCode < 0) {
cx231xx_errdev
- ("%s: cx231xx_colibri init super block - errCode [%d]!\n",
+ ("%s: cx231xx_afe init super block - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
- errCode = cx231xx_colibri_init_channels(dev);
+ errCode = cx231xx_afe_init_channels(dev);
if (errCode < 0) {
cx231xx_errdev
- ("%s: cx231xx_colibri init channels - errCode [%d]!\n",
+ ("%s: cx231xx_afe init channels - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
@@ -940,11 +940,11 @@ int cx231xx_dev_init(struct cx231xx *dev)
return errCode;
}
- /* flatiron related functions */
- errCode = cx231xx_flatiron_initialize(dev);
+ /* I2S block related functions */
+ errCode = cx231xx_i2s_blk_initialize(dev);
if (errCode < 0) {
cx231xx_errdev
- ("%s: cx231xx_flatiron initialize - errCode [%d]!\n",
+ ("%s: cx231xx_i2s block initialize - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-i2c.c b/linux/drivers/media/video/cx231xx/cx231xx-i2c.c
index 87dbd4e4e..d196fe666 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-i2c.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-i2c.c
@@ -435,18 +435,6 @@ static int attach_inform(struct i2c_client *client)
struct cx231xx *dev = bus->dev;
switch (client->addr << 1) {
- case 0x32:
- dprintk1(1, "attach_inform: Geminit III detected.\n");
- break;
- case 0x02:
- dprintk1(1, "attach_inform: Acquarius detected.\n");
- break;
- case 0xa0:
- dprintk1(1, "attach_inform: eeprom detected.\n");
- break;
- case 0x60:
- dprintk1(1, "attach_inform: Colibri detected.\n");
- break;
case 0x8e:
{
struct IR_i2c *ir = i2c_get_clientdata(client);
@@ -455,28 +443,15 @@ static int attach_inform(struct i2c_client *client)
cx231xx_set_ir(dev, ir);
break;
}
- case 0x80:
- case 0x88:
- dprintk1(1, "attach_inform: Hammerhead detected.\n");
break;
default:
- if (!dev->tuner_addr)
- dev->tuner_addr = client->addr;
-
- dprintk1(1, "attach inform: detected I2C address %x\n",
- client->addr << 1);
+ break;
}
return 0;
}
-static int detach_inform(struct i2c_client *client)
-{
- dprintk1(1, "i2c detach [client=%s]\n", client->name);
- return 0;
-}
-
static struct i2c_algorithm cx231xx_algo = {
.master_xfer = cx231xx_i2c_xfer,
.functionality = functionality,
@@ -487,12 +462,10 @@ static struct i2c_algorithm cx231xx_algo = {
static struct i2c_adapter cx231xx_adap_template = {
.owner = THIS_MODULE,
- .class = I2C_CLASS_TV_ANALOG,
.name = "cx231xx",
.id = I2C_HW_B_CX231XX,
.algo = &cx231xx_algo,
.client_register = attach_inform,
- .client_unregister = detach_inform,
};
static struct i2c_client cx231xx_client_template = {
@@ -539,19 +512,6 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c)
}
/*
- * cx231xx_i2c_call_clients()
- * send commands to all attached i2c devices
- */
-void cx231xx_i2c_call_clients(struct cx231xx_i2c *bus, unsigned int cmd,
- void *arg)
-{
- /* struct cx231xx *dev = bus->dev; */
-
- BUG_ON(NULL == bus->i2c_adap.algo_data);
- i2c_clients_command(&bus->i2c_adap, cmd, arg);
-}
-
-/*
* cx231xx_i2c_register()
* register i2c bus
*/
@@ -561,8 +521,6 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
BUG_ON(!dev->cx231xx_send_usb_command);
- cx231xx_info("%s(bus = %d)\n", __func__, bus->nr);
-
memcpy(&bus->i2c_adap, &cx231xx_adap_template, sizeof(bus->i2c_adap));
memcpy(&bus->i2c_algo, &cx231xx_algo, sizeof(bus->i2c_algo));
memcpy(&bus->i2c_client, &cx231xx_client_template,
@@ -574,13 +532,12 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
bus->i2c_algo.data = bus;
bus->i2c_adap.algo_data = bus;
- i2c_set_adapdata(&bus->i2c_adap, bus);
+ i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev);
i2c_add_adapter(&bus->i2c_adap);
bus->i2c_client.adapter = &bus->i2c_adap;
if (0 == bus->i2c_rc) {
- cx231xx_info("%s: i2c bus %d registered\n", dev->name, bus->nr);
if (i2c_scan)
cx231xx_do_i2c_scan(dev, &bus->i2c_client);
} else
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.c b/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.c
index c00f51eae..7473c33e8 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.c
@@ -22,6 +22,10 @@
#include "cx231xx.h"
#include "cx231xx-conf-reg.h"
+static unsigned int pcb_debug;
+module_param(pcb_debug, int, 0644);
+MODULE_PARM_DESC(pcb_debug, "enable pcb config debug messages [video]");
+
/******************************************************************************/
struct pcb_config cx231xx_Scenario[] = {
@@ -659,11 +663,8 @@ u32 initialize_cx231xx(struct cx231xx *dev)
u32 ts1_source = 0;
u32 ts2_source = 0;
u32 analog_source = 0;
- u8 tmp = 0;
u8 _current_scenario_idx = 0xff;
- cx231xx_info("PcbConfig::initialize \n");
-
ts1_source = SOURCE_TS_BDA;
ts2_source = SOURCE_TS_BDA;
@@ -672,7 +673,6 @@ u32 initialize_cx231xx(struct cx231xx *dev)
cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT, data, 4);
config_info = *((u32 *) data);
- cx231xx_info("SC(0x00) register = 0x%x\n", config_info);
usb_speed = (u8) (config_info & 0x1);
/* Verify this device belongs to Bus power or Self power device */
@@ -776,18 +776,20 @@ u32 initialize_cx231xx(struct cx231xx *dev)
memcpy(&dev->current_pcb_config, p_pcb_info,
sizeof(struct pcb_config));
- /*******************************************************************/
- tmp = (dev->current_pcb_config.index) + 1;
-
- cx231xx_info("scenario %d\n", tmp);
- cx231xx_info("type=%x\n", dev->current_pcb_config.type);
- cx231xx_info("mode=%x\n", dev->current_pcb_config.mode);
- cx231xx_info("speed=%x\n", dev->current_pcb_config.speed);
- cx231xx_info("ts1_source=%x\n", dev->current_pcb_config.ts1_source);
- cx231xx_info("ts2_source=%x\n", dev->current_pcb_config.ts2_source);
- cx231xx_info("analog_source=%x\n",
- dev->current_pcb_config.analog_source);
- /*******************************************************************/
+ if (pcb_debug) {
+ cx231xx_info("SC(0x00) register = 0x%x\n", config_info);
+ cx231xx_info("scenario %d\n",
+ (dev->current_pcb_config.index) + 1);
+ cx231xx_info("type=%x\n", dev->current_pcb_config.type);
+ cx231xx_info("mode=%x\n", dev->current_pcb_config.mode);
+ cx231xx_info("speed=%x\n", dev->current_pcb_config.speed);
+ cx231xx_info("ts1_source=%x\n",
+ dev->current_pcb_config.ts1_source);
+ cx231xx_info("ts2_source=%x\n",
+ dev->current_pcb_config.ts2_source);
+ cx231xx_info("analog_source=%x\n",
+ dev->current_pcb_config.analog_source);
+ }
return 0;
}
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.h b/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.h
index 86fec113f..f5e46e89f 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.h
+++ b/linux/drivers/media/video/cx231xx/cx231xx-pcb-cfg.h
@@ -91,10 +91,10 @@ enum TS_PORT{
#define EAVP_MASK 0x8
enum EAV_PRESENT{
NO_EXTERNAL_AV = 0x0, /* 0: No External A/V inputs
- (no need for Flatiron),
+ (no need for i2s blcok),
Analog Tuner must be present */
EXTERNAL_AV = 0x8 /* 1: External A/V inputs
- present (requires Flatiron) */
+ present (requires i2s blk) */
};
#define ATM_MASK 0x30
@@ -123,10 +123,6 @@ enum AVDEC_STATUS{
};
#define BO_1_MASK 0x100
-enum HAMMERHEAD__STATUS{
- HAMMERHEAD_ONLY = 0x0, /* 0:Hammerhead Only */
- HAMMERHEAD_SC = 0x100 /* 1:Hammerhead and SC */
-};
#define BUSPOWER_MASK 0xC4 /* for Polaris spec 0.8 */
#define SELFPOWER_MASK 0x86
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-vbi.c b/linux/drivers/media/video/cx231xx/cx231xx-vbi.c
index 9080d1755..020aa13b8 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-vbi.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-vbi.c
@@ -187,10 +187,6 @@ vbi_buffer_setup(struct videobuf_queue *vq, unsigned int *count,
if (*count < CX231XX_MIN_BUF)
*count = CX231XX_MIN_BUF;
- /* call VBI setup if required */
- /* cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, &f);
- */
-
return 0;
}
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-video.c b/linux/drivers/media/video/cx231xx/cx231xx-video.c
index 2dbe65b83..d53ddcb6a 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -44,6 +44,8 @@
#include "cx231xx.h"
#include "cx231xx-vbi.h"
+#define CX231XX_VERSION_CODE KERNEL_VERSION(0, 0, 1)
+
#define DRIVER_AUTHOR "Srinivasa Deevi <srinivasa.deevi@conexant.com>"
#define DRIVER_DESC "Conexant cx231xx based USB video device driver"
@@ -702,7 +704,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
f.frequency = dev->ctl_freq;
f.type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, &f);
+ call_all(dev, tuner, s_frequency, &f);
return 0;
}
@@ -828,8 +830,7 @@ void video_mux(struct cx231xx *dev, int index)
cx231xx_set_video_input_mux(dev, index);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_INT_S_VIDEO_ROUTING,
- &route);
+ cx25840_call(dev, video, s_routing, &route);
cx231xx_set_audio_input(dev, dev->ctl_ainput);
@@ -1043,7 +1044,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
dev->format = fmt;
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_FMT, f);
+ call_all(dev, video, s_fmt, f);
/* Set the correct alternate setting for this resolution */
cx231xx_resolution_set(dev);
@@ -1062,7 +1063,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id * id)
return 0;
}
-static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
+static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
{
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh->dev;
@@ -1088,7 +1089,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
dev->height = f.fmt.pix.height;
get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_STD, &dev->norm);
+ call_all(dev, tuner, s_std, dev->norm);
mutex_unlock(&dev->lock);
@@ -1242,7 +1243,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
*qc = cx231xx_ctls[i].v;
mutex_lock(&dev->lock);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_QUERYCTRL, qc);
+ call_all(dev, core, queryctrl, qc);
mutex_unlock(&dev->lock);
if (qc->type)
@@ -1263,9 +1264,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
return rc;
mutex_lock(&dev->lock);
-
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_CTRL, ctrl);
-
+ call_all(dev, core, g_ctrl, ctrl);
mutex_unlock(&dev->lock);
return rc;
}
@@ -1282,9 +1281,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
return rc;
mutex_lock(&dev->lock);
-
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_S_CTRL, ctrl);
-
+ call_all(dev, core, s_ctrl, ctrl);
mutex_unlock(&dev->lock);
return rc;
}
@@ -1326,9 +1323,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
return -EINVAL;
#if 0 /* Keep */
mutex_lock(&dev->lock);
-
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_TUNER, t);
-
+ call_all(dev, tuner, s_tuner, t);
mutex_unlock(&dev->lock);
#endif
return 0;
@@ -1344,7 +1339,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
f->frequency = dev->ctl_freq;
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_G_FREQUENCY, f);
+ call_all(dev, tuner, g_frequency, f);
mutex_unlock(&dev->lock);
@@ -1380,10 +1375,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
if (dev->tuner_type == TUNER_XC5000) {
if (dev->cx231xx_set_analog_freq != NULL)
dev->cx231xx_set_analog_freq(dev, f->frequency);
- } else {
- cx231xx_i2c_call_clients(&dev->i2c_bus[1],
- VIDIOC_S_FREQUENCY, f);
- }
+ } else
+ call_all(dev, tuner, s_frequency, f);
mutex_unlock(&dev->lock);
@@ -1428,36 +1421,36 @@ static int vidioc_g_register(struct file *file, void *priv,
reg->val = value[0] | value[1] << 8 |
value[2] << 16 | value[3] << 24;
break;
- case 1: /* Colibri - read byte */
- ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
+ case 1: /* AFE - read byte */
+ ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS,
(u16)reg->reg, 2, &data, 1);
reg->val = le32_to_cpu(data & 0xff);
break;
- case 14: /* Colibri - read dword */
- ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
+ case 14: /* AFE - read dword */
+ ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS,
(u16)reg->reg, 2, &data, 4);
reg->val = le32_to_cpu(data);
break;
- case 2: /* Hammerhead - read byte */
- ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
+ case 2: /* Video Block - read byte */
+ ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
(u16)reg->reg, 2, &data, 1);
reg->val = le32_to_cpu(data & 0xff);
break;
- case 24: /* Hammerhead - read dword */
- ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
+ case 24: /* Video Block - read dword */
+ ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
(u16)reg->reg, 2, &data, 4);
reg->val = le32_to_cpu(data);
break;
- case 3: /* flatiron - read byte */
+ case 3: /* I2S block - read byte */
ret = cx231xx_read_i2c_data(dev,
- Flatrion_DEVICE_ADDRESS,
+ I2S_BLK_DEVICE_ADDRESS,
(u16)reg->reg, 1,
&data, 1);
reg->val = le32_to_cpu(data & 0xff);
break;
- case 34: /* flatiron - read dword */
+ case 34: /* I2S Block - read dword */
ret =
- cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
+ cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
(u16)reg->reg, 1, &data, 4);
reg->val = le32_to_cpu(data);
break;
@@ -1465,8 +1458,7 @@ static int vidioc_g_register(struct file *file, void *priv,
return ret < 0 ? ret : 0;
case V4L2_CHIP_MATCH_I2C_DRIVER:
- cx231xx_i2c_call_clients(&dev->i2c_bus[0],
- VIDIOC_DBG_G_REGISTER, reg);
+ call_all(dev, core, g_register, reg);
return 0;
case V4L2_CHIP_MATCH_I2C_ADDR:
/* Not supported yet */
@@ -1477,7 +1469,7 @@ static int vidioc_g_register(struct file *file, void *priv,
}
mutex_lock(&dev->lock);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg);
+ call_all(dev, core, g_register, reg);
mutex_unlock(&dev->lock);
return ret;
@@ -1511,43 +1503,43 @@ static int vidioc_s_register(struct file *file, void *priv,
(u16)reg->reg, data,
4);
break;
- case 1: /* Colibri - read byte */
+ case 1: /* AFE - read byte */
ret = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
+ AFE_DEVICE_ADDRESS,
(u16)reg->reg, 2,
value, 1);
break;
- case 14: /* Colibri - read dword */
+ case 14: /* AFE - read dword */
ret = cx231xx_write_i2c_data(dev,
- Colibri_DEVICE_ADDRESS,
+ AFE_DEVICE_ADDRESS,
(u16)reg->reg, 2,
value, 4);
break;
- case 2: /* Hammerhead - read byte */
+ case 2: /* Video Block - read byte */
ret =
cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
(u16)reg->reg, 2,
value, 1);
break;
- case 24: /* Hammerhead - read dword */
+ case 24: /* Video Block - read dword */
ret =
cx231xx_write_i2c_data(dev,
- HAMMERHEAD_I2C_ADDRESS,
+ VID_BLK_I2C_ADDRESS,
(u16)reg->reg, 2,
value, 4);
break;
- case 3: /* flatiron - read byte */
+ case 3: /* I2S block - read byte */
ret =
cx231xx_write_i2c_data(dev,
- Flatrion_DEVICE_ADDRESS,
+ I2S_BLK_DEVICE_ADDRESS,
(u16)reg->reg, 1,
value, 1);
break;
- case 34: /* flatiron - read dword */
+ case 34: /* I2S block - read dword */
ret =
cx231xx_write_i2c_data(dev,
- Flatrion_DEVICE_ADDRESS,
+ I2S_BLK_DEVICE_ADDRESS,
(u16)reg->reg, 1,
value, 4);
break;
@@ -1560,9 +1552,7 @@ static int vidioc_s_register(struct file *file, void *priv,
}
mutex_lock(&dev->lock);
-
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_S_REGISTER, reg);
-
+ call_all(dev, core, s_register, reg);
mutex_unlock(&dev->lock);
return ret;
@@ -1606,6 +1596,8 @@ static int vidioc_streamon(struct file *file, void *priv,
if (likely(rc >= 0))
rc = videobuf_streamon(&fh->vb_vidq);
+ call_all(dev, video, s_stream, 1);
+
mutex_unlock(&dev->lock);
return rc;
@@ -1622,7 +1614,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
if (rc < 0)
return rc;
- if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ||
+ if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
(fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
return -EINVAL;
if (type != fh->type)
@@ -1630,6 +1622,8 @@ static int vidioc_streamoff(struct file *file, void *priv,
mutex_lock(&dev->lock);
+ cx25840_call(dev, video, s_stream, 0);
+
videobuf_streamoff(&fh->vb_vidq);
res_free(fh);
@@ -1646,8 +1640,7 @@ static int vidioc_querycap(struct file *file, void *priv,
strlcpy(cap->driver, "cx231xx", sizeof(cap->driver));
strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card));
- strlcpy(cap->bus_info, dev_name(&dev->udev->dev),
- sizeof(cap->bus_info));
+ usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
cap->version = CX231XX_VERSION_CODE;
@@ -1694,7 +1687,7 @@ static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
f->fmt.sliced.service_set = 0;
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_FMT, f);
+ call_all(dev, video, g_fmt, f);
if (f->fmt.sliced.service_set == 0)
rc = -EINVAL;
@@ -1715,7 +1708,7 @@ static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
return rc;
mutex_lock(&dev->lock);
- cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_G_FMT, f);
+ call_all(dev, video, g_fmt, f);
mutex_unlock(&dev->lock);
if (f->fmt.sliced.service_set == 0)
@@ -1870,7 +1863,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
t->type = V4L2_TUNER_RADIO;
mutex_lock(&dev->lock);
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_G_TUNER, t);
+ call_all(dev, tuner, s_tuner, t);
mutex_unlock(&dev->lock);
return 0;
@@ -1903,7 +1896,7 @@ static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
return -EINVAL;
mutex_lock(&dev->lock);
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_TUNER, t);
+ call_all(dev, tuner, s_tuner, t);
mutex_unlock(&dev->lock);
return 0;
@@ -2009,8 +2002,7 @@ static int cx231xx_v4l2_open(struct file *filp)
/* cx231xx_start_radio(dev); */
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], AUDC_SET_RADIO,
- NULL);
+ call_all(dev, tuner, s_radio);
}
dev->users++;
@@ -2133,8 +2125,7 @@ static int cx231xx_v4l2_close(struct file *filp)
}
/* Save some power by putting tuner to sleep */
- cx231xx_i2c_call_clients(&dev->i2c_bus[1], TUNER_SET_STANDBY,
- NULL);
+ call_all(dev, core, s_standby, 0);
/* do this before setting alternate! */
cx231xx_uninit_isoc(dev);
@@ -2348,7 +2339,7 @@ static struct video_device *cx231xx_vdev_init(struct cx231xx *dev,
*vfd = *template;
vfd->minor = -1;
- vfd->parent = &dev->udev->dev;
+ vfd->v4l2_dev = &dev->v4l2_dev;
vfd->release = video_device_release;
vfd->debug = video_debug;
@@ -2361,8 +2352,6 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
{
int ret;
- cx231xx_info("%s()\n", __func__);
-
cx231xx_info("%s: v4l2 driver version %d.%d.%d\n",
dev->name,
(CX231XX_VERSION_CODE >> 16) & 0xff,
diff --git a/linux/drivers/media/video/cx231xx/cx231xx.h b/linux/drivers/media/video/cx231xx/cx231xx.h
index 4606f27b4..21b4023dd 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx.h
+++ b/linux/drivers/media/video/cx231xx/cx231xx.h
@@ -22,13 +22,17 @@
#ifndef _CX231XX_H
#define _CX231XX_H
-#include "compat.h"
#include <linux/videodev2.h>
-#include <media/videobuf-vmalloc.h>
-
+#include <linux/types.h>
+#include <linux/ioctl.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/mutex.h>
+
+#include "compat.h"
+
+#include <media/videobuf-vmalloc.h>
+#include <media/v4l2-device.h>
#include <media/ir-kbd-i2c.h>
#if defined(CONFIG_VIDEO_CX231XX_DVB) || \
defined(CONFIG_VIDEO_CX231XX_DVB_MODULE)
@@ -39,14 +43,13 @@
#include "cx231xx-pcb-cfg.h"
#include "cx231xx-conf-reg.h"
-#define CX231XX_VERSION_CODE KERNEL_VERSION(0, 1, 0)
#define DRIVER_NAME "cx231xx"
#define PWR_SLEEP_INTERVAL 5
/* I2C addresses for control block in Cx231xx */
-#define Colibri_DEVICE_ADDRESS 0x60
-#define Flatrion_DEVICE_ADDRESS 0x98
-#define HAMMERHEAD_I2C_ADDRESS 0x88
+#define AFE_DEVICE_ADDRESS 0x60
+#define I2S_BLK_DEVICE_ADDRESS 0x98
+#define VID_BLK_I2C_ADDRESS 0x88
#define DIF_USE_BASEBAND 0xFFFFFFFF
/* Boards supported by driver */
@@ -457,6 +460,10 @@ struct cx231xx {
struct cx231xx_fmt *format;
+ struct v4l2_device v4l2_dev;
+ struct v4l2_subdev *sd_cx25840;
+ struct v4l2_subdev *sd_tuner;
+
struct cx231xx_IR *ir;
struct list_head devlist;
@@ -542,9 +549,9 @@ struct cx231xx {
/* Power Modes */
int power_mode;
- /* colibri parameters */
- enum AFE_MODE colibri_mode;
- u32 colibri_ref_count;
+ /* afe parameters */
+ enum AFE_MODE afe_mode;
+ u32 afe_ref_count;
/* video related parameters */
u32 video_input;
@@ -554,6 +561,13 @@ struct cx231xx {
};
+#define cx25840_call(cx231xx, o, f, args...) \
+ v4l2_subdev_call(cx231xx->sd_cx25840, o, f, ##args)
+#define tuner_call(cx231xx, o, f, args...) \
+ v4l2_subdev_call(cx231xx->sd_tuner, o, f, ##args)
+#define call_all(dev, o, f, args...) \
+ v4l2_device_call_until_err(&dev->v4l2_dev, 0, o, f, ##args)
+
struct cx231xx_ops {
struct list_head next;
char *name;
@@ -567,8 +581,6 @@ int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq);
int cx231xx_reset_analog_tuner(struct cx231xx *dev);
/* Provided by cx231xx-i2c.c */
-void cx231xx_i2c_call_clients(struct cx231xx_i2c *bus, unsigned int cmd,
- void *arg);
void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c);
int cx231xx_i2c_register(struct cx231xx_i2c *bus);
int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
@@ -585,21 +597,21 @@ int cx231xx_read_modify_write_i2c_dword(struct cx231xx *dev, u8 dev_addr,
u16 saddr, u32 mask, u32 value);
u32 cx231xx_set_field(u32 field_mask, u32 data);
-/* Colibri related functions */
-int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count);
-int cx231xx_colibri_init_channels(struct cx231xx *dev);
-int cx231xx_colibri_setup_AFE_for_baseband(struct cx231xx *dev);
-int cx231xx_colibri_set_input_mux(struct cx231xx *dev, u32 input_mux);
-int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode);
-int cx231xx_colibri_update_power_control(struct cx231xx *dev,
+/* afe related functions */
+int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count);
+int cx231xx_afe_init_channels(struct cx231xx *dev);
+int cx231xx_afe_setup_AFE_for_baseband(struct cx231xx *dev);
+int cx231xx_afe_set_input_mux(struct cx231xx *dev, u32 input_mux);
+int cx231xx_afe_set_mode(struct cx231xx *dev, enum AFE_MODE mode);
+int cx231xx_afe_update_power_control(struct cx231xx *dev,
enum AV_MODE avmode);
-int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input);
+int cx231xx_afe_adjust_ref_count(struct cx231xx *dev, u32 video_input);
-/* flatiron related functions */
-int cx231xx_flatiron_initialize(struct cx231xx *dev);
-int cx231xx_flatiron_update_power_control(struct cx231xx *dev,
+/* i2s block related functions */
+int cx231xx_i2s_blk_initialize(struct cx231xx *dev);
+int cx231xx_i2s_blk_update_power_control(struct cx231xx *dev,
enum AV_MODE avmode);
-int cx231xx_flatiron_set_audio_input(struct cx231xx *dev, u8 audio_input);
+int cx231xx_i2s_blk_set_audio_input(struct cx231xx *dev, u8 audio_input);
/* DIF related functions */
int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode,