Commit 998af180 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: ipu-bridge: Add a parse_sensor_fwnode callback to ipu_bridge_init()

Add a parse_sensor_fwnode() callback to ipu_bridge_init(), so that
ipu_bridge_init() can be used with other sensor fwnode parse functions
then just ipu_bridge_parse_ssdb().

This will allow the ipu3-bridge code to also be used by the atomisp
driver.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 1b081a4c
......@@ -148,8 +148,7 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
return orientation;
}
static int ipu_bridge_parse_ssdb(struct acpi_device *adev,
struct ipu_sensor *sensor)
int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor)
{
struct ipu_sensor_ssdb ssdb = {};
int ret;
......@@ -179,6 +178,7 @@ static int ipu_bridge_parse_ssdb(struct acpi_device *adev,
return 0;
}
EXPORT_SYMBOL_NS_GPL(ipu_bridge_parse_ssdb, INTEL_IPU_BRIDGE);
static void ipu_bridge_create_fwnode_properties(
struct ipu_sensor *sensor,
......@@ -343,7 +343,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
sensor = &bridge->sensors[bridge->n_sensors];
ret = ipu_bridge_parse_ssdb(adev, sensor);
ret = bridge->parse_sensor_fwnode(adev, sensor);
if (ret)
goto err_put_adev;
......@@ -441,7 +441,8 @@ static int ipu_bridge_sensors_are_ready(void)
return ready;
}
int ipu_bridge_init(struct device *dev)
int ipu_bridge_init(struct device *dev,
ipu_parse_sensor_fwnode_t parse_sensor_fwnode)
{
struct fwnode_handle *fwnode;
struct ipu_bridge *bridge;
......@@ -459,6 +460,7 @@ int ipu_bridge_init(struct device *dev)
sizeof(bridge->ipu_node_name));
bridge->ipu_hid_node.name = bridge->ipu_node_name;
bridge->dev = dev;
bridge->parse_sensor_fwnode = parse_sensor_fwnode;
ret = software_node_register(&bridge->ipu_hid_node);
if (ret < 0) {
......
......@@ -140,8 +140,12 @@ struct ipu_sensor {
struct software_node_ref_args vcm_ref[1];
};
typedef int (*ipu_parse_sensor_fwnode_t)(struct acpi_device *adev,
struct ipu_sensor *sensor);
struct ipu_bridge {
struct device *dev;
ipu_parse_sensor_fwnode_t parse_sensor_fwnode;
char ipu_node_name[ACPI_ID_LEN];
struct software_node ipu_hid_node;
u32 data_lanes[4];
......@@ -150,9 +154,12 @@ struct ipu_bridge {
};
#if IS_ENABLED(CONFIG_IPU_BRIDGE)
int ipu_bridge_init(struct device *dev);
int ipu_bridge_init(struct device *dev,
ipu_parse_sensor_fwnode_t parse_sensor_fwnode);
int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor);
#else
static inline int ipu_bridge_init(struct device *dev) { return 0; }
/* Use a define to avoid the @parse_sensor_fwnode argument getting evaluated */
#define ipu_bridge_init(dev, parse_sensor_fwnode) (0)
#endif
#endif
......@@ -1725,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
return -EINVAL;
}
r = ipu_bridge_init(dev);
r = ipu_bridge_init(dev, ipu_bridge_parse_ssdb);
if (r)
return r;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment