drivers: base: Unified device connection lookup

Several frameworks - clk, gpio, phy, pmw, etc. - maintain
lookup tables for describing connections and provide custom
API for handling them. This introduces a single generic
lookup table and API for the connections.

The motivation for this commit is centralizing the
connection lookup, but the goal is to ultimately extract the
connection descriptions also from firmware by using the
fwnode_graph_* functions and other mechanisms that are
available.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Heikki Krogerus
2018-03-20 15:57:02 +03:00
committed by Greg Kroah-Hartman
parent 2699126bcf
commit f2d9b66d84
4 changed files with 203 additions and 1 deletions

View File

@@ -729,6 +729,28 @@ struct device_dma_parameters {
unsigned long segment_boundary_mask;
};
/**
* struct device_connection - Device Connection Descriptor
* @endpoint: The names of the two devices connected together
* @id: Unique identifier for the connection
* @list: List head, private, for internal use only
*/
struct device_connection {
const char *endpoint[2];
const char *id;
struct list_head list;
};
void *device_connection_find_match(struct device *dev, const char *con_id,
void *data,
void *(*match)(struct device_connection *con,
int ep, void *data));
struct device *device_connection_find(struct device *dev, const char *con_id);
void device_connection_add(struct device_connection *con);
void device_connection_remove(struct device_connection *con);
/**
* enum device_link_state - Device link states.
* @DL_STATE_NONE: The presence of the drivers is not being tracked.