@@ -527,7 +527,12 @@ static bool device_is_regulator(const struct device *dev)
527
527
return DEVICE_API_IS (regulator , dev );
528
528
}
529
529
530
- static void device_name_get (size_t idx , struct shell_static_entry * entry )
530
+ static bool device_is_regulator_parent (const struct device * dev )
531
+ {
532
+ return DEVICE_API_IS (regulator_parent , dev );
533
+ }
534
+
535
+ static void device_name_get_regulator (size_t idx , struct shell_static_entry * entry )
531
536
{
532
537
const struct device * dev = shell_device_filter (idx , device_is_regulator );
533
538
@@ -537,7 +542,18 @@ static void device_name_get(size_t idx, struct shell_static_entry *entry)
537
542
entry -> subcmd = NULL ;
538
543
}
539
544
540
- SHELL_DYNAMIC_CMD_CREATE (dsub_device_name , device_name_get );
545
+ static void device_name_get_regulator_parent (size_t idx , struct shell_static_entry * entry )
546
+ {
547
+ const struct device * dev = shell_device_filter (idx , device_is_regulator_parent );
548
+
549
+ entry -> syntax = (dev != NULL ) ? dev -> name : NULL ;
550
+ entry -> handler = NULL ;
551
+ entry -> help = NULL ;
552
+ entry -> subcmd = NULL ;
553
+ }
554
+
555
+ SHELL_DYNAMIC_CMD_CREATE (dsub_device_name , device_name_get_regulator );
556
+ SHELL_DYNAMIC_CMD_CREATE (dsub_device_name_parent , device_name_get_regulator_parent );
541
557
542
558
SHELL_STATIC_SUBCMD_SET_CREATE (
543
559
sub_regulator_cmds ,
@@ -579,12 +595,12 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
579
595
2 , 0 ),
580
596
SHELL_CMD_ARG (errors , & dsub_device_name , SHELL_HELP ("Get active errors" , "<device>" ),
581
597
cmd_errors , 2 , 0 ),
582
- SHELL_CMD_ARG (dvsset , & dsub_device_name ,
598
+ SHELL_CMD_ARG (dvsset , & dsub_device_name_parent ,
583
599
SHELL_HELP ("Set dynamic voltage scaling state" ,
584
600
"<device> <state identifier>" ),
585
601
cmd_dvsset , 3 , 0 ),
586
- SHELL_CMD_ARG (shipmode , & dsub_device_name , SHELL_HELP ( "Enable ship mode" , "<device>" ) ,
587
- cmd_shipmode , 2 , 0 ),
602
+ SHELL_CMD_ARG (shipmode , & dsub_device_name_parent ,
603
+ SHELL_HELP ( "Enable ship mode" , "<device>" ), cmd_shipmode , 2 , 0 ),
588
604
SHELL_SUBCMD_SET_END );
589
605
590
606
SHELL_CMD_REGISTER (regulator , & sub_regulator_cmds , "Regulator playground" ,
0 commit comments