@@ -92,12 +92,17 @@ static int scmi_protocol_device_request(const struct scmi_device_id *id_table)
phead = head;
}
list_for_each_entry(rdev, head, node) {
+ /*
+ * HACK
+ * We ignore requested duplicates since they could have
+ * been pre-requested...
+ */
if (!strcmp(rdev->id_table->name, id_table->name)) {
- pr_err("Ignoring duplicate request [%d] %s\n",
- rdev->id_table->protocol_id,
- rdev->id_table->name);
- ret = -EINVAL;
- goto out;
+ pr_debug("Device already requested [%d] %s\n",
+ rdev->id_table->protocol_id,
+ rdev->id_table->name);
+ mutex_unlock(&scmi_requested_devices_mtx);
+ return 0;
}
}
}
@@ -274,6 +279,16 @@ static struct scmi_device *scmi_child_dev_find(struct device *parent,
return to_scmi_dev(dev);
}
+static int scmi_dev_uevent(const struct device *dev,
+ struct kobj_uevent_env *env)
+{
+ const struct scmi_device *sdev = to_scmi_dev(dev);
+
+ add_uevent_var(env, "MODALIAS=scmi:pr%02X", sdev->protocol_id);
+
+ return 0;
+}
+
static int scmi_dev_probe(struct device *dev)
{
struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
@@ -297,6 +312,7 @@ static void scmi_dev_remove(struct device *dev)
const struct bus_type scmi_bus_type = {
.name = "scmi_protocol",
.match = scmi_dev_match,
+ .uevent = scmi_dev_uevent,
.probe = scmi_dev_probe,
.remove = scmi_dev_remove,
};
@@ -516,6 +532,23 @@ static void scmi_devices_unregister(void)
bus_for_each_dev(&scmi_bus_type, NULL, NULL, __scmi_devices_unregister);
}
+/* Standard protocols table */
+static const struct scmi_device_id scmi_std_id_table[] = {
+ { SCMI_PROTOCOL_POWER, "genpd" },
+ { SCMI_PROTOCOL_SYSTEM, "syspower" },
+ { SCMI_PROTOCOL_PERF, "perf" },
+ { SCMI_PROTOCOL_PERF, "cpufreq" },
+ { SCMI_PROTOCOL_CLOCK, "clocks" },
+ { SCMI_PROTOCOL_SENSOR, "hwmon" },
+ { SCMI_PROTOCOL_SENSOR, "iiodev" },
+ { SCMI_PROTOCOL_RESET, "reset" },
+ { SCMI_PROTOCOL_VOLTAGE, "regulator" },
+ { SCMI_PROTOCOL_POWERCAP, "powercap" },
+ { SCMI_PROTOCOL_PINCTRL, "pinctrl" },
+ { SCMI_PROTOCOL_PINCTRL, "pinctrl-imx" },
+ { },
+};
+
static int __init scmi_bus_init(void)
{
int retval;
@@ -526,6 +559,15 @@ static int __init scmi_bus_init(void)
pr_info("SCMI protocol bus registered\n");
+ /* HACK pre-request ALL standard protocol devices */
+ retval = scmi_protocol_table_register(scmi_std_id_table);
+ if (retval) {
+ bus_unregister(&scmi_bus_type);
+ return retval;
+ }
+
+ pr_info("SCMI standard protocols devices requested\n");
+
return retval;
}
subsys_initcall(scmi_bus_init);
Emit proper MODALIAS uevents when SCMI devices are created and make sure all the standard protocol devices are requested when the bus is initialized. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- drivers/firmware/arm_scmi/bus.c | 52 +++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-)