All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: linux-media@vger.kernel.org
Subject: [PATCH 04/21] [staging] tm6000: Use correct input in radio mode.
Date: Thu,  4 Aug 2011 09:14:02 +0200	[thread overview]
Message-ID: <1312442059-23935-5-git-send-email-thierry.reding@avionic-design.de> (raw)
In-Reply-To: <1312442059-23935-1-git-send-email-thierry.reding@avionic-design.de>

In radio mode, the correct input is rinput. The pseudo index 5 is used
but cannot be used to index the vinput array because that only has 3
elements.
---
 drivers/staging/tm6000/tm6000-stds.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c
index bebf1f3..cd69626 100644
--- a/drivers/staging/tm6000/tm6000-stds.c
+++ b/drivers/staging/tm6000/tm6000-stds.c
@@ -525,6 +525,7 @@ static int tm6000_load_std(struct tm6000_core *dev,
 
 int tm6000_set_standard(struct tm6000_core *dev)
 {
+	struct tm6000_input *input;
 	int i, rc = 0;
 	u8 reg_07_fe = 0x8a;
 	u8 reg_08_f1 = 0xfc;
@@ -533,12 +534,13 @@ int tm6000_set_standard(struct tm6000_core *dev)
 
 	tm6000_get_std_res(dev);
 
-	if (dev->radio) {
-		/* todo */
-	}
+	if (!dev->radio)
+		input = &dev->vinput[dev->input];
+	else
+		input = &dev->rinput;
 
 	if (dev->dev_type == TM6010) {
-		switch (dev->vinput[dev->input].vmux) {
+		switch (input->vmux) {
 		case TM6000_VMUX_VIDEO_A:
 			tm6000_set_reg(dev, TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4);
 			tm6000_set_reg(dev, TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1);
@@ -567,7 +569,7 @@ int tm6000_set_standard(struct tm6000_core *dev)
 		default:
 			break;
 		}
-		switch (dev->vinput[dev->input].amux) {
+		switch (input->amux) {
 		case TM6000_AMUX_ADC1:
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x00, 0x0f);
@@ -602,32 +604,32 @@ int tm6000_set_standard(struct tm6000_core *dev)
 		tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, reg_08_f1);
 		tm6000_set_reg(dev, TM6010_REQ07_RFE_POWER_DOWN, reg_07_fe);
 	} else {
-		switch (dev->vinput[dev->input].vmux) {
+		switch (input->vmux) {
 		case TM6000_VMUX_VIDEO_A:
 			tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x10);
 			tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x00);
 			tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x0f);
 			tm6000_set_reg(dev,
-			    REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 0);
+			    REQ_03_SET_GET_MCU_PIN, input->v_gpio, 0);
 			break;
 		case TM6000_VMUX_VIDEO_B:
 			tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x00);
 			tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x00);
 			tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x0f);
 			tm6000_set_reg(dev,
-			    REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 0);
+			    REQ_03_SET_GET_MCU_PIN, input->v_gpio, 0);
 			break;
 		case TM6000_VMUX_VIDEO_AB:
 			tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x10);
 			tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x10);
 			tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x00);
 			tm6000_set_reg(dev,
-			    REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 1);
+			    REQ_03_SET_GET_MCU_PIN, input->v_gpio, 1);
 			break;
 		default:
 			break;
 		}
-		switch (dev->vinput[dev->input].amux) {
+		switch (input->amux) {
 		case TM6000_AMUX_ADC1:
 			tm6000_set_reg_mask(dev,
 				TM6000_REQ07_REB_VADC_AADC_MODE, 0x00, 0x0f);
@@ -640,7 +642,7 @@ int tm6000_set_standard(struct tm6000_core *dev)
 			break;
 		}
 	}
