* [PATCH 1/1] i2c: added FUNC flag for unsupported clock stretching
@ 2015-08-28 10:43 Nicola Corna
2015-09-23 9:04 ` Jean Delvare
0 siblings, 1 reply; 2+ messages in thread
From: Nicola Corna @ 2015-08-28 10:43 UTC (permalink / raw)
To: Wolfram Sang, Jonathan Corbet
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA, Jean Delvare, Nicola Corna
Added I2C_FUNC_NO_CLK_STRETCH, to be used when clock stretching is not
supported.
Added this flag to drivers/i2c/algos/i2c-algo-bit.c when getscl is not
available.
Signed-off-by: Nicola Corna <nicola-V0pQiMyom5mh6J55Ss3d3w@public.gmane.org>
---
Documentation/i2c/functionality | 1 +
drivers/i2c/algos/i2c-algo-bit.c | 5 ++++-
include/uapi/linux/i2c.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Documentation/i2c/functionality b/Documentation/i2c/functionality
index 4aae8ed..f53807e 100644
--- a/Documentation/i2c/functionality
+++ b/Documentation/i2c/functionality
@@ -21,6 +21,7 @@ For the most up-to-date list of functionality constants, please check
I2C_M_REV_DIR_ADDR and I2C_M_NO_RD_ACK
flags (which modify the I2C protocol!)
I2C_FUNC_NOSTART Can skip repeated start sequence
+ I2C_FUNC_NO_CLK_STRETCH Does NOT support clock stretching
I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command
I2C_FUNC_SMBUS_READ_BYTE Handles the SMBus read_byte command
I2C_FUNC_SMBUS_WRITE_BYTE Handles the SMBus write_byte command
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 899bede..82cad0b 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -602,10 +602,13 @@ bailout:
static u32 bit_func(struct i2c_adapter *adap)
{
+ struct i2c_algo_bit_data *bit_adap = adap->algo_data;
+
return I2C_FUNC_I2C | I2C_FUNC_NOSTART | I2C_FUNC_SMBUS_EMUL |
I2C_FUNC_SMBUS_READ_BLOCK_DATA |
I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
- I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
+ I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING |
+ (bit_adap->getscl ? 0 : I2C_FUNC_NO_CLK_STRETCH);
}
diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h
index b0a7dd6..59e4b43 100644
--- a/include/uapi/linux/i2c.h
+++ b/include/uapi/linux/i2c.h
@@ -88,6 +88,7 @@ struct i2c_msg {
#define I2C_FUNC_SMBUS_PEC 0x00000008
#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
#define I2C_FUNC_SLAVE 0x00000020
+#define I2C_FUNC_NO_CLK_STRETCH 0x00000040 /* No check for SCL low */
#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_QUICK 0x00010000
#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] i2c: added FUNC flag for unsupported clock stretching
2015-08-28 10:43 [PATCH 1/1] i2c: added FUNC flag for unsupported clock stretching Nicola Corna
@ 2015-09-23 9:04 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2015-09-23 9:04 UTC (permalink / raw)
To: Nicola Corna; +Cc: Wolfram Sang, Jonathan Corbet, linux-i2c, linux-doc
On Fri, 28 Aug 2015 12:43:26 +0200, Nicola Corna wrote:
> Added I2C_FUNC_NO_CLK_STRETCH, to be used when clock stretching is not
> supported.
> Added this flag to drivers/i2c/algos/i2c-algo-bit.c when getscl is not
> available.
>
> Signed-off-by: Nicola Corna <nicola@corna.info>
> ---
> Documentation/i2c/functionality | 1 +
> drivers/i2c/algos/i2c-algo-bit.c | 5 ++++-
> include/uapi/linux/i2c.h | 1 +
> 3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/i2c/functionality b/Documentation/i2c/functionality
> index 4aae8ed..f53807e 100644
> --- a/Documentation/i2c/functionality
> +++ b/Documentation/i2c/functionality
> @@ -21,6 +21,7 @@ For the most up-to-date list of functionality constants, please check
> I2C_M_REV_DIR_ADDR and I2C_M_NO_RD_ACK
> flags (which modify the I2C protocol!)
> I2C_FUNC_NOSTART Can skip repeated start sequence
> + I2C_FUNC_NO_CLK_STRETCH Does NOT support clock stretching
> I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command
> I2C_FUNC_SMBUS_READ_BYTE Handles the SMBus read_byte command
> I2C_FUNC_SMBUS_WRITE_BYTE Handles the SMBus write_byte command
> diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
> index 899bede..82cad0b 100644
> --- a/drivers/i2c/algos/i2c-algo-bit.c
> +++ b/drivers/i2c/algos/i2c-algo-bit.c
> @@ -602,10 +602,13 @@ bailout:
>
> static u32 bit_func(struct i2c_adapter *adap)
> {
> + struct i2c_algo_bit_data *bit_adap = adap->algo_data;
> +
> return I2C_FUNC_I2C | I2C_FUNC_NOSTART | I2C_FUNC_SMBUS_EMUL |
> I2C_FUNC_SMBUS_READ_BLOCK_DATA |
> I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
> - I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
> + I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING |
> + (bit_adap->getscl ? 0 : I2C_FUNC_NO_CLK_STRETCH);
> }
>
>
> diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h
> index b0a7dd6..59e4b43 100644
> --- a/include/uapi/linux/i2c.h
> +++ b/include/uapi/linux/i2c.h
> @@ -88,6 +88,7 @@ struct i2c_msg {
> #define I2C_FUNC_SMBUS_PEC 0x00000008
> #define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
> #define I2C_FUNC_SLAVE 0x00000020
> +#define I2C_FUNC_NO_CLK_STRETCH 0x00000040 /* No check for SCL low */
> #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
> #define I2C_FUNC_SMBUS_QUICK 0x00010000
> #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-23 9:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 10:43 [PATCH 1/1] i2c: added FUNC flag for unsupported clock stretching Nicola Corna
2015-09-23 9:04 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).