[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<TYCPR01MB1209313670D2A1C634E7E45CFC2FC2@TYCPR01MB12093.jpnprd01.prod.outlook.com>
Date: Wed, 12 Feb 2025 17:06:52 +0000
From: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Andi Shyti
<andi.shyti@...nel.org>, Wolfram Sang <wsa+renesas@...g-engineering.com>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>, "linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>
CC: Krzysztof Adamski <krzysztof.adamski@...ia.com>, Florian Fainelli
<florian.fainelli@...adcom.com>, Ray Jui <rjui@...adcom.com>, Scott Branden
<sbranden@...adcom.com>, Broadcom internal kernel review list
<bcm-kernel-feedback-list@...adcom.com>, Stefan Roese <sr@...x.de>, Matthias
Brugger <matthias.bgg@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Gregory CLEMENT
<gregory.clement@...tlin.com>
Subject: RE: [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg()
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Sent: 12 February 2025 16:32
> Subject: [PATCH v1 1/8] i2c: Introduce i2c_10bit_addr_from_msg()
>
> There are already a lot of drivers that have been using
> i2c_8bit_addr_from_msg() for 7-bit addresses, now it's time
> to have the similar for 10-bit addresses.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
> ---
> include/linux/i2c.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 997e80649889..4d281ff5582b 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -952,6 +952,16 @@ static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
> return (msg->addr << 1) | (msg->flags & I2C_M_RD);
> }
>
> +static inline u8 i2c_10bit_addr_from_msg(const struct i2c_msg *msg)
> +{
> + /*
> + * 10-bit address
> + * addr_1: 5'b11110 | addr[9:8] | (R/nW)
> + * addr_2: addr[7:0]
> + */
> + return 0xf0 | ((msg->addr & GENMASK(9, 8)) >> 7) | (msg->flags & I2C_M_RD);
> +}
> +
> u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
> void i2c_put_dma_safe_msg_buf(u8 *buf, struct i2c_msg *msg, bool xferred);
>
> --
> 2.45.1.3035.g276e886db78b
Powered by blists - more mailing lists