[PATCH] m920x fixes [7/10]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



s/m9206/m920x/
s/M9206/M9205/

Signed-of-by: Aapo Tahkola <aet@xxxxxxxxxxxxxx>

-- 
Aapo Tahkola
diff -r aedb7e7d6a5d linux/drivers/media/dvb/dvb-usb/m920x.c
--- a/linux/drivers/media/dvb/dvb-usb/m920x.c	Sat Mar 03 01:33:49 2007 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.c	Sat Mar 03 01:43:32 2007 +0200
@@ -39,7 +39,7 @@ static struct dvb_usb_rc_key megasky_rc_
 	{ 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */
 };
 
-static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,\
+static inline int m920x_read(struct usb_device *udev, u8 request, u16 value,\
 			     u16 index, void *data, int size)
 {
 	int ret;
@@ -56,7 +56,7 @@ static inline int m9206_read(struct usb_
 	return 0;
 }
 
-static inline int m9206_write(struct usb_device *udev, u8 request,
+static inline int m920x_write(struct usb_device *udev, u8 request,
 			      u16 value, u16 index)
 {
 	int ret;
@@ -67,32 +67,32 @@ static inline int m9206_write(struct usb
 	return ret;
 }
 
-static int m9206_init(struct dvb_usb_device *d)
+static int m920x_init(struct dvb_usb_device *d)
 {
 	int ret = 0;
 
 	/* Remote controller init. */
 	if (d->props.rc_query) {
-		if ((ret = m9206_write(d->udev, M9206_CORE, 0xa8, M9206_RC_INIT2)) != 0)
+		if ((ret = m920x_write(d->udev, M9205_CORE, 0xa8, M9205_RC_INIT2)) != 0)
 			return ret;
 
-		if ((ret = m9206_write(d->udev, M9206_CORE, 0x51, M9206_RC_INIT1)) != 0)
+		if ((ret = m920x_write(d->udev, M9205_CORE, 0x51, M9205_RC_INIT1)) != 0)
 			return ret;
 	}
 
 	return ret;
 }
 
-static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
-{
-	struct m9206_state *m = d->priv;
+static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+{
+	struct m920x_state *m = d->priv;
 	int i, ret = 0;
 	u8 rc_state[2];
 
-	if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
+	if ((ret = m920x_read(d->udev, M9205_CORE, 0x0, M9205_RC_STATE, rc_state, 1)) != 0)
 		goto unlock;
 
-	if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
+	if ((ret = m920x_read(d->udev, M9205_CORE, 0x0, M9205_RC_KEY, rc_state + 1, 1)) != 0)
 		goto unlock;
 
 	for (i = 0; i < d->props.rc_key_map_size; i++)
@@ -134,11 +134,11 @@ static int m9206_rc_query(struct dvb_usb
 }
 
 /* I2C */
-static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
+static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 			  int num)
 {
 	struct dvb_usb_device *d = i2c_get_adapdata(adap);
-	struct m9206_state *m = d->priv;
+	struct m920x_state *m = d->priv;
 	int i, j;
 	int ret = 0;
 
@@ -148,30 +148,30 @@ static int m9206_i2c_xfer(struct i2c_ada
 	for (i = 0; i < num; i++) {
 		if (msg[i].flags & I2C_M_RD) {
 
-			if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr << 1) | 0x01, 0x80)) != 0)
+			if ((ret = m920x_write(d->udev, M9205_I2C, (msg[i].addr << 1) | 0x01, 0x80)) != 0)
 				goto unlock;
 
 			for(j = 0; j < msg[i].len; j++) {
 				if (j + 1 == msg[i].len && i + 1== num) {
-					if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x60, &msg[i].buf[j], msg[i].len)) != 0)
+					if ((ret = m920x_read(d->udev, M9205_I2C, 0x0, 0x60, &msg[i].buf[j], msg[i].len)) != 0)
 						goto unlock;
 				} else {
-					if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x21, &msg[i].buf[j], msg[i].len)) != 0)
+					if ((ret = m920x_read(d->udev, M9205_I2C, 0x0, 0x21, &msg[i].buf[j], msg[i].len)) != 0)
 						goto unlock;
 				}
 			}
 
 		} else {
-			if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr << 1, 0x80)) != 0)
+			if ((ret = m920x_write(d->udev, M9205_I2C, msg[i].addr << 1, 0x80)) != 0)
 				goto unlock;
 		
 			for(j = 0; j < msg[i].len; j++) {
 				if (j + 1 == msg[i].len && i + 1== num) {
-					if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], 0x40)) != 0)
+					if ((ret = m920x_write(d->udev, M9205_I2C, msg[i].buf[j], 0x40)) != 0)
 						goto unlock;
 					
 				} else {
-					if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], 0x0)) != 0)
+					if ((ret = m920x_write(d->udev, M9205_I2C, msg[i].buf[j], 0x0)) != 0)
 						goto unlock;
 				}
 			}
@@ -184,18 +184,18 @@ static int m9206_i2c_xfer(struct i2c_ada
 	return ret;
 }
 
-static u32 m9206_i2c_func(struct i2c_adapter *adapter)
+static u32 m920x_i2c_func(struct i2c_adapter *adapter)
 {
 	return I2C_FUNC_I2C;
 }
 
-static struct i2c_algorithm m9206_i2c_algo = {
-	.master_xfer   = m9206_i2c_xfer,
-	.functionality = m9206_i2c_func,
-};
-
-
-static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx,
+static struct i2c_algorithm m920x_i2c_algo = {
+	.master_xfer   = m920x_i2c_xfer,
+	.functionality = m920x_i2c_func,
+};
+
+
+static int m920x_set_filter(struct dvb_usb_adapter *adap, int type, int idx,
 			    int pid)
 {
 	int ret = 0;
@@ -205,75 +205,75 @@ static int m9206_set_filter(struct dvb_u
 
 	pid |= 0x8000;
 
-	if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
-		return ret;
-
-	if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
-		return ret;
-
-	return ret;
-}
-
-static int m9206_update_filters(struct dvb_usb_adapter *adap)
-{
-	struct m9206_state *m = adap->dev->priv;
+	if ((ret = m920x_write(adap->dev->udev, M9205_FILTER, pid, (type << 8) | (idx * 4) )) != 0)
+		return ret;
+
+	if ((ret = m920x_write(adap->dev->udev, M9205_FILTER, 0, (type << 8) | (idx * 4) )) != 0)
+		return ret;
+
+	return ret;
+}
+
+static int m920x_update_filters(struct dvb_usb_adapter *adap)
+{
+	struct m920x_state *m = adap->dev->priv;
 	int enabled = m->filtering_enabled;
 	int i, ret = 0, filter = 0;
 
-	for (i = 0; i < M9206_MAX_FILTERS; i++)
+	for (i = 0; i < M9205_MAX_FILTERS; i++)
 		if (m->filters[i] == 8192)
 			enabled = 0;
 
 	/* Disable all filters */
-	if ((ret = m9206_set_filter(adap, 0x81, 1, enabled)) != 0)
-		return ret;
-
-	for (i = 0; i < M9206_MAX_FILTERS; i++)
-		if ((ret = m9206_set_filter(adap, 0x81, i + 2, 0)) != 0)
+	if ((ret = m920x_set_filter(adap, 0x81, 1, enabled)) != 0)
+		return ret;
+
+	for (i = 0; i < M9205_MAX_FILTERS; i++)
+		if ((ret = m920x_set_filter(adap, 0x81, i + 2, 0)) != 0)
 			return ret;
 
-	if ((ret = m9206_set_filter(adap, 0x82, 0, 0x0)) != 0)
+	if ((ret = m920x_set_filter(adap, 0x82, 0, 0x0)) != 0)
 		return ret;
 
 	/* Set */
 	if (enabled) {
-		for (i = 0; i < M9206_MAX_FILTERS; i++) {
+		for (i = 0; i < M9205_MAX_FILTERS; i++) {
 			if (m->filters[i] == 0)
 				continue;
 
-			if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
+			if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0)
 				return ret;
 
 			filter++;
 		}
 	}
 
-	if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
-		return ret;
-
-	return ret;
-}
-
-static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
-{
-	struct m9206_state *m = adap->dev->priv;
+	if ((ret = m920x_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
+		return ret;
+
+	return ret;
+}
+
+static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
+{
+	struct m920x_state *m = adap->dev->priv;
 
 	m->filtering_enabled = onoff ? 1 : 0;
 
-	return m9206_update_filters(adap);
-}
-
-static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
+	return m920x_update_filters(adap);
+}
+
+static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
 			    int onoff)
 {
-	struct m9206_state *m = adap->dev->priv;
+	struct m920x_state *m = adap->dev->priv;
 
 	m->filters[index] = onoff ? pid : 0;
 
-	return m9206_update_filters(adap);
-}
-
-static int m9206_firmware_download(struct usb_device *udev,
+	return m920x_update_filters(adap);
+}
+
+static int m920x_firmware_download(struct usb_device *udev,
 				   const struct firmware *fw)
 {
 	u16 value, index, size;
@@ -282,11 +282,11 @@ static int m9206_firmware_download(struc
 
 	buff = kmalloc(65536, GFP_KERNEL);
 
-	if ((ret = m9206_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0)
+	if ((ret = m920x_read(udev, M9205_FILTER, 0x0, 0x8000, read, 4)) != 0)
 		goto done;
 	deb_rc("%x %x %x %x\n", read[0], read[1], read[2], read[3]);
 
-	if ((ret = m9206_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0)
+	if ((ret = m920x_read(udev, M9205_FW, 0x0, 0x0, read, 1)) != 0)
 		goto done;
 	deb_rc("%x\n", read[0]);
 
@@ -306,7 +306,7 @@ static int m9206_firmware_download(struc
 				memcpy(buff, fw->data + i, size);
 
 				ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
-					    M9206_FW,
+					    M9205_FW,
 					    USB_TYPE_VENDOR | USB_DIR_OUT,
 					    value, index, buff, size, 20);
 				if (ret != size) {
@@ -326,8 +326,8 @@ static int m9206_firmware_download(struc
 
 	msleep(36);
 
-	/* m9206 will disconnect itself from the bus after this. */
-	(void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO);
+	/* m920x will disconnect itself from the bus after this. */
+	(void) m920x_write(udev, M9205_CORE, 0x01, M9205_FW_GO);
 	deb_rc("firmware uploaded!\n");
 
 	done:
@@ -434,7 +434,7 @@ static int m920x_probe(struct usb_interf
 	if (ret < 0)
 		return ret;
 
-	if ((ret = m9206_init(d)) != 0)
+	if ((ret = m920x_init(d)) != 0)
 		return ret;
 
 	return ret;
@@ -451,14 +451,14 @@ static struct dvb_usb_device_properties 
 
 	.usb_ctrl = DEVICE_SPECIFIC,
 	.firmware = "dvb-usb-megasky-02.fw",
-	.download_firmware = m9206_firmware_download,
+	.download_firmware = m920x_firmware_download,
 
 	.rc_interval      = 100,
 	.rc_key_map       = megasky_rc_keys,
 	.rc_key_map_size  = ARRAY_SIZE(megasky_rc_keys),
-	.rc_query         = m9206_rc_query,
-
-	.size_of_priv     = sizeof(struct m9206_state),
+	.rc_query         = m920x_rc_query,
+
+	.size_of_priv     = sizeof(struct m920x_state),
 
 	.identify_state   = megasky_identify_state,
 	.num_adapters = 1,
@@ -467,8 +467,8 @@ static struct dvb_usb_device_properties 
 			DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
 
 		.pid_filter_count = 8,
-		.pid_filter       = m9206_pid_filter,
-		.pid_filter_ctrl  = m9206_pid_filter_ctrl,
+		.pid_filter       = m920x_pid_filter,
+		.pid_filter_ctrl  = m920x_pid_filter_ctrl,
 
 		.frontend_attach  = megasky_mt352_frontend_attach,
 		.tuner_attach     = megasky_qt1010_tuner_attach,
@@ -484,7 +484,7 @@ static struct dvb_usb_device_properties 
 			}
 		},
 	}},
-	.i2c_algo         = &m9206_i2c_algo,
+	.i2c_algo         = &m920x_i2c_algo,
 
 	.num_device_descs = 1,
 	.devices = {
diff -r aedb7e7d6a5d linux/drivers/media/dvb/dvb-usb/m920x.h
--- a/linux/drivers/media/dvb/dvb-usb/m920x.h	Sat Mar 03 01:33:49 2007 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.h	Sat Mar 03 01:42:48 2007 +0200
@@ -6,18 +6,18 @@
 
 #define deb_rc(args...)   dprintk(dvb_usb_m920x_debug,0x01,args)
 
-#define M9206_CORE	0x22
-#define M9206_RC_STATE	0xff51
-#define M9206_RC_KEY	0xff52
-#define M9206_RC_INIT1	0xff54
-#define M9206_RC_INIT2	0xff55
-#define M9206_FW_GO	0xff69
+#define M9205_CORE	0x22
+#define M9205_RC_STATE	0xff51
+#define M9205_RC_KEY	0xff52
+#define M9205_RC_INIT1	0xff54
+#define M9205_RC_INIT2	0xff55
+#define M9205_FW_GO	0xff69
 
-#define M9206_I2C	0x23
-#define M9206_FILTER	0x25
-#define M9206_FW	0x30
+#define M9205_I2C	0x23
+#define M9205_FILTER	0x25
+#define M9205_FW	0x30
 
-#define M9206_MAX_FILTERS 8
+#define M9205_MAX_FILTERS 8
 
 /*
 sequences found in logs:
@@ -45,8 +45,8 @@ 0x60: read last byte of message sequence
 0x60: read last byte of message sequence
  */
 
-struct m9206_state {
-	u16 filters[M9206_MAX_FILTERS];
+struct m920x_state {
+	u16 filters[M9205_MAX_FILTERS];
 	int filtering_enabled;
 	int rep_count;
 };
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux