소스 검색

waterDataStatistics alarmDataOperation.c 朱涛 commit at 2021-03-01

朱涛 4 년 전
부모
커밋
97b887f74b
1개의 변경된 파일110개의 추가작업 그리고 0개의 파일을 삭제
  1. 110 0
      waterDataStatistics/databaseOperation/alarmDataOperation.c

+ 110 - 0
waterDataStatistics/databaseOperation/alarmDataOperation.c

@@ -3255,3 +3255,113 @@ static void __init _ensure_mpu_hwmod_is_setup(struct omap_hwmod *oh)
 		omap_hwmod_setup_one(MPU_INITIATOR_NAME);
 }
 
+/**
+ * omap_hwmod_setup_one - set up a single hwmod
+ * @oh_name: const char * name of the already-registered hwmod to set up
+ *
+ * Initialize and set up a single hwmod.  Intended to be used for a
+ * small number of early devices, such as the timer IP blocks used for
+ * the scheduler clock.  Must be called after omap2_clk_init().
+ * Resolves the struct clk names to struct clk pointers for each
+ * registered omap_hwmod.  Also calls _setup() on each hwmod.  Returns
+ * -EINVAL upon error or 0 upon success.
+ */
+int __init omap_hwmod_setup_one(const char *oh_name)
+{
+	struct omap_hwmod *oh;
+
+	pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__);
+
+	oh = _lookup(oh_name);
+	if (!oh) {
+		WARN(1, "omap_hwmod: %s: hwmod not yet registered\n", oh_name);
+		return -EINVAL;
+	}
+
+	_ensure_mpu_hwmod_is_setup(oh);
+
+	_init(oh, NULL);
+	_setup(oh, NULL);
+
+	return 0;
+}
+
+/**
+ * omap_hwmod_setup_all - set up all registered IP blocks
+ *
+ * Initialize and set up all IP blocks registered with the hwmod code.
+ * Must be called after omap2_clk_init().  Resolves the struct clk
+ * names to struct clk pointers for each registered omap_hwmod.  Also
+ * calls _setup() on each hwmod.  Returns 0 upon success.
+ */
+static int __init omap_hwmod_setup_all(void)
+{
+	_ensure_mpu_hwmod_is_setup(NULL);
+
+	omap_hwmod_for_each(_init, NULL);
+	omap_hwmod_for_each(_setup, NULL);
+
+	return 0;
+}
+core_initcall(omap_hwmod_setup_all);
+
+/**
+ * omap_hwmod_enable - enable an omap_hwmod
+ * @oh: struct omap_hwmod *
+ *
+ * Enable an omap_hwmod @oh.  Intended to be called by omap_device_enable().
+ * Returns -EINVAL on error or passes along the return value from _enable().
+ */
+int omap_hwmod_enable(struct omap_hwmod *oh)
+{
+	int r;
+	unsigned long flags;
+
+	if (!oh)
+		return -EINVAL;
+
+	spin_lock_irqsave(&oh->_lock, flags);
+	r = _enable(oh);
+	spin_unlock_irqrestore(&oh->_lock, flags);
+
+	return r;
+}
+
+/**
+ * omap_hwmod_idle - idle an omap_hwmod
+ * @oh: struct omap_hwmod *
+ *
+ * Idle an omap_hwmod @oh.  Intended to be called by omap_device_idle().
+ * Returns -EINVAL on error or passes along the return value from _idle().
+ */
+int omap_hwmod_idle(struct omap_hwmod *oh)
+{
+	unsigned long flags;
+
+	if (!oh)
+		return -EINVAL;
+
+	spin_lock_irqsave(&oh->_lock, flags);
+	_idle(oh);
+	spin_unlock_irqrestore(&oh->_lock, flags);
+
+	return 0;
+}
+
+/**
+ * omap_hwmod_shutdown - shutdown an omap_hwmod
+ * @oh: struct omap_hwmod *
+ *
+ * Shutdown an omap_hwmod @oh.  Intended to be called by
+ * omap_device_shutdown().  Returns -EINVAL on error or passes along
+ * the return value from _shutdown().
+ */
+int omap_hwmod_shutdown(struct omap_hwmod *oh)
+{
+	unsigned long flags;
+
+	if (!oh)
+		return -EINVAL;
+
+	spin_lock_irqsave(&oh->_lock, flags);
+	_shutdown(oh);