-	if (dev->vinput[dev->input].type == TM6000_INPUT_SVIDEO) {
+	if (input->type == TM6000_INPUT_SVIDEO) {
 		for (i = 0; i < ARRAY_SIZE(svideo_stds); i++) {
 			if (dev->norm & svideo_stds[i].id) {
 				rc = tm6000_load_std(dev, svideo_stds[i].common,
@@ -668,8 +670,8 @@ ret:
 		return rc;
 
 	if ((dev->dev_type == TM6010) &&
-	    ((dev->vinput[dev->input].amux == TM6000_AMUX_SIF1) ||
-	    (dev->vinput[dev->input].amux == TM6000_AMUX_SIF2)))
+	    ((input->amux == TM6000_AMUX_SIF1) ||
+	    (input->amux == TM6000_AMUX_SIF2)))
 		tm6000_set_audio_std(dev);
 
 	msleep(40);
-- 
1.7.6


  parent reply	other threads:[~2011-08-04  7:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04  7:13 [PATCH 00/21] [staging] tm6000: Assorted fixes and improvements Thierry Reding
2011-08-04  7:13 ` [PATCH 01/21] [media] tuner/xc2028: Add I2C flush callback Thierry Reding
2011-08-04  7:14 ` [PATCH 02/21] [media] tuner/xc2028: Fix frequency offset for radio mode Thierry Reding
2011-08-31 18:32   ` Mauro Carvalho Chehab
2011-09-01  5:10     ` Thierry Reding
2011-09-01 12:45       ` Andrew Goff
2011-09-01 14:31         ` Mauro Carvalho Chehab
2011-09-02  8:19         ` Thierry Reding
2011-12-31  0:31           ` Javier S. Pedro
2011-08-04  7:14 ` [PATCH 03/21] [staging] tm6000: Miscellaneous cleanups Thierry Reding
2011-08-04  7:14 ` Thierry Reding [this message]
2011-08-04  7:14 ` [PATCH 05/21] [staging] tm6000: Implement I2C flush callback Thierry Reding
2011-08-04  7:14 ` [PATCH 06/21] [staging] tm6000: Increase maximum I2C packet size Thierry Reding
2011-08-31 19:45   ` Mauro Carvalho Chehab
2011-09-01  5:08     ` Thierry Reding
2011-08-04  7:14 ` [PATCH 07/21] [staging] tm6000: Remove artificial delay Thierry Reding
2011-08-31 19:50   ` Mauro Carvalho Chehab
2011-09-01  5:13     ` Thierry Reding
2011-09-01  5:47       ` Mauro Carvalho Chehab
2011-09-01  6:27         ` [PATCH 1/2] [media] tm6000: Add fast USB access quirk Thierry Reding
2011-09-01  6:27           ` [PATCH 2/2] [media] tm6000: Enable fast USB quirk on Cinergy Hybrid Thierry Reding
2011-09-01  6:33           ` [PATCH 1/2] [media] tm6000: Add fast USB access quirk Thierry Reding
2011-09-01  6:43         ` [PATCH v2 " Thierry Reding
2011-09-01  6:43           ` [PATCH v2 2/2] [media] tm6000: Enable fast USB quirk on Cinergy Hybrid Thierry Reding
2011-08-04  7:14 ` [PATCH 08/21] [staging] tm6000: Flesh out the IRQ callback Thierry Reding
2011-08-04  7:14 ` [PATCH 09/21] [staging] tm6000: Rename active interface register Thierry Reding
2011-08-04  7:14 ` [PATCH 10/21] [staging] tm6000: Disable video interface in radio mode Thierry Reding
2011-08-04  7:14 ` [PATCH 11/21] [staging] tm6000: Rework standard register tables Thierry Reding
2011-08-04  7:14 ` [PATCH 12/21] [staging] tm6000: Add locking for USB transfers Thierry Reding
2011-08-04  7:14 ` [PATCH 13/21] [staging] tm6000: Properly count device usage Thierry Reding
2011-08-04  7:14 ` [PATCH 14/21] [staging] tm6000: Initialize isochronous transfers only once Thierry Reding
2011-08-04  7:14 ` [PATCH 15/21] [staging] tm6000: Execute lightweight reset on close Thierry Reding
2011-08-31 20:53   ` Mauro Carvalho Chehab
     [not found]     ` <4E5EAA41.4060502@redhat.com>
2011-09-01  5:24       ` Thierry Reding
2011-09-03 17:17         ` Mauro Carvalho Chehab
2011-09-05  5:38           ` Thierry Reding
2011-08-04  7:14 ` [PATCH 16/21] [staging] tm6000: Select interface on first open Thierry Reding
2011-08-31 20:02   ` Mauro Carvalho Chehab
2011-09-01  5:19     ` Thierry Reding
2011-09-01  5:53       ` Mauro Carvalho Chehab
2011-09-01  6:10         ` Thierry Reding
2011-08-04  7:14 ` [PATCH 17/21] [staging] tm6000: Do not use video buffers in radio mode Thierry Reding
2011-08-04  7:14 ` [PATCH 18/21] [staging] tm6000: Plug memory leak on PCM free Thierry Reding
2011-08-04  7:14 ` [PATCH 19/21] [staging] tm6000: Enable audio clock in radio mode Thierry Reding
2011-08-04  7:14 ` [PATCH 20/21] [staging] tm6000: Enable radio mode for Cinergy Hybrid XE Thierry Reding
2011-08-04  7:14 ` [PATCH 21/21] [staging] tm6000: Remove unnecessary workaround Thierry Reding
2011-08-31 12:41 ` [PATCH 00/21] [staging] tm6000: Assorted fixes and improvements Mauro Carvalho Chehab
2011-08-31 13:12   ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312442059-23935-5-git-send-email-thierry.reding@avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.