Linux I2C development
 help / color / mirror / Atom feed
From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: [PATCH 4/6]: i2c-pcf: Add a way for bus driver to ask for no smbus quick mode support.
Date: Thu, 21 Aug 2008 02:43:27 -0700 (PDT)	[thread overview]
Message-ID: <20080821.024327.144744678.davem@davemloft.net> (raw)


i2c-pcf: Add a way for bus driver to ask for no smbus quick mode support.

Some PCF bus implementations have precise knowledge of the i2c
devices sitting on the bus, using things such as firmware device
trees, and do not want any of the auto I2C device probing to
occur.

Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index c171ee6..b8e34b0 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -416,8 +416,9 @@ out:
 
 static u32 pcf_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | 
-	       I2C_FUNC_PROTOCOL_MANGLING;
+	struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
+
+	return pcf_adap->func_flags;
 }
 
 /* -----exported algorithm data: -------------------------------------	*/
@@ -430,13 +431,18 @@ static const struct i2c_algorithm pcf_algo = {
 /* 
  * registering functions to load algorithms at runtime 
  */
-int i2c_pcf_add_bus(struct i2c_adapter *adap)
+int i2c_pcf_add_bus(struct i2c_adapter *adap, int support_smbus_quick)
 {
 	struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
 	int rval;
 
 	DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));
 
+	pcf_adap->func_flags = (I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | 
+				I2C_FUNC_PROTOCOL_MANGLING);
+	if (!support_smbus_quick)
+		pcf_adap->func_flags &= ~I2C_FUNC_SMBUS_QUICK;
+
 	/* register new adapter to i2c module... */
 	adap->algo = &pcf_algo;
 	adap->timeout = 100;
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 37bb528..2be6b5b 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -281,7 +281,7 @@ static int __devinit elektor_probe(struct device *dev, unsigned int id)
 	if (pcf_isa_init())
 		return -ENODEV;
 	pcf_isa_ops.dev.parent = dev;
-	if (i2c_pcf_add_bus(&pcf_isa_ops) < 0)
+	if (i2c_pcf_add_bus(&pcf_isa_ops, 1) < 0)
 		goto fail;
 
 	dev_info(dev, "found device at %#x\n", base);
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 78c62ed..388776a 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -36,6 +36,8 @@ struct i2c_algo_pcf_data {
 	void (*xfer_begin)(void *data);
 	void (*xfer_end)(void *data);
 
+	u32 func_flags;
+
 	/* Multi-master lost arbitration back-off delay (msecs)
 	 * This should be set by the bus adapter or knowledgable client
 	 * if bus is multi-mastered, else zero
@@ -43,6 +45,6 @@ struct i2c_algo_pcf_data {
 	unsigned long lab_mdelay;
 };
 
-int i2c_pcf_add_bus(struct i2c_adapter *);
+int i2c_pcf_add_bus(struct i2c_adapter *adap, int support_smbus_quick);
 
 #endif /* _LINUX_I2C_ALGO_PCF_H */
-- 
1.5.6.5.GIT


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

             reply	other threads:[~2008-08-21  9:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21  9:43 David Miller [this message]
     [not found] ` <20080821.024327.144744678.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-10-15 12:33   ` [PATCH 4/6]: i2c-pcf: Add a way for bus driver to ask for no smbus quick mode support Jean Delvare
     [not found]     ` <20081015143321.7df02b35-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-15 21:34       ` David Miller
     [not found]         ` <20081015.143452.114860633.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-10-15 22:57           ` David Miller
2008-10-16 10:13           ` Jean Delvare
     [not found]             ` <20081016121315.2adb5de1-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-16 10:46               ` Wolfram Sang
     [not found]                 ` <20081016104623.GB3432-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-10-16 11:35                   ` Jean Delvare
2008-10-16 19:25               ` David Miller
     [not found]                 ` <20081016.122542.30729839.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-10-16 19:34                   ` Jean Delvare
     [not found]                     ` <20081016213407.34d9eaa8-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-16 19:38                       ` David Miller

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=20080821.024327.144744678.davem@davemloft.net \
    --to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.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