[RFC 3/8] phy: Add PHY standard HDMI opts to the PHY API

From: Nelson Costa
Date: Wed Apr 28 2021 - 11:25:53 EST


This adds the new options to give support for HDMI
PHYs in a standard way. This is mainly useful when
the HDMI PHY requires parameters to be passed by
"phy_configure" function.

For this, the new struct phy_configure_opts_hdmi
was added with the required generic and standard
parameters.

Signed-off-by: Nelson Costa <nelson.costa@xxxxxxxxxxxx>
---
include/linux/phy/phy-hdmi.h | 102 +++++++++++++++++++++++++++++++++++++++++++
include/linux/phy/phy.h | 7 ++-
2 files changed, 108 insertions(+), 1 deletion(-)
create mode 100644 include/linux/phy/phy-hdmi.h

diff --git a/include/linux/phy/phy-hdmi.h b/include/linux/phy/phy-hdmi.h
new file mode 100644
index 0000000..62334f4
--- /dev/null
+++ b/include/linux/phy/phy-hdmi.h
@@ -0,0 +1,102 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2021 - present Synopsys, Inc. and/or its affiliates.
+ * HDMI generic PHY options.
+ *
+ * Author: Nelson Costa <nelson.costa@xxxxxxxxxxxx>
+ */
+#ifndef __PHY_HDMI_H_
+#define __PHY_HDMI_H_
+
+#include <linux/types.h>
+
+/**
+ * struct phy_configure_opts_hdmi - HDMI PHY configuration set
+ *
+ * This structure is used to represent the configuration state of an
+ * HDMI PHY.
+ */
+struct phy_configure_opts_hdmi {
+ /**
+ * @color_depth:
+ *
+ * Color depth, as specified by HDMI specification, represents the
+ * number of bits per pixel.
+ *
+ * Allowed values: 24, 30, 36, 48
+ *
+ */
+ u8 color_depth;
+
+ /**
+ * @tmds_bit_clock_ratio:
+ *
+ * Flag indicating, as specified by HDMI specification, the relation
+ * between TMDS Clock Rate and TMDS Character Rate.
+ *
+ * As specified by HDMI specification:
+ *
+ * tmds_bit_clock_ratio = 0, for TMDS Character Rates <= 340 Mcsc
+ * (TMDS Clock Rate = TMDS Character Rate)
+ *
+ * tmds_bit_clock_ratio = 1, for TMDS Character Rates > 340 Mcsc
+ * (TMDS Clock Rate = TMDS Character Rate / 4)
+ *
+ */
+ u8 tmds_bit_clock_ratio;
+
+ /**
+ * @scrambling:
+ *
+ * Scrambling, as specified by HDMI specification, enables the technique
+ * to reduce the EMI/RFI.
+ *
+ */
+ u8 scrambling;
+
+ /**
+ * @calibration_acq:
+ *
+ * Calibration acquisitions number for the calibration algorithm.
+ *
+ */
+ unsigned int calibration_acq;
+
+ /**
+ * @calibration_force:
+ *
+ * Flag indicating, to force calibration algorithm even if the MPLL
+ * status didn't change from previous run calibration.
+ *
+ */
+ u8 calibration_force;
+
+ /**
+ * @set_color_depth:
+ *
+ * Flag indicating, whether or not reconfigure deep_color
+ * to requested values.
+ *
+ */
+ u8 set_color_depth : 1;
+
+ /**
+ * @set_tmds_bit_clock_ratio:
+ *
+ * Flag indicating, whether or not reconfigure tmds_bit_clock_ratio
+ * to requested values.
+ *
+ */
+ u8 set_tmds_bit_clock_ratio : 1;
+
+ /**
+ * @set_scrambling:
+ *
+ * Flag indicating, whether or not reconfigure scrambling
+ * to requested values.
+ *
+ */
+ u8 set_scrambling : 1;
+};
+
+#endif /* __PHY_HDMI_H_ */
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index e435bdb..8b1aaa4 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -18,6 +18,7 @@

#include <linux/phy/phy-dp.h>
#include <linux/phy/phy-mipi-dphy.h>
+#include <linux/phy/phy-hdmi.h>

struct phy;

@@ -41,7 +42,8 @@ enum phy_mode {
PHY_MODE_MIPI_DPHY,
PHY_MODE_SATA,
PHY_MODE_LVDS,
- PHY_MODE_DP
+ PHY_MODE_DP,
+ PHY_MODE_HDMI
};

/**
@@ -51,10 +53,13 @@ enum phy_mode {
* the MIPI_DPHY phy mode.
* @dp: Configuration set applicable for phys supporting
* the DisplayPort protocol.
+ * @hdmi Configuration set applicable for phys supporting
+ * the HDMI protocol.
*/
union phy_configure_opts {
struct phy_configure_opts_mipi_dphy mipi_dphy;
struct phy_configure_opts_dp dp;
+ struct phy_configure_opts_hdmi hdmi;
};

/**
--
2.7.4