@@ -195,6 +195,26 @@ static int pmgr_adt_devices_set_mode(const char *path, u8 target_mode, int recur
195195 return ret ;
196196}
197197
198+ static int pmgr_adt_device_set_mode (const char * path , u32 index , u8 target_mode , int recurse )
199+ {
200+ const u32 * devices ;
201+ u32 n_devices ;
202+ int ret = 0 ;
203+
204+ if (pmgr_adt_find_devices (path , & devices , & n_devices ) < 0 )
205+ return -1 ;
206+
207+ if (index >= n_devices )
208+ return -1 ;
209+
210+ u16 device = FIELD_GET (PMGR_DEVICE_ID , devices [index ]);
211+ u8 die = FIELD_GET (PMGR_DIE_ID , devices [index ]);
212+ if (pmgr_set_mode_recursive (die , device , target_mode , recurse ))
213+ ret = -1 ;
214+
215+ return ret ;
216+ }
217+
198218int pmgr_adt_power_enable (const char * path )
199219{
200220 int ret = pmgr_adt_devices_set_mode (path , PMGR_PS_ACTIVE , true);
@@ -206,6 +226,17 @@ int pmgr_adt_power_disable(const char *path)
206226 return pmgr_adt_devices_set_mode (path , PMGR_PS_PWRGATE , false);
207227}
208228
229+ int pmgr_adt_power_enable_index (const char * path , u32 index )
230+ {
231+ int ret = pmgr_adt_device_set_mode (path , index , PMGR_PS_ACTIVE , true);
232+ return ret ;
233+ }
234+
235+ int pmgr_adt_power_disable_index (const char * path , u32 index )
236+ {
237+ return pmgr_adt_device_set_mode (path , index , PMGR_PS_PWRGATE , false);
238+ }
239+
209240static int pmgr_reset_device (int die , const struct pmgr_device * dev )
210241{
211242 if (die < 0 || die > 16 ) {
0 commit comments