aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-05-31 10:15:47 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-06-03 04:55:39 -0400
commitbe6dc3291e0fc19e6c8cc8f231968ab9b51f5abf (patch)
treec736506af731c760484cb88388f1e8cb60361811
parent62499330f7bb0904b2d798dbb55e4afe4e7b1541 (diff)
platform/x86: intel_cht_int33fe: Replacing the old connections with references
Replacing the old connection descriptions with software node references. Supplying the USB connector also a reference to the DisplayPort while at it. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/platform/x86/intel_cht_int33fe.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/drivers/platform/x86/intel_cht_int33fe.c b/drivers/platform/x86/intel_cht_int33fe.c
index 9e1848e0343d..4fbdff48a4b5 100644
--- a/drivers/platform/x86/intel_cht_int33fe.c
+++ b/drivers/platform/x86/intel_cht_int33fe.c
@@ -43,13 +43,35 @@ struct cht_int33fe_data {
43 struct i2c_client *max17047; 43 struct i2c_client *max17047;
44 struct i2c_client *fusb302; 44 struct i2c_client *fusb302;
45 struct i2c_client *pi3usb30532; 45 struct i2c_client *pi3usb30532;
46 /* Contain a list-head must be per device */
47 struct device_connection connections[4];
48 46
49 struct fwnode_handle *dp; 47 struct fwnode_handle *dp;
50 struct fwnode_handle *mux; 48 struct fwnode_handle *mux;
51}; 49};
52 50
51static const struct software_node nodes[];
52
53static const struct software_node_ref_args pi3usb30532_ref = {
54 &nodes[INT33FE_NODE_PI3USB30532]
55};
56
57static const struct software_node_ref_args dp_ref = {
58 &nodes[INT33FE_NODE_DISPLAYPORT]
59};
60
61static struct software_node_ref_args mux_ref;
62
63static const struct software_node_reference usb_connector_refs[] = {
64 { "orientation-switch", 1, &pi3usb30532_ref},
65 { "mode-switch", 1, &pi3usb30532_ref},
66 { "displayport", 1, &dp_ref},
67 { }
68};
69
70static const struct software_node_reference fusb302_refs[] = {
71 { "usb-role-switch", 1, &mux_ref},
72 { }
73};
74
53/* 75/*
54 * Grrr I severly dislike buggy BIOS-es. At least one BIOS enumerates 76 * Grrr I severly dislike buggy BIOS-es. At least one BIOS enumerates
55 * the max17047 both through the INT33FE ACPI device (it is right there 77 * the max17047 both through the INT33FE ACPI device (it is right there
@@ -113,12 +135,12 @@ static const struct property_entry usb_connector_props[] = {
113}; 135};
114 136
115static const struct software_node nodes[] = { 137static const struct software_node nodes[] = {
116 { "fusb302", NULL, fusb302_props }, 138 { "fusb302", NULL, fusb302_props, fusb302_refs },
117 { "max17047", NULL, max17047_props }, 139 { "max17047", NULL, max17047_props },
118 { "pi3usb30532" }, 140 { "pi3usb30532" },
119 { "displayport" }, 141 { "displayport" },
120 { "usb-role-switch" }, 142 { "usb-role-switch" },
121 { "connector", &nodes[0], usb_connector_props }, 143 { "connector", &nodes[0], usb_connector_props, usb_connector_refs },
122 { } 144 { }
123}; 145};
124 146
@@ -152,6 +174,7 @@ static int cht_int33fe_setup_mux(struct cht_int33fe_data *data)
152 174
153 data->mux = fwnode_handle_get(dev->fwnode); 175 data->mux = fwnode_handle_get(dev->fwnode);
154 put_device(dev); 176 put_device(dev);
177 mux_ref.node = to_software_node(data->mux);
155 178
156 return 0; 179 return 0;
157} 180}
@@ -190,6 +213,7 @@ static void cht_int33fe_remove_nodes(struct cht_int33fe_data *data)
190 213
191 if (data->mux) { 214 if (data->mux) {
192 fwnode_handle_put(data->mux); 215 fwnode_handle_put(data->mux);
216 mux_ref.node = NULL;
193 data->mux = NULL; 217 data->mux = NULL;
194 } 218 }
195 219
@@ -343,18 +367,6 @@ static int cht_int33fe_probe(struct platform_device *pdev)
343 if (ret) 367 if (ret)
344 goto out_remove_nodes; 368 goto out_remove_nodes;
345 369
346 data->connections[0].endpoint[0] = "port0";
347 data->connections[0].endpoint[1] = "i2c-pi3usb30532-switch";
348 data->connections[0].id = "orientation-switch";
349 data->connections[1].endpoint[0] = "port0";
350 data->connections[1].endpoint[1] = "i2c-pi3usb30532-mux";
351 data->connections[1].id = "mode-switch";
352 data->connections[2].endpoint[0] = "i2c-fusb302";
353 data->connections[2].endpoint[1] = "intel_xhci_usb_sw-role-switch";
354 data->connections[2].id = "usb-role-switch";
355
356 device_connections_add(data->connections);
357
358 fwnode = software_node_fwnode(&nodes[INT33FE_NODE_FUSB302]); 370 fwnode = software_node_fwnode(&nodes[INT33FE_NODE_FUSB302]);
359 if (!fwnode) { 371 if (!fwnode) {
360 ret = -ENODEV; 372 ret = -ENODEV;
@@ -400,8 +412,6 @@ out_unregister_fusb302:
400out_unregister_max17047: 412out_unregister_max17047:
401 i2c_unregister_device(data->max17047); 413 i2c_unregister_device(data->max17047);
402 414
403 device_connections_remove(data->connections);
404
405out_remove_nodes: 415out_remove_nodes:
406 cht_int33fe_remove_nodes(data); 416 cht_int33fe_remove_nodes(data);
407 417
@@ -416,7 +426,6 @@ static int cht_int33fe_remove(struct platform_device *pdev)
416 i2c_unregister_device(data->fusb302); 426 i2c_unregister_device(data->fusb302);
417 i2c_unregister_device(data->max17047); 427 i2c_unregister_device(data->max17047);
418 428
419 device_connections_remove(data->connections);
420 cht_int33fe_remove_nodes(data); 429 cht_int33fe_remove_nodes(data);
421 430
422 return 0; 431 return 0;