@@ -249,6 +249,7 @@ static int rzg2l_map_add_config(struct pinctrl_map *map,
249
249
250
250
static int rzg2l_dt_subnode_to_map (struct pinctrl_dev * pctldev ,
251
251
struct device_node * np ,
252
+ struct device_node * parent ,
252
253
struct pinctrl_map * * map ,
253
254
unsigned int * num_maps ,
254
255
unsigned int * index )
@@ -266,6 +267,7 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
266
267
struct property * prop ;
267
268
int ret , gsel , fsel ;
268
269
const char * * pin_fn ;
270
+ const char * name ;
269
271
const char * pin ;
270
272
271
273
pinmux = of_find_property (np , "pinmux" , NULL );
@@ -349,8 +351,19 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
349
351
psel_val [i ] = MUX_FUNC (value );
350
352
}
351
353
354
+ if (parent ) {
355
+ name = devm_kasprintf (pctrl -> dev , GFP_KERNEL , "%pOFn.%pOFn" ,
356
+ parent , np );
357
+ if (!name ) {
358
+ ret = - ENOMEM ;
359
+ goto done ;
360
+ }
361
+ } else {
362
+ name = np -> name ;
363
+ }
364
+
352
365
/* Register a single pin group listing all the pins we read from DT */
353
- gsel = pinctrl_generic_add_group (pctldev , np -> name , pins , num_pinmux , NULL );
366
+ gsel = pinctrl_generic_add_group (pctldev , name , pins , num_pinmux , NULL );
354
367
if (gsel < 0 ) {
355
368
ret = gsel ;
356
369
goto done ;
@@ -360,17 +373,16 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
360
373
* Register a single group function where the 'data' is an array PSEL
361
374
* register values read from DT.
362
375
*/
363
- pin_fn [0 ] = np -> name ;
364
- fsel = pinmux_generic_add_function (pctldev , np -> name , pin_fn , 1 ,
365
- psel_val );
376
+ pin_fn [0 ] = name ;
377
+ fsel = pinmux_generic_add_function (pctldev , name , pin_fn , 1 , psel_val );
366
378
if (fsel < 0 ) {
367
379
ret = fsel ;
368
380
goto remove_group ;
369
381
}
370
382
371
383
maps [idx ].type = PIN_MAP_TYPE_MUX_GROUP ;
372
- maps [idx ].data .mux .group = np -> name ;
373
- maps [idx ].data .mux .function = np -> name ;
384
+ maps [idx ].data .mux .group = name ;
385
+ maps [idx ].data .mux .function = name ;
374
386
idx ++ ;
375
387
376
388
dev_dbg (pctrl -> dev , "Parsed %pOF with %d pins\n" , np , num_pinmux );
@@ -417,7 +429,7 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev,
417
429
index = 0 ;
418
430
419
431
for_each_child_of_node (np , child ) {
420
- ret = rzg2l_dt_subnode_to_map (pctldev , child , map ,
432
+ ret = rzg2l_dt_subnode_to_map (pctldev , child , np , map ,
421
433
num_maps , & index );
422
434
if (ret < 0 ) {
423
435
of_node_put (child );
@@ -426,7 +438,7 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev,
426
438
}
427
439
428
440
if (* num_maps == 0 ) {
429
- ret = rzg2l_dt_subnode_to_map (pctldev , np , map ,
441
+ ret = rzg2l_dt_subnode_to_map (pctldev , np , NULL , map ,
430
442
num_maps , & index );
431
443
if (ret < 0 )
432
444
goto done ;
0 commit comments