Lines Matching +full:mipi +full:- +full:mode
1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2015-17 Intel Corporation.
5 * MIPI Discovery And Configuration (DisCo) Specification for SoundWire
27 * sdw_master_read_prop() - Read Master properties
32 struct sdw_master_prop *prop = &bus->prop; in sdw_master_read_prop()
37 device_property_read_u32(bus->dev, in sdw_master_read_prop()
38 "mipi-sdw-sw-interface-revision", in sdw_master_read_prop()
39 &prop->revision); in sdw_master_read_prop()
43 "mipi-sdw-link-%d-subproperties", bus->link_id); in sdw_master_read_prop()
45 link = device_get_named_child_node(bus->dev, name); in sdw_master_read_prop()
47 dev_err(bus->dev, "Master node %s not found\n", name); in sdw_master_read_prop()
48 return -EIO; in sdw_master_read_prop()
52 "mipi-sdw-clock-stop-mode0-supported")) in sdw_master_read_prop()
53 prop->clk_stop_modes |= BIT(SDW_CLK_STOP_MODE0); in sdw_master_read_prop()
56 "mipi-sdw-clock-stop-mode1-supported")) in sdw_master_read_prop()
57 prop->clk_stop_modes |= BIT(SDW_CLK_STOP_MODE1); in sdw_master_read_prop()
60 "mipi-sdw-max-clock-frequency", in sdw_master_read_prop()
61 &prop->max_clk_freq); in sdw_master_read_prop()
63 nval = fwnode_property_count_u32(link, "mipi-sdw-clock-frequencies-supported"); in sdw_master_read_prop()
65 prop->num_clk_freq = nval; in sdw_master_read_prop()
66 prop->clk_freq = devm_kcalloc(bus->dev, prop->num_clk_freq, in sdw_master_read_prop()
67 sizeof(*prop->clk_freq), in sdw_master_read_prop()
69 if (!prop->clk_freq) in sdw_master_read_prop()
70 return -ENOMEM; in sdw_master_read_prop()
73 "mipi-sdw-clock-frequencies-supported", in sdw_master_read_prop()
74 prop->clk_freq, prop->num_clk_freq); in sdw_master_read_prop()
81 if (!prop->max_clk_freq && prop->clk_freq) { in sdw_master_read_prop()
82 prop->max_clk_freq = prop->clk_freq[0]; in sdw_master_read_prop()
83 for (i = 1; i < prop->num_clk_freq; i++) { in sdw_master_read_prop()
84 if (prop->clk_freq[i] > prop->max_clk_freq) in sdw_master_read_prop()
85 prop->max_clk_freq = prop->clk_freq[i]; in sdw_master_read_prop()
89 nval = fwnode_property_count_u32(link, "mipi-sdw-supported-clock-gears"); in sdw_master_read_prop()
91 prop->num_clk_gears = nval; in sdw_master_read_prop()
92 prop->clk_gears = devm_kcalloc(bus->dev, prop->num_clk_gears, in sdw_master_read_prop()
93 sizeof(*prop->clk_gears), in sdw_master_read_prop()
95 if (!prop->clk_gears) in sdw_master_read_prop()
96 return -ENOMEM; in sdw_master_read_prop()
99 "mipi-sdw-supported-clock-gears", in sdw_master_read_prop()
100 prop->clk_gears, in sdw_master_read_prop()
101 prop->num_clk_gears); in sdw_master_read_prop()
104 fwnode_property_read_u32(link, "mipi-sdw-default-frame-rate", in sdw_master_read_prop()
105 &prop->default_frame_rate); in sdw_master_read_prop()
107 fwnode_property_read_u32(link, "mipi-sdw-default-frame-row-size", in sdw_master_read_prop()
108 &prop->default_row); in sdw_master_read_prop()
110 fwnode_property_read_u32(link, "mipi-sdw-default-frame-col-size", in sdw_master_read_prop()
111 &prop->default_col); in sdw_master_read_prop()
113 prop->dynamic_frame = fwnode_property_read_bool(link, in sdw_master_read_prop()
114 "mipi-sdw-dynamic-frame-shape"); in sdw_master_read_prop()
116 fwnode_property_read_u32(link, "mipi-sdw-command-error-threshold", in sdw_master_read_prop()
117 &prop->err_threshold); in sdw_master_read_prop()
129 fwnode_property_read_u32(port, "mipi-sdw-port-max-wordlength", in sdw_slave_read_dp0()
130 &dp0->max_word); in sdw_slave_read_dp0()
132 fwnode_property_read_u32(port, "mipi-sdw-port-min-wordlength", in sdw_slave_read_dp0()
133 &dp0->min_word); in sdw_slave_read_dp0()
135 nval = fwnode_property_count_u32(port, "mipi-sdw-port-wordlength-configs"); in sdw_slave_read_dp0()
138 dp0->num_words = nval; in sdw_slave_read_dp0()
139 dp0->words = devm_kcalloc(&slave->dev, in sdw_slave_read_dp0()
140 dp0->num_words, sizeof(*dp0->words), in sdw_slave_read_dp0()
142 if (!dp0->words) in sdw_slave_read_dp0()
143 return -ENOMEM; in sdw_slave_read_dp0()
146 "mipi-sdw-port-wordlength-configs", in sdw_slave_read_dp0()
147 dp0->words, dp0->num_words); in sdw_slave_read_dp0()
150 dp0->BRA_flow_controlled = fwnode_property_read_bool(port, in sdw_slave_read_dp0()
151 "mipi-sdw-bra-flow-controlled"); in sdw_slave_read_dp0()
153 dp0->simple_ch_prep_sm = fwnode_property_read_bool(port, in sdw_slave_read_dp0()
154 "mipi-sdw-simplified-channel-prepare-sm"); in sdw_slave_read_dp0()
156 dp0->imp_def_interrupts = fwnode_property_read_bool(port, in sdw_slave_read_dp0()
157 "mipi-sdw-imp-def-dp0-interrupts-supported"); in sdw_slave_read_dp0()
178 "mipi-sdw-dp-%d-%s-subproperties", bit, type); in sdw_slave_read_dpn()
182 node = device_get_named_child_node(&slave->dev, name); in sdw_slave_read_dpn()
184 dev_err(&slave->dev, "%s dpN not found\n", name); in sdw_slave_read_dpn()
185 return -EIO; in sdw_slave_read_dpn()
188 fwnode_property_read_u32(node, "mipi-sdw-port-max-wordlength", in sdw_slave_read_dpn()
190 fwnode_property_read_u32(node, "mipi-sdw-port-min-wordlength", in sdw_slave_read_dpn()
193 nval = fwnode_property_count_u32(node, "mipi-sdw-port-wordlength-configs"); in sdw_slave_read_dpn()
196 dpn[i].words = devm_kcalloc(&slave->dev, in sdw_slave_read_dpn()
201 return -ENOMEM; in sdw_slave_read_dpn()
204 "mipi-sdw-port-wordlength-configs", in sdw_slave_read_dpn()
208 fwnode_property_read_u32(node, "mipi-sdw-data-port-type", in sdw_slave_read_dpn()
212 "mipi-sdw-max-grouping-supported", in sdw_slave_read_dpn()
216 "mipi-sdw-simplified-channelprepare-sm"); in sdw_slave_read_dpn()
219 "mipi-sdw-port-channelprepare-timeout", in sdw_slave_read_dpn()
223 "mipi-sdw-imp-def-dpn-interrupts-supported", in sdw_slave_read_dpn()
226 fwnode_property_read_u32(node, "mipi-sdw-min-channel-number", in sdw_slave_read_dpn()
229 fwnode_property_read_u32(node, "mipi-sdw-max-channel-number", in sdw_slave_read_dpn()
232 nval = fwnode_property_count_u32(node, "mipi-sdw-channel-number-list"); in sdw_slave_read_dpn()
235 dpn[i].channels = devm_kcalloc(&slave->dev, in sdw_slave_read_dpn()
240 return -ENOMEM; in sdw_slave_read_dpn()
243 "mipi-sdw-channel-number-list", in sdw_slave_read_dpn()
247 nval = fwnode_property_count_u32(node, "mipi-sdw-channel-combination-list"); in sdw_slave_read_dpn()
250 dpn[i].ch_combinations = devm_kcalloc(&slave->dev, in sdw_slave_read_dpn()
255 return -ENOMEM; in sdw_slave_read_dpn()
258 "mipi-sdw-channel-combination-list", in sdw_slave_read_dpn()
264 "mipi-sdw-modes-supported", &dpn[i].modes); in sdw_slave_read_dpn()
266 fwnode_property_read_u32(node, "mipi-sdw-max-async-buffer", in sdw_slave_read_dpn()
270 "mipi-sdw-block-packing-mode"); in sdw_slave_read_dpn()
272 fwnode_property_read_u32(node, "mipi-sdw-port-encoding-type", in sdw_slave_read_dpn()
275 /* TODO: Read audio mode */ in sdw_slave_read_dpn()
284 * sdw_slave_read_prop() - Read Slave properties
289 struct sdw_slave_prop *prop = &slave->prop; in sdw_slave_read_prop()
290 struct device *dev = &slave->dev; in sdw_slave_read_prop()
294 device_property_read_u32(dev, "mipi-sdw-sw-interface-revision", in sdw_slave_read_prop()
295 &prop->mipi_revision); in sdw_slave_read_prop()
297 prop->wake_capable = device_property_read_bool(dev, in sdw_slave_read_prop()
298 "mipi-sdw-wake-up-unavailable"); in sdw_slave_read_prop()
299 prop->wake_capable = !prop->wake_capable; in sdw_slave_read_prop()
301 prop->test_mode_capable = device_property_read_bool(dev, in sdw_slave_read_prop()
302 "mipi-sdw-test-mode-supported"); in sdw_slave_read_prop()
304 prop->clk_stop_mode1 = false; in sdw_slave_read_prop()
306 "mipi-sdw-clock-stop-mode1-supported")) in sdw_slave_read_prop()
307 prop->clk_stop_mode1 = true; in sdw_slave_read_prop()
309 prop->simple_clk_stop_capable = device_property_read_bool(dev, in sdw_slave_read_prop()
310 "mipi-sdw-simplified-clockstopprepare-sm-supported"); in sdw_slave_read_prop()
312 device_property_read_u32(dev, "mipi-sdw-clockstopprepare-timeout", in sdw_slave_read_prop()
313 &prop->clk_stop_timeout); in sdw_slave_read_prop()
315 device_property_read_u32(dev, "mipi-sdw-slave-channelprepare-timeout", in sdw_slave_read_prop()
316 &prop->ch_prep_timeout); in sdw_slave_read_prop()
319 "mipi-sdw-clockstopprepare-hard-reset-behavior", in sdw_slave_read_prop()
320 &prop->reset_behave); in sdw_slave_read_prop()
322 prop->high_PHY_capable = device_property_read_bool(dev, in sdw_slave_read_prop()
323 "mipi-sdw-highPHY-capable"); in sdw_slave_read_prop()
325 prop->paging_support = device_property_read_bool(dev, in sdw_slave_read_prop()
326 "mipi-sdw-paging-support"); in sdw_slave_read_prop()
328 prop->bank_delay_support = device_property_read_bool(dev, in sdw_slave_read_prop()
329 "mipi-sdw-bank-delay-support"); in sdw_slave_read_prop()
332 "mipi-sdw-port15-read-behavior", &prop->p15_behave); in sdw_slave_read_prop()
334 device_property_read_u32(dev, "mipi-sdw-master-count", in sdw_slave_read_prop()
335 &prop->master_count); in sdw_slave_read_prop()
337 device_property_read_u32(dev, "mipi-sdw-source-port-list", in sdw_slave_read_prop()
338 &prop->source_ports); in sdw_slave_read_prop()
340 device_property_read_u32(dev, "mipi-sdw-sink-port-list", in sdw_slave_read_prop()
341 &prop->sink_ports); in sdw_slave_read_prop()
344 port = device_get_named_child_node(dev, "mipi-sdw-dp-0-subproperties"); in sdw_slave_read_prop()
348 prop->dp0_prop = devm_kzalloc(&slave->dev, in sdw_slave_read_prop()
349 sizeof(*prop->dp0_prop), in sdw_slave_read_prop()
351 if (!prop->dp0_prop) in sdw_slave_read_prop()
352 return -ENOMEM; in sdw_slave_read_prop()
354 sdw_slave_read_dp0(slave, port, prop->dp0_prop); in sdw_slave_read_prop()
363 nval = hweight32(prop->source_ports); in sdw_slave_read_prop()
364 prop->src_dpn_prop = devm_kcalloc(&slave->dev, nval, in sdw_slave_read_prop()
365 sizeof(*prop->src_dpn_prop), in sdw_slave_read_prop()
367 if (!prop->src_dpn_prop) in sdw_slave_read_prop()
368 return -ENOMEM; in sdw_slave_read_prop()
371 sdw_slave_read_dpn(slave, prop->src_dpn_prop, nval, in sdw_slave_read_prop()
372 prop->source_ports, "source"); in sdw_slave_read_prop()
374 nval = hweight32(prop->sink_ports); in sdw_slave_read_prop()
375 prop->sink_dpn_prop = devm_kcalloc(&slave->dev, nval, in sdw_slave_read_prop()
376 sizeof(*prop->sink_dpn_prop), in sdw_slave_read_prop()
378 if (!prop->sink_dpn_prop) in sdw_slave_read_prop()
379 return -ENOMEM; in sdw_slave_read_prop()
382 sdw_slave_read_dpn(slave, prop->sink_dpn_prop, nval, in sdw_slave_read_prop()
383 prop->sink_ports, "sink"); in sdw_slave_read_prop()