Updates for tea5761 (take #3)
cover Updates for tea5761 (take #3)
From: Eduardo Valentin <[email protected]>
Hi guys,
Following recommendation from v4l people, I'm sending this update to our tea5761 driver.
They already had a tuner for this device which communicates through i2c.
I needed to update it because there were some register mis-utilization.
Here is a series which updates their tuner and our driver.
After acks and merging here in linux-omap I'll send it to v4l again.
Cheers,
Eduardo Valentin (3):
tea5761: Add init and sleep callbacks on tea5761 tuner tea5761 tuner: fix registers utilization
radio-tea5761: Update driver
drivers/media/common/tuners/tea5761.c | 55 +++- drivers/media/radio/Kconfig | 1 + drivers/media/radio/Makefile | 2 + drivers/media/radio/radio-tea5761.c | 570 ++++++++++++++++----------------- 4 files changed, 329 insertions(+), 299 deletions(-)
PATCH 1/3 tea5761: Add init and sleep callbacks on tea5761 tuner
From: Eduardo Valentin <[email protected]>
Add init and sleep callbacks on tea5761 tuner
--- drivers/media/common/tuners/tea5761.c | 44 +++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
drivers/media/common/tuners/tea5761.c +44 -0
@@ -175,6 +175,48 @@ static int set_radio_freq(struct dvb_frontend *fe,return 0 ; } +static int tea5761_init (struct dvb_frontend *fe) +{ +struct tea5761_priv *priv = fe->tuner_priv; +unsigned char buffer[] = {0 ,0 ,0 ,0 ,0 ,0 ,0 }; +int rc; + +tuner_dbg ("Power up radio\n" ); + + buffer[3 ] =TEA5761_TNCTRL_PUPD_0 ; + +if (debug) +tea5761_status_dump (buffer); + + rc =tuner_i2c_xfer_send (&priv->i2c_props, buffer,ARRAY_SIZE (buffer)); +if (rc !=ARRAY_SIZE (buffer)) +tuner_warn ("i2c i/o error: rc == %d (should be %d)\n" , rc, +ARRAY_SIZE (buffer)); + +return 0 ; +} + +static int tea5761_sleep (struct dvb_frontend *fe) +{ +struct tea5761_priv *priv = fe->tuner_priv; +unsigned char buffer[] = {0 ,0 ,0 ,0 ,0 ,0 ,0 }; +int rc; + +tuner_dbg ("Power down radio\n" ); + + buffer[3 ] &= ~TEA5761_TNCTRL_PUPD_0 ; + +if (debug) +tea5761_status_dump (buffer); + + rc =tuner_i2c_xfer_send (&priv->i2c_props, buffer,ARRAY_SIZE (buffer)); +if (rc !=ARRAY_SIZE (buffer)) +tuner_warn ("i2c i/o error: rc == %d (should be %d)\n" , rc, +ARRAY_SIZE (buffer)); + +return 0 ; +} +static int tea5761_read_status (struct dvb_frontend *fe,char *buffer) {struct tea5761_priv *priv = fe->tuner_priv;
@@ -287,6 +329,8 @@ static struct dvb_tuner_ops tea5761_tuner_ops = { .get_frequency = tea5761_get_frequency, .get_status = tea5761_get_status, .get_rf_strength = tea5761_get_rf_strength, + .init = tea5761_init, + .sleep = tea5761_sleep, }; struct dvb_frontend *tea5761_attach(struct dvb_frontend *fe,
Signature · 1 line
1.5.6.rc0.84.g06f60.dirty
PATCH 2/3 tea5761 tuner: fix registers utilization
From: Eduardo Valentin <[email protected]>
Fix registers utilization.
tnctrl register was supposed to be used but it was right shifted. frqset also was being configured using incorrect equation.
--- drivers/media/common/tuners/tea5761.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/media/common/tuners/tea5761.c +7 -4
@@ -101,6 +101,8 @@ struct tea5761_priv {/* All zero = no test mode */ +#define TEA5761_TESTREG_TRIGFR 0x08 +/* MANID - Read: bytes 12 and 13 */ /* First byte - should be 0x10 */
@@ -147,20 +149,21 @@ static int set_radio_freq(struct dvb_frontend *fe,if (params->mode ==T_STANDBY ) {tuner_dbg ("TEA5761 set to standby mode\n" ); - buffer[5 ] |=TEA5761_TNCTRL_MU ; + buffer[4 ] |=TEA5761_TNCTRL_MU ; }else { - buffer[4 ] |=TEA5761_TNCTRL_PUPD_0 ; + buffer[3 ] |=TEA5761_TNCTRL_PUPD_0 ; } + buffer[5 ] =TEA5761_TESTREG_TRIGFR ;if (params->audmode ==V4L2_TUNER_MODE_MONO ) {tuner_dbg ("TEA5761 set to mono\n" ); - buffer[5 ] |=TEA5761_TNCTRL_MST ; + buffer[4 ] |=TEA5761_TNCTRL_MST ; }else {tuner_dbg ("TEA5761 set to stereo\n" ); } - div = (1000 * (frq *4 /16 +700 +225 ) ) >>15 ; + div = (frq *125 /2 -225000 ) >>13 ; buffer[1 ] = (div >>8 ) &0x3f ; buffer[2 ] = div &0xff ;
Signature · 1 line
1.5.6.rc0.84.g06f60.dirty
PATCH 3/3 radio-tea5761: Update driver
From: Eduardo Valentin <[email protected]>
This patch updates this driver by changing the way it accesses the device. There is the tuner API which already has an implementation for tea5761.
This patch changes the driver to use tuner API.
It also changes the way ioctls are handled. This way it is more easy to deal with v4l2 and v4l calls.
Some cleans are also done.
--- drivers/media/radio/Kconfig | 1 + drivers/media/radio/Makefile | 2 + drivers/media/radio/radio-tea5761.c | 570 +++++++++++++++++------------------ 3 files changed, 278 insertions(+), 295 deletions(-)
drivers/media/radio/Kconfig +1 -0
@@ -341,6 +341,7 @@ config RADIO_ZOLTRIX_PORT config RADIO_TEA5761 tristate "Philips Semiconductors TEA5761 I2C FM Radio" + depends on MEDIA_TUNER_TEA5761 help Choose Y here if you have one of these AM/FM radio cards.
drivers/media/radio/Makefile +2 -0
@@ -25,3 +25,5 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o obj-$(CONFIG_USB_SI470X) += radio-si470x.o EXTRA_CFLAGS += -Isound +EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ +EXTRA_CFLAGS += -Idrivers/media/common/tuners/
drivers/media/radio/radio-tea5761.c +275 -295
688 lines not on this page · raw message
Signature · 1 line
1.5.6.rc0.84.g06f60.dirty
Quoted 7 lines · Eduardo Valentin
From: Eduardo Valentin <[email protected]>
Hi guys,
Following recommendation from v4l people, I'm sending this update to our tea5761 driver.
Quoted 8 lines
They already had a tuner for this device which communicates through i2c.
I needed to update it because there were some register mis-utilization.
Here is a series which updates their tuner and our driver.
After acks and merging here in linux-omap I'll send it to v4l again.
Pushing these today.
Tony
Quoted 18 lines
Cheers,
Eduardo Valentin (3):
tea5761: Add init and sleep callbacks on tea5761 tuner tea5761 tuner: fix registers utilization
radio-tea5761: Update driverdrivers/media/common/tuners/tea5761.c | 55 +++- drivers/media/radio/Kconfig | 1 + drivers/media/radio/Makefile | 2 + drivers/media/radio/radio-tea5761.c | 570 ++++++++++++++++----------------- 4 files changed, 329 insertions(+), 299 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html