Skip to content

Commit e1af6f0

Browse files
Pratap Nirujogiij-intel
authored andcommitted
platform/x86: Update swnode graph for amd isp4
Existing swnode graph format is specific to sensor device and is causing conflicts when accessing standard property variables outside the sensor driver. To address this issue, enhanced swnode graph format with dedicated nodes for i2c and isp devices, with sensor node added as child to i2c node. This approach allows to have standard property variables (ex: 'clock-frequency') with values applicable for each of the devices (sensor, i2c and isp). ACPI device driver_data handle is also initialized with root camera swnode to access the property variables in the graph in isp and i2c drivers. Signed-off-by: Pratap Nirujogi <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent eb617dd commit e1af6f0

File tree

1 file changed

+144
-37
lines changed

1 file changed

+144
-37
lines changed

drivers/platform/x86/amd/amd_isp4.c

Lines changed: 144 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#define AMDISP_OV05C10_REMOTE_EP_NAME "ov05c10_isp_4_1_1"
2121
#define AMD_ISP_PLAT_DRV_NAME "amd-isp4"
2222

23+
static const struct software_node isp4_mipi1_endpoint_node;
24+
static const struct software_node ov05c10_endpoint_node;
25+
2326
/*
2427
* AMD ISP platform info definition to initialize sensor
2528
* specific platform configuration to prepare the amdisp
@@ -42,55 +45,116 @@ struct amdisp_platform {
4245
struct mutex lock; /* protects i2c client creation */
4346
};
4447

45-
/* Top-level OV05C10 camera node property table */
48+
/* Root AMD CAMERA SWNODE */
49+
50+
/* Root amd camera node definition */
51+
static const struct software_node amd_camera_node = {
52+
.name = "amd_camera",
53+
};
54+
55+
/* ISP4 SWNODE */
56+
57+
/* ISP4 OV05C10 camera node definition */
58+
static const struct software_node isp4_node = {
59+
.name = "isp4",
60+
.parent = &amd_camera_node,
61+
};
62+
63+
/*
64+
* ISP4 Ports node definition. No properties defined for
65+
* ports node.
66+
*/
67+
static const struct software_node isp4_ports = {
68+
.name = "ports",
69+
.parent = &isp4_node,
70+
};
71+
72+
/*
73+
* ISP4 Port node definition. No properties defined for
74+
* port node.
75+
*/
76+
static const struct software_node isp4_port_node = {
77+
.name = "port@0",
78+
.parent = &isp4_ports,
79+
};
80+
81+
/*
82+
* ISP4 MIPI1 remote endpoint points to OV05C10 endpoint
83+
* node.
84+
*/
85+
static const struct software_node_ref_args isp4_refs[] = {
86+
SOFTWARE_NODE_REFERENCE(&ov05c10_endpoint_node),
87+
};
88+
89+
/* ISP4 MIPI1 endpoint node properties table */
90+
static const struct property_entry isp4_mipi1_endpoint_props[] = {
91+
PROPERTY_ENTRY_REF_ARRAY("remote-endpoint", isp4_refs),
92+
{ }
93+
};
94+
95+
/* ISP4 MIPI1 endpoint node definition */
96+
static const struct software_node isp4_mipi1_endpoint_node = {
97+
.name = "endpoint",
98+
.parent = &isp4_port_node,
99+
.properties = isp4_mipi1_endpoint_props,
100+
};
101+
102+
/* I2C1 SWNODE */
103+
104+
/* I2C1 camera node property table */
105+
static const struct property_entry i2c1_camera_props[] = {
106+
PROPERTY_ENTRY_U32("clock-frequency", 1 * HZ_PER_MHZ),
107+
{ }
108+
};
109+
110+
/* I2C1 camera node definition */
111+
static const struct software_node i2c1_node = {
112+
.name = "i2c1",
113+
.parent = &amd_camera_node,
114+
.properties = i2c1_camera_props,
115+
};
116+
117+
/* I2C1 camera node property table */
46118
static const struct property_entry ov05c10_camera_props[] = {
47119
PROPERTY_ENTRY_U32("clock-frequency", 24 * HZ_PER_MHZ),
48120
{ }
49121
};
50122

51-
/* Root AMD ISP OV05C10 camera node definition */
52-
static const struct software_node camera_node = {
123+
/* OV05C10 camera node definition */
124+
static const struct software_node ov05c10_camera_node = {
53125
.name = AMDISP_OV05C10_HID,
126+
.parent = &i2c1_node,
54127
.properties = ov05c10_camera_props,
55128
};
56129

57130
/*
58-
* AMD ISP OV05C10 Ports node definition. No properties defined for
131+
* OV05C10 Ports node definition. No properties defined for
59132
* ports node for OV05C10.
60133
*/
61-
static const struct software_node ports = {
134+
static const struct software_node ov05c10_ports = {
62135
.name = "ports",
63-
.parent = &camera_node,
64-
};
65-
66-
/*
67-
* AMD ISP OV05C10 Port node definition. No properties defined for
68-
* port node for OV05C10.
69-
*/
70-
static const struct software_node port_node = {
71-
.name = "port@",
72-
.parent = &ports,
136+
.parent = &ov05c10_camera_node,
73137
};
74138

75139
/*
76-
* Remote endpoint AMD ISP node definition. No properties defined for
77-
* remote endpoint node for OV05C10.
140+
* OV05C10 Port node definition.
78141
*/
79-
static const struct software_node remote_ep_isp_node = {
80-
.name = AMDISP_OV05C10_REMOTE_EP_NAME,
142+
static const struct software_node ov05c10_port_node = {
143+
.name = "port@0",
144+
.parent = &ov05c10_ports,
81145
};
82146

83147
/*
84-
* Remote endpoint reference for isp node included in the
85-
* OV05C10 endpoint.
148+
* OV05C10 remote endpoint points to ISP4 MIPI1 endpoint
149+
* node.
86150
*/
87151
static const struct software_node_ref_args ov05c10_refs[] = {
88-
SOFTWARE_NODE_REFERENCE(&remote_ep_isp_node),
152+
SOFTWARE_NODE_REFERENCE(&isp4_mipi1_endpoint_node),
89153
};
90154

91155
/* OV05C10 supports one single link frequency */
92156
static const u64 ov05c10_link_freqs[] = {
93-
925 * HZ_PER_MHZ,
157+
900 * HZ_PER_MHZ,
94158
};
95159

96160
/* OV05C10 supports only 2-lane configuration */
@@ -110,27 +174,64 @@ static const struct property_entry ov05c10_endpoint_props[] = {
110174
{ }
111175
};
112176

113-
/* AMD ISP endpoint node definition */
114-
static const struct software_node endpoint_node = {
177+
/* OV05C10 endpoint node definition */
178+
static const struct software_node ov05c10_endpoint_node = {
115179
.name = "endpoint",
116-
.parent = &port_node,
180+
.parent = &ov05c10_port_node,
117181
.properties = ov05c10_endpoint_props,
118182
};
119183

120184
/*
121-
* AMD ISP swnode graph uses 5 nodes and also its relationship is
122-
* fixed to align with the structure that v4l2 expects for successful
123-
* endpoint fwnode parsing.
185+
* AMD Camera swnode graph uses 10 nodes and also its relationship is
186+
* fixed to align with the structure that v4l2 and i2c frameworks expects
187+
* for successful parsing of fwnodes and its properties with standard names.
124188
*
125189
* It is only the node property_entries that will vary for each platform
126190
* supporting different sensor modules.
191+
*
192+
* AMD ISP4 SWNODE GRAPH Structure
193+
*
194+
* amd_camera {
195+
* isp4 {
196+
* ports {
197+
* port@0 {
198+
* isp4_mipi1_ep: endpoint {
199+
* remote-endpoint = &OMNI5C10_ep;
200+
* };
201+
* };
202+
* };
203+
* };
204+
*
205+
* i2c1 {
206+
* clock-frequency = 1 MHz;
207+
* OMNI5C10 {
208+
* clock-frequency = 24MHz;
209+
* ports {
210+
* port@0 {
211+
* OMNI5C10_ep: endpoint {
212+
* bus-type = 4;
213+
* data-lanes = <1 2>;
214+
* link-frequencies = 900MHz;
215+
* remote-endpoint = &isp4_mipi1;
216+
* };
217+
* };
218+
* };
219+
* };
220+
* };
221+
* };
222+
*
127223
*/
128-
static const struct software_node *ov05c10_nodes[] = {
129-
&camera_node,
130-
&ports,
131-
&port_node,
132-
&endpoint_node,
133-
&remote_ep_isp_node,
224+
static const struct software_node *amd_isp4_nodes[] = {
225+
&amd_camera_node,
226+
&isp4_node,
227+
&isp4_ports,
228+
&isp4_port_node,
229+
&isp4_mipi1_endpoint_node,
230+
&i2c1_node,
231+
&ov05c10_camera_node,
232+
&ov05c10_ports,
233+
&ov05c10_port_node,
234+
&ov05c10_endpoint_node,
134235
NULL
135236
};
136237

@@ -140,7 +241,7 @@ static const struct amdisp_platform_info ov05c10_platform_config = {
140241
.dev_name = "ov05c10",
141242
I2C_BOARD_INFO("ov05c10", AMDISP_OV05C10_I2C_ADDR),
142243
},
143-
.swnodes = ov05c10_nodes,
244+
.swnodes = amd_isp4_nodes,
144245
};
145246

146247
static const struct acpi_device_id amdisp_sensor_ids[] = {
@@ -232,7 +333,8 @@ static struct amdisp_platform *prepare_amdisp_platform(struct device *dev,
232333
if (ret)
233334
return ERR_PTR(ret);
234335

235-
isp4_platform->board_info.swnode = src->swnodes[0];
336+
/* initialize ov05c10_camera_node */
337+
isp4_platform->board_info.swnode = src->swnodes[6];
236338

237339
return isp4_platform;
238340
}
@@ -257,6 +359,7 @@ static int amd_isp_probe(struct platform_device *pdev)
257359
{
258360
const struct amdisp_platform_info *pinfo;
259361
struct amdisp_platform *isp4_platform;
362+
struct acpi_device *adev;
260363
int ret;
261364

262365
pinfo = device_get_match_data(&pdev->dev);
@@ -274,6 +377,10 @@ static int amd_isp_probe(struct platform_device *pdev)
274377
if (ret)
275378
goto error_unregister_sw_node;
276379

380+
adev = ACPI_COMPANION(&pdev->dev);
381+
/* initialize root amd_camera_node */
382+
adev->driver_data = (void *)pinfo->swnodes[0];
383+
277384
/* check if adapter is already registered and create i2c client instance */
278385
i2c_for_each_dev(isp4_platform, try_to_instantiate_i2c_client);
279386

0 commit comments

Comments
 (0)