All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Volokh Konstantin <volokh84@gmail.com>,
	Pete Eberlein <pete@sensoray.com>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [REVIEW PATCH 15/42] go7007: i2c initialization changes for tw2804
Date: Mon, 11 Mar 2013 12:45:53 +0100	[thread overview]
Message-ID: <3c76a3818b822080196b255e88d139ca6e08140c.1363000605.git.hans.verkuil@cisco.com> (raw)
In-Reply-To: <1363002380-19825-1-git-send-email-hverkuil@xs4all.nl>
In-Reply-To: <38bc3cc42d0c021432afd29c2c1e22cf380b06e0.1363000605.git.hans.verkuil@cisco.com>

From: Volokh Konstantin <volokh84@gmail.com>

Do i2c initialization via struct item as tw2804 has a 0x00 i2c address,
so we need to use the I2C_CLIENT_TEN flag for validity.

Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/staging/media/go7007/go7007-driver.c |   20 +++++++++++---------
 drivers/staging/media/go7007/go7007-priv.h   |    3 ++-
 drivers/staging/media/go7007/go7007-usb.c    |    1 +
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c
index 6695091..2e5be70 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -196,18 +196,22 @@ int go7007_reset_encoder(struct go7007 *go)
 /*
  * Attempt to instantiate an I2C client by ID, probably loading a module.
  */
-static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
-			   int addr)
+static int init_i2c_module(struct i2c_adapter *adapter, const struct go_i2c *const i2c)
 {
 	struct go7007 *go = i2c_get_adapdata(adapter);
 	struct v4l2_device *v4l2_dev = &go->v4l2_dev;
+	struct i2c_board_info info;
 
-	if (v4l2_i2c_new_subdev(v4l2_dev, adapter, type, addr, NULL))
+	memset(&info, 0, sizeof(info));
+	strlcpy(info.type, i2c->type, sizeof(info.type));
+	info.addr = i2c->addr;
+	info.flags = i2c->flags;
+
+	if (v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, NULL))
 		return 0;
 
-	dev_info(&adapter->dev,
-		 "go7007: probing for module i2c:%s failed\n", type);
-	return -1;
+	printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", i2c->type);
+	return -EINVAL;
 }
 
 /*
@@ -243,9 +247,7 @@ int go7007_register_encoder(struct go7007 *go)
 	}
 	if (go->i2c_adapter_online) {
 		for (i = 0; i < go->board_info->num_i2c_devs; ++i)
-			init_i2c_module(&go->i2c_adapter,
-					go->board_info->i2c_devs[i].type,
-					go->board_info->i2c_devs[i].addr);
+			init_i2c_module(&go->i2c_adapter, &go->board_info->i2c_devs[i]);
 		if (go->board_id == GO7007_BOARDID_ADLINK_MPG24)
 			i2c_clients_command(&go->i2c_adapter,
 				DECODER_SET_CHANNEL, &go->channel_number);
diff --git a/drivers/staging/media/go7007/go7007-priv.h b/drivers/staging/media/go7007/go7007-priv.h
index b58c394..b9ebdfb 100644
--- a/drivers/staging/media/go7007/go7007-priv.h
+++ b/drivers/staging/media/go7007/go7007-priv.h
@@ -88,10 +88,11 @@ struct go7007_board_info {
 	int audio_bclk_div;
 	int audio_main_div;
 	int num_i2c_devs;
-	struct {
+	struct go_i2c {
 		const char *type;
 		int id;
 		int addr;
+		u32 flags;
 	} i2c_devs[4];
 	int num_inputs;
 	struct {
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 3333a8f..b44f9b1 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -398,6 +398,7 @@ static struct go7007_usb_board board_adlink_mpg24 = {
 				.type	= "wis_tw2804",
 				.id	= I2C_DRIVERID_WIS_TW2804,
 				.addr	= 0x00, /* yes, really */
+				.flags  = I2C_CLIENT_TEN,
 			},
 		},
 		.num_inputs	 = 1,
-- 
1.7.10.4


  parent reply	other threads:[~2013-03-11 11:46 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 11:45 [REVIEW PATCH 00/42] go7007: complete overhaul Hans Verkuil
2013-03-11 11:45 ` [REVIEW PATCH 01/42] v4l2-ctrls: eliminate lockdep false alarms for struct v4l2_ctrl_handler.lock Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 02/42] v4l2-core: add code to check for specific ops Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 03/42] v4l2-ioctl: check if an ioctl is valid Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 04/42] saa7115: add config flag to change the IDQ polarity Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 05/42] saa7115: improve querystd handling for the saa7115 Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 06/42] saa7115: add support for double-rate ASCLK Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 07/42] go7007: fix i2c_xfer return codes Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 08/42] tuner: add Sony BTF tuners Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 09/42] sony-btf-mpx: the MPX driver for the sony BTF PAL/SECAM tuner Hans Verkuil
2013-03-24 15:21     ` Mauro Carvalho Chehab
2013-03-25  8:52       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 10/42] ov7640: add new ov7640 driver Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 11/42] uda1342: add new uda1342 audio codec driver Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 12/42] tw9903: add new tw9903 video decoder Hans Verkuil
2013-03-24 15:29     ` Mauro Carvalho Chehab
2013-03-24 16:06       ` Mauro Carvalho Chehab
2013-03-25  8:55       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 13/42] tw2804: add support for the Techwell tw2804 Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 14/42] tw2804: modify ADC power control Hans Verkuil
2013-03-11 11:45   ` Hans Verkuil [this message]
2013-03-11 11:45   ` [REVIEW PATCH 16/42] go7007: switch to standard tuner/i2c subdevs Hans Verkuil
2013-03-24 15:35     ` Mauro Carvalho Chehab
2013-03-11 11:45   ` [REVIEW PATCH 17/42] go7007: remove all wis* drivers Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 18/42] go7007: add audio input ioctls Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 19/42] s2250-loader: use usbv2_cypress_load_firmware Hans Verkuil
2013-03-24 15:39     ` Mauro Carvalho Chehab
2013-03-24 15:49       ` Antti Palosaari
2013-03-25  8:56       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 20/42] go7007: go7007: add device_caps and bus_info support to querycap Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 21/42] go7007: remove current_norm Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 22/42] go7007: fix DMA related errors Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 23/42] go7007: remember boot firmware Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 24/42] go7007: fix unregister/disconnect handling Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 25/42] go7007: convert to the control framework and remove obsolete JPEGCOMP support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 26/42] s2250: convert to the control framework Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 27/42] go7007: add prio and control event support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 28/42] go7007: add log_status support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 29/42] go7007: tuner/std related fixes Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 30/42] go7007: standardize MPEG handling support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 31/42] go7007: simplify the PX-TV402U board ID handling Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 32/42] go7007: set up the saa7115 audio clock correctly Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 33/42] go7007: drop struct go7007_file Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 34/42] go7007: convert to core locking and vb2 Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 35/42] go7007: embed struct video_device Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 36/42] go7007: remove cropping functions Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 37/42] saa7134-go7007: add support for this combination Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 38/42] s2250: add comment describing the hardware Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 39/42] go7007-loader: renamed from s2250-loader Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 40/42] go7007-loader: add support for the other devices and move fw files Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 41/42] go7007: update the README Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 42/42] MAINTAINERS: add the go7007 driver Hans Verkuil
2013-03-11 11:50   ` [REVIEW PATCH 01/42] v4l2-ctrls: eliminate lockdep false alarms for struct v4l2_ctrl_handler.lock Hans Verkuil
2013-03-11 22:01 ` [REVIEW PATCH 00/42] go7007: complete overhaul Hans Verkuil
2013-03-12 14:37 ` Darrick Burch
2013-03-12 15:05   ` Hans Verkuil

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=3c76a3818b822080196b255e88d139ca6e08140c.1363000605.git.hans.verkuil@cisco.com \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pete@sensoray.com \
    --cc=volokh84@gmail.com \
    /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.