From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Wed, 06 May 2015 07:37:59 +0200 Subject: [U-Boot] [PATCH 05/24] dm: i2c: Add a function to find out the chip offset length In-Reply-To: <1430760687-28505-6-git-send-email-sjg@chromium.org> References: <1430760687-28505-2-git-send-email-sjg@chromium.org> <1430760687-28505-6-git-send-email-sjg@chromium.org> Message-ID: <5549A8B7.1060708@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Simon, Am 04.05.2015 19:30, schrieb Simon Glass: > We can currently set this but there is no API function to get it. Add one. > > Signed-off-by: Simon Glass > --- > > drivers/i2c/i2c-uclass.c | 7 +++++++ > include/i2c.h | 9 ++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) Thanks! Acked-by: Heiko Schocher bye, Heiko > > diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c > index f2e95c0..2dfb435 100644 > --- a/drivers/i2c/i2c-uclass.c > +++ b/drivers/i2c/i2c-uclass.c > @@ -396,6 +396,13 @@ int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len) > return 0; > } > > +int i2c_get_chip_offset_len(struct udevice *dev) > +{ > + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); > + > + return chip->offset_len; > +} > + > int i2c_deblock(struct udevice *bus) > { > struct dm_i2c_ops *ops = i2c_get_ops(bus); > diff --git a/include/i2c.h b/include/i2c.h > index 6fd73fa..9a9e4f7 100644 > --- a/include/i2c.h > +++ b/include/i2c.h > @@ -171,8 +171,15 @@ int i2c_get_chip_flags(struct udevice *dev, uint *flagsp); > * > * @offset_len: New offset length value (typically 1 or 2) > */ > - > int i2c_set_chip_offset_len(struct udevice *dev, uint offset_len); > + > +/** > + * i2c_get_offset_len() - get the offset length for a chip > + * > + * @return: Current offset length value (typically 1 or 2) > + */ > +int i2c_get_chip_offset_len(struct udevice *dev); > + > /** > * i2c_deblock() - recover a bus that is in an unknown state > * > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany