]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: arm_scmi: Add standard clock OEM definitions
authorCristian Marussi <cristian.marussi@arm.com>
Wed, 14 Feb 2024 18:30:03 +0000 (18:30 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Thu, 22 Feb 2024 08:17:11 +0000 (08:17 +0000)
Add a common enum to define the standard clock OEM types defined by the
SCMI specification, so as to enable the configuration of such extended
configuration properties with the existent clock protocol operations.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20240214183006.3403207-5-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/clock.c
include/linux/scmi_protocol.h

index add350bf2a7f2d3aa1fc2baa5030d9db380f8910..95393af655edd8e52e35248c4976a70e26c64c2d 100644 (file)
@@ -165,10 +165,12 @@ struct clock_info {
        struct scmi_clock_info *clk;
        int (*clock_config_set)(const struct scmi_protocol_handle *ph,
                                u32 clk_id, enum clk_state state,
-                               u8 oem_type, u32 oem_val, bool atomic);
+                               enum scmi_clock_oem_config oem_type,
+                               u32 oem_val, bool atomic);
        int (*clock_config_get)(const struct scmi_protocol_handle *ph,
-                               u32 clk_id, u8 oem_type, u32 *attributes,
-                               bool *enabled, u32 *oem_val, bool atomic);
+                               u32 clk_id, enum scmi_clock_oem_config oem_type,
+                               u32 *attributes, bool *enabled, u32 *oem_val,
+                               bool atomic);
 };
 
 static enum scmi_clock_protocol_cmd evt_2_cmd[] = {
@@ -618,7 +620,8 @@ static int scmi_clock_rate_set(const struct scmi_protocol_handle *ph,
 
 static int
 scmi_clock_config_set(const struct scmi_protocol_handle *ph, u32 clk_id,
-                     enum clk_state state, u8 __unused0, u32 __unused1,
+                     enum clk_state state,
+                     enum scmi_clock_oem_config __unused0, u32 __unused1,
                      bool atomic)
 {
        int ret;
@@ -708,7 +711,8 @@ scmi_clock_get_parent(const struct scmi_protocol_handle *ph, u32 clk_id,
 /* For SCMI clock v3.0 and onwards */
 static int
 scmi_clock_config_set_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
-                        enum clk_state state, u8 oem_type, u32 oem_val,
+                        enum clk_state state,
+                        enum scmi_clock_oem_config oem_type, u32 oem_val,
                         bool atomic)
 {
        int ret;
@@ -781,8 +785,8 @@ static int scmi_clock_disable(const struct scmi_protocol_handle *ph, u32 clk_id,
 /* For SCMI clock v3.0 and onwards */
 static int
 scmi_clock_config_get_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
-                        u8 oem_type, u32 *attributes, bool *enabled,
-                        u32 *oem_val, bool atomic)
+                        enum scmi_clock_oem_config oem_type, u32 *attributes,
+                        bool *enabled, u32 *oem_val, bool atomic)
 {
        int ret;
        u32 flags;
@@ -823,8 +827,8 @@ scmi_clock_config_get_v2(const struct scmi_protocol_handle *ph, u32 clk_id,
 
 static int
 scmi_clock_config_get(const struct scmi_protocol_handle *ph, u32 clk_id,
-                     u8 oem_type, u32 *attributes, bool *enabled,
-                     u32 *oem_val, bool atomic)
+                     enum scmi_clock_oem_config oem_type, u32 *attributes,
+                     bool *enabled, u32 *oem_val, bool atomic)
 {
        int ret;
        struct scmi_xfer *t;
@@ -861,8 +865,9 @@ static int scmi_clock_state_get(const struct scmi_protocol_handle *ph,
 }
 
 static int scmi_clock_config_oem_set(const struct scmi_protocol_handle *ph,
-                                    u32 clk_id, u8 oem_type, u32 oem_val,
-                                    bool atomic)
+                                    u32 clk_id,
+                                    enum scmi_clock_oem_config oem_type,
+                                    u32 oem_val, bool atomic)
 {
        struct clock_info *ci = ph->get_priv(ph);
        struct scmi_clock_info *clk;
@@ -879,8 +884,9 @@ static int scmi_clock_config_oem_set(const struct scmi_protocol_handle *ph,
 }
 
 static int scmi_clock_config_oem_get(const struct scmi_protocol_handle *ph,
-                                    u32 clk_id, u8 oem_type, u32 *oem_val,
-                                    u32 *attributes, bool atomic)
+                                    u32 clk_id,
+                                    enum scmi_clock_oem_config oem_type,
+                                    u32 *oem_val, u32 *attributes, bool atomic)
 {
        struct clock_info *ci = ph->get_priv(ph);
        struct scmi_clock_info *clk;
index 46a61173c91ca83b8edadc97cd94a7e1661b17bb..2ee94ff0320c32233a528e1b328d58237cee8452 100644 (file)
@@ -76,6 +76,13 @@ struct scmi_handle;
 struct scmi_device;
 struct scmi_protocol_handle;
 
+enum scmi_clock_oem_config {
+       SCMI_CLOCK_CFG_DUTY_CYCLE = 0x1,
+       SCMI_CLOCK_CFG_PHASE,
+       SCMI_CLOCK_CFG_OEM_START = 0x80,
+       SCMI_CLOCK_CFG_OEM_END = 0xFF,
+};
+
 /**
  * struct scmi_clk_proto_ops - represents the various operations provided
  *     by SCMI Clock Protocol
@@ -108,10 +115,11 @@ struct scmi_clk_proto_ops {
        int (*state_get)(const struct scmi_protocol_handle *ph, u32 clk_id,
                         bool *enabled, bool atomic);
        int (*config_oem_get)(const struct scmi_protocol_handle *ph, u32 clk_id,
-                             u8 oem_type, u32 *oem_val, u32 *attributes,
-                             bool atomic);
+                             enum scmi_clock_oem_config oem_type,
+                             u32 *oem_val, u32 *attributes, bool atomic);
        int (*config_oem_set)(const struct scmi_protocol_handle *ph, u32 clk_id,
-                             u8 oem_type, u32 oem_val, bool atomic);
+                             enum scmi_clock_oem_config oem_type,
+                             u32 oem_val, bool atomic);
        int (*parent_get)(const struct scmi_protocol_handle *ph, u32 clk_id, u32 *parent_id);
        int (*parent_set)(const struct scmi_protocol_handle *ph, u32 clk_id, u32 parent_id);
 };