2 #define DSS_SUBSYS_NAME "HDMI"
4 #include <linux/kernel.h>
11 int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
12 struct hdmi_phy_data *phy)
14 struct property *prop;
17 prop = of_find_property(ep, "lanes", &len);
21 if (len / sizeof(u32) != ARRAY_SIZE(lanes)) {
22 dev_err(&pdev->dev, "bad number of lanes\n");
26 r = of_property_read_u32_array(ep, "lanes", lanes,
29 dev_err(&pdev->dev, "failed to read lane data\n");
33 r = hdmi_phy_parse_lanes(phy, lanes);
35 dev_err(&pdev->dev, "failed to parse lane data\n");
39 static const u32 default_lanes[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
41 r = hdmi_phy_parse_lanes(phy, default_lanes);
43 dev_err(&pdev->dev, "failed to parse lane data\n");
51 int hdmi_compute_acr(u32 pclk, u32 sample_freq, u32 *n, u32 *cts)
54 bool deep_color_correct = false;
56 if (n == NULL || cts == NULL)
59 /* TODO: When implemented, query deep color mode here. */
63 * When using deep color, the default N value (as in the HDMI
64 * specification) yields to an non-integer CTS. Hence, we
65 * modify it while keeping the restrictions described in
66 * section 7.2.1 of the HDMI 1.4a specification.
68 switch (sample_freq) {
73 if (deep_color == 125)
74 if (pclk == 27027000 || pclk == 74250000)
75 deep_color_correct = true;
76 if (deep_color == 150)
78 deep_color_correct = true;
83 if (deep_color == 125)
85 deep_color_correct = true;
91 if (deep_color_correct) {
92 switch (sample_freq) {
118 switch (sample_freq) {
144 /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */
145 *cts = (pclk/1000) * (*n / 128) * deep_color / (sample_freq / 10);