aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core-of.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-05i2c: of: Try to find an I2C adapter matching the parentThierry Reding1-1/+13
If an I2C adapter doesn't match the provided device tree node, also try matching the parent's device tree node. This allows finding an adapter based on the device node of the parent device that was used to register it. This fixes a regression on Tegra124-based Chromebooks (Nyan) where the eDP controller registers an I2C adapter that is used to read to EDID. After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt suffix") this stopped working because the I2C adapter could no longer be found. The approach in this patch fixes the regression without introducing the issues that the above commit solved. Fixes: 17ab7806de0c ("drm: don't link DP aux i2c adapter to the hardware device node") Signed-off-by: Thierry Reding <treding@nvidia.com> Tested-by: Tristan Bastian <tristan-c.bastian@gmx.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-05-22i2c: Export of_i2c_get_board_info()Boris Brezillon1-17/+31
I3C busses have to know about all I2C devices connected on the I3C bus to properly initialize the I3C master, and I2C frames can't be sent on the bus until this initialization is done. We can't let the I2C core parse the DT and instantiate I2C devices as part of its i2c_add_adapter() procedure because, when done this way, I2C devices are directly registered to the device-model and might be attached to drivers which could in turn start sending frames on the bus, which won't work since, as said above, the bus is not yet initialized. Export of_i2c_register_device() in order to let the I3C core parse the I2C device nodes by itself and initialize the bus. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-05-22i2c: Retain info->of_node in i2c_new_device()Boris Brezillon1-2/+1
Currently, of_i2c_register_devices() is responsible for retaining info->of_node, but we're about to expose a function to parse I2C board info without registering the I2C device. We could possibly let this function retain ->of_node, but this approach is prone to reference leak since people will have to remember to call of_node_put() if something goes wrong between the OF node parsing and the registration step. Let's just retain the ->of_node in i2c_new_register() instead. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-05-15i2c: Get rid of i2c_board_info->archdataBoris Brezillon1-2/+0
The only user of i2c_board_info->archdata is the OF parsing code and it just pass a zero-initialized object which has the same effect as leaving ->archdata to NULL since the client object is allocated with kzalloc(). Get rid of this useless field. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-02-26i2c: of: simplify reading the "reg" propertyWolfram Sang1-7/+5
of_get_property() is a bit cumbersome to use. Replace it with the newer of_property_read_u32() for more readable code. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-02-26i2c: of: remove duplicated check for valid addressWolfram Sang1-6/+0
The very same check is done when calling i2c_new_device(). Remove it here to avoid code duplication. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-02-26i2c: of: rename variable to meet expectationsWolfram Sang1-4/+4
'result' is mostly used in the kernel as int for functions returning errno on failure. Here it is a pointer to the client struct, so let's call it this way (as the parent function does, too). Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-02-26i2c: of: make ref counting more visibleWolfram Sang1-1/+1
When debugging a ref counting problem, I overlooked this snipplet a few times. Might be taste, but I think the new location is visually easier recognizable. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2018-02-26i2c: of: change log level of failed device creationWolfram Sang1-1/+1
If we cannot create a device, this is an error, not a warning. Fix the log level. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-07-31i2c: Convert to using %pOF instead of full_nameRob Herring1-13/+11
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-05-31i2c: break out OF support into separate fileWolfram Sang1-0/+276
Also removes some ifdeffery. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>