@@ -249,6 +249,7 @@ static int rzg2l_map_add_config(struct pinctrl_map *map,
249249
250250static int rzg2l_dt_subnode_to_map (struct pinctrl_dev * pctldev ,
251251 struct device_node * np ,
252+ struct device_node * parent ,
252253 struct pinctrl_map * * map ,
253254 unsigned int * num_maps ,
254255 unsigned int * index )
@@ -266,6 +267,7 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
266267 struct property * prop ;
267268 int ret , gsel , fsel ;
268269 const char * * pin_fn ;
270+ const char * name ;
269271 const char * pin ;
270272
271273 pinmux = of_find_property (np , "pinmux" , NULL );
@@ -349,8 +351,19 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
349351 psel_val [i ] = MUX_FUNC (value );
350352 }
351353
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+
352365 /* 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 );
354367 if (gsel < 0 ) {
355368 ret = gsel ;
356369 goto done ;
@@ -360,17 +373,16 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,
360373 * Register a single group function where the 'data' is an array PSEL
361374 * register values read from DT.
362375 */
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 );
366378 if (fsel < 0 ) {
367379 ret = fsel ;
368380 goto remove_group ;
369381 }
370382
371383 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 ;
374386 idx ++ ;
375387
376388 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,
417429 index = 0 ;
418430
419431 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 ,
421433 num_maps , & index );
422434 if (ret < 0 ) {
423435 of_node_put (child );
@@ -426,7 +438,7 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev,
426438 }
427439
428440 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 ,
430442 num_maps , & index );
431443 if (ret < 0 )
432444 goto done ;
0 commit comments