diff mbox

[3/4] staging: media: go7007: i2c GPIO initialization Reset i2c stuff for GO7007_BOARDID_ADLINK_MPG24 need reset GPIO always when encoder initialize

Message ID 1358341251-10087-3-git-send-email-volokh84@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Volokh Konstantin Jan. 16, 2013, 1 p.m. UTC
Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-driver.c |    5 +++++
 drivers/staging/media/go7007/go7007-usb.c    |    3 ---
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Dan Carpenter Jan. 16, 2013, 1:36 p.m. UTC | #1
You've added the writes for GO7007_BOARDID_ADLINK_MPG24 but removed
them for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.  Won't
that break those boards?

regards,
dan carpenter


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Volokh Konstantin Jan. 16, 2013, 2 p.m. UTC | #2
On Wed, Jan 16, 2013 at 04:36:08PM +0300, Dan Carpenter wrote:
> You've added the writes for GO7007_BOARDID_ADLINK_MPG24 but removed
> them for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.  Won't
> that break those boards?
>
I don`t remove code for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.
case there are auto reusing for XMen and XMen-III:
look old code:
if ((go->board_id == GO7007_BOARDID_XMEN ||
				go->board_id == GO7007_BOARDID_XMEN_III) &&
			go->i2c_adapter_online) {
		union i2c_smbus_data data;

		/* Check to see if register 0x0A is 0x76 */
		i2c_smbus_xfer(&go->i2c_adapter, 0x21, I2C_CLIENT_SCCB,
			I2C_SMBUS_READ, 0x0A, I2C_SMBUS_BYTE_DATA, &data);
		if (data.byte != 0x76) {
			if (assume_endura) {
				go->board_id = GO7007_BOARDID_ENDURA;
				usb->board = board = &board_endura;
				go->board_info = &board->main_info;
				strncpy(go->name, "Pelco Endura",
					sizeof(go->name));
			} else {
				u16 channel;
-				/* set GPIO5 to be an output, currently low */
-				go7007_write_addr(go, 0x3c82, 0x0000);
-				go7007_write_addr(go, 0x3c80, 0x00df);
				/* read channel number from GPIO[1:0] */
				go7007_read_addr(go, 0x3c81, &channel);
				channel &= 0x3;
>>>				go->board_id = GO7007_BOARDID_ADLINK_MPG24;
Here any XMen or XMen-III will reassigned as Adlink-mpg24 id
so any i2c initialization will reassigned to that id and we can use that id in
init_encoder.
				usb->board = board = &board_adlink_mpg24;
				go->board_info = &board->main_info;
				go->channel_number = channel;
				snprintf(go->name, sizeof(go->name),
					"Adlink PCI-MPG24, channel #%d",
					channel);
			}
		}
	}
> regards,
> dan carpenter
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter Jan. 16, 2013, 2:33 p.m. UTC | #3
On Wed, Jan 16, 2013 at 06:00:13PM +0400, Volokh Konstantin wrote:
> On Wed, Jan 16, 2013 at 04:36:08PM +0300, Dan Carpenter wrote:
> > You've added the writes for GO7007_BOARDID_ADLINK_MPG24 but removed
> > them for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.  Won't
> > that break those boards?
> >
> I don`t remove code for GO7007_BOARDID_XMEN and GO7007_BOARDID_XMEN_III.
> case there are auto reusing for XMen and XMen-III:

Ah.  Grand.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
index a66e339..c0ea312 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -173,6 +173,11 @@  static int go7007_init_encoder(struct go7007 *go)
 		go7007_write_addr(go, 0x3c82, 0x0001);
 		go7007_write_addr(go, 0x3c80, 0x00fe);
 	}
+	if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) {
+		/* set GPIO5 to be an output, currently low */
+		go7007_write_addr(go, 0x3c82, 0x0000);
+		go7007_write_addr(go, 0x3c80, 0x00df);
+	}
 	return 0;
 }
 
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index a6cad15..9dbf5ec 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1110,9 +1110,6 @@  static int go7007_usb_probe(struct usb_interface *intf,
 			} else {
 				u16 channel;
 
-				/* set GPIO5 to be an output, currently low */
-				go7007_write_addr(go, 0x3c82, 0x0000);
-				go7007_write_addr(go, 0x3c80, 0x00df);
 				/* read channel number from GPIO[1:0] */
 				go7007_read_addr(go, 0x3c81, &channel);
 				channel &= 0x3;