daniel-p-carvalho commented on code in PR #20149:
URL: https://github.com/apache/nuttx/pull/20149#discussion_r4020933514


##########
arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c:
##########
@@ -918,8 +920,36 @@ static int comp_read(struct comp_dev_s *dev)
 #ifdef CONFIG_COMP
 static int comp_ioctl(struct comp_dev_s *dev, int cmd, unsigned long arg)
 {
-#warning "Missing logic"
-  return -ENOTTY;
+  FAR struct stm32_comp_s *priv = (FAR struct stm32_comp_s *)dev->ad_priv;
+  int ret = OK;
+
+  switch (cmd)
+    {
+      case ANIOC_COMP_ENABLE:
+        {
+          /* Enable comparator */
+
+          comp_enable(priv, true);

Review Comment:
   Good point, thank you! Updated in commit 5adfc8e0fc:
   1. In `comp_ioctl()`, we now propagate the return value of `comp_enable()` 
(`ret = comp_enable(priv, true/false)`), returning `-EPERM` if the comparator 
CSR register is locked.
   2. If enabling succeeds and the comparator was configured with locking 
(`priv->lock == true`), we now invoke `comp_lock_set(priv, true)` to lock it as 
intended when initialization was deferred via `CONFIG_STM32_COMP_INIT_DISABLED`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to