mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Chris Zankel <chris@zankel.net>
Cc: linux-kernel@vger.kernel.org, "Daniel Glöckner" <dg@emlix.com>
Subject: [patch 3/5] xtensa: add mt9d131l demo head to s6105 platform
Date: Thu, 26 Mar 2009 15:49:32 +0100	[thread overview]
Message-ID: <1238078974-26040-3-git-send-email-dg@emlix.com> (raw)
In-Reply-To: <1238078974-26040-1-git-send-email-dg@emlix.com>

The mt9d131 is behind a pca9543 which needs to be configured before
we can find the sensor. Our s6_pca9543_callback is called directly
from pca9543_probe, so we may not call i2c_new_device immediately.

If Rodolfo Giometti's multiplexed i2c bus code and pca954x driver
is accepted, most of this patch can be replaced by a simple
i2c_register_board_info call.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 arch/xtensa/platforms/s6105/device.c |   35 ++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c
index 07fb329..ff047fc 100644
--- a/arch/xtensa/platforms/s6105/device.c
+++ b/arch/xtensa/platforms/s6105/device.c
@@ -207,9 +207,33 @@ static struct s6dp_link s6dp_links[] = {
 		.is_egress = 1,
 		.minor = 2,
 	},
+	{
+		.port_mask = 1 << 3,
+		.is_egress = 0,
+		.minor = 3,
+	},
 	{ }
 };
 
+static void s6_attach_camera(struct work_struct *ws)
+{
+	struct i2c_board_info mt9d131_bi = {
+		I2C_BOARD_INFO("mt9d131", S6I2C_ADDR_MT9D131),
+		.platform_data = &s6dp_links[1]
+	};
+	i2c_new_device(i2c_get_adapter(0), &mt9d131_bi);
+}
+
+static DECLARE_WORK(s6_attach_camera_work, s6_attach_camera);
+
+static void s6_pca9543_callback(struct i2c_client *client,
+				int (set_switch)(struct i2c_client *, unsigned))
+{
+	set_switch(client, 3);
+	/* i2c_attach_client does not look reentrant */
+	schedule_work(&s6_attach_camera_work);
+}
+
 static struct i2c_board_info __initdata s6_i2c_devices[] = {
 	{
 		I2C_BOARD_INFO("24c02", S6I2C_ADDR_AT24HC02B),
@@ -221,6 +245,10 @@ static struct i2c_board_info __initdata s6_i2c_devices[] = {
 		I2C_BOARD_INFO("saa7121", S6I2C_ADDR_SAA7121),
 		.platform_data = &s6dp_links[0],
 	},
+	{
+		I2C_BOARD_INFO("pca9543", S6I2C_ADDR_PCA9543),
+		.platform_data = &s6_pca9543_callback
+	},
 };
 
 static struct resource s6_isef_resource[] = {
@@ -453,6 +481,13 @@ static int __init device_init(void)
 		gpio_set_value(GPIO_BP_RESET, 1);
 	}
 
+	/* reset MT9D131 */
+	if (!gpio_request(GPIO_IMAGER_RESET, "imager_reset")) {
+		gpio_direction_output(GPIO_IMAGER_RESET, 0);
+		udelay(1);
+		gpio_set_value(GPIO_IMAGER_RESET, 1);
+	}
+
 	i2c_register_board_info(S6_I2C_BUS_NUM, s6_i2c_devices,
 				ARRAY_SIZE(s6_i2c_devices));
 	spi_register_board_info(s6_spi_devices, ARRAY_SIZE(s6_spi_devices));
-- 
1.6.2.107.ge47ee


  parent reply	other threads:[~2009-03-26 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 14:49 [patch 1/5] xtensa: add s6000 data port " Daniel Glöckner
2009-03-26 14:49 ` [patch 2/5] xtensa: add saa7121 " Daniel Glöckner
2009-03-26 14:49 ` Daniel Glöckner [this message]
2009-03-26 14:49 ` [patch 4/5] xtensa: add resources for canonical data port modes " Daniel Glöckner
2009-03-26 14:49 ` [patch 5/5] xtensa: s6000 video updates for s6105_defconfig Daniel Glöckner

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=1238078974-26040-3-git-send-email-dg@emlix.com \
    --to=dg@emlix.com \
    --cc=chris@zankel.net \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®