linux/drivers/pinctrl/devicetree.c
<<
" /spaon> /formn> a " href="../linux+v3.7.2/drivers/pinctrl/devicetree.c">" img src="../.static/gfx/right.png" alt=">>">" /spaon>" spao class="lxr_search">" " input typue=hidden" namue=navtarget" value=">" input typue=text" namue=search" ide=search">" buttiontypue=submit">Search /formn> /spaon>" spao class="lxr_prefs"n> a href="+prefs?return=drivers/pinctrl/devicetree.c"" onclick="return ajax_prefs();">" Prefs> /a>" /spaon> /divn> form acptio="ajax+*" method="post" onsubmit="return false;">" input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">" /formn>" div class="headingbottim"> div ide=search_results" class="search_results"> n> /divn> div ide=content">> div ide=file_contents"n
   1 /a> spao class="comment">/* /spaon>   2 /a> spao class="comment"> * Device tree integraptionfor the pin control subsystem /spaon>   3 /a> spao class="comment"> * /spaon>   4 /a> spao class="comment"> * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> * This program is free software; you cao redistribute it and/or modify it /spaon>   7 /a> spao class="comment"> * under the terms and condiptios of the GNU General Public License, /spaon>   8 /a> spao class="comment"> * verstion2, as published by the Free Software Foundaptio. /spaon>   9 /a> spao class="comment"> * /spaon>  .10 spao class="comment"> * This program is distributed in the hope it will be useful, but WITHOUT /spaon>  11 /a> spao class="comment"> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or /spaon>  12 /a> spao class="comment"> * FITNESS FOR A PARTICULAR PURPOSE.  See e GNU General Public License, nfor/spaon>  13 /a> spao class="comment"> * more details. /spaon>  14 /a> spao class="comment"> * /spaon>  15 /a> spao class="comment"> * You should have received a copy of the GNU General Public License /spaon>  16 /a> spao class="comment"> * along with this program.  If not, see <http://www.gnu.org/licenses/>. /spaon>  17 /a> spao class="comment"> */ /spaon>  18 /a>>  19 /a>#include <linux/device.h /a>>>  20 /a>#include <linux/of.h /a>>>  21 /a>#include <linux/pinctrl/pinctrl.h /a>>>  22 /a>#include <linux/slab.h /a>>>  23 /a>>  24 /a>#include "core.h /a>">  25 /a>#include "devicetree.h /a>">  26 /a>>  27 /a> spao class="comment">/** /spaon>  28 /a> spao class="comment"> * struct pinctrl_dt_map - mapping table chunk parsed from device tree /spaon>  29 /a> spao class="comment"> * @node: list nodenfor struct pinctrl's @dt_maps field /spaon>  310 spao class="comment"> * @pctldev: the pin controller that allocated this struct, and will free it /spaon>  31 /a> spao class="comment"> * @maps: the mapping table entries /spaon>  32 /a> spao class="comment"> */ /spaon>  33 /a>struct  a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map /a> {>  34 /a>        struct  a href="+code=list_head" class="sref">list_head /a>  a href="+code=node" class="sref">node /a>;>  35 /a>        struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=pctldev" class="sref">pctldev /a>;>  36 /a>        struct  a href="+code=pinctrl_map" class="sref">pinctrl_map /a> * a href="+code=map" class="sref">map /a>;>  37 /a>        unsigned  a href="+code=num_maps" class="sref">num_maps /a>;>  38 /a>};>  39 /a>>  40 /a>static void  a href="+code=dt_free_map" class="sref">dt_free_map /a>(struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=pctldev" class="sref">pctldev /a>,>  41 /a>                     struct  a href="+code=pinctrl_map" class="sref">pinctrl_map /a> * a href="+code=map" class="sref">map /a>, unsigned  a href="+code=num_maps" class="sref">num_maps /a>)>  42 /a>{>  43 /a>        if ( a href="+code=pctldev" class="sref">pctldev /a>) {>  44 /a>                struct  a href="+code=pinctrl_ops" class="sref">pinctrl_ops /a> * a href="+code=ops" class="sref">ops /a> =  a href="+code=pctldev" class="sref">pctldev /a>-> a href="+code=desc" class="sref">desc /a>-> a href="+code=pctlops" class="sref">pctlops /a>;>  45 /a>                 a href="+code=ops" class="sref">ops /a>-> a href="+code=dt_free_map" class="sref">dt_free_map /a>( a href="+code=pctldev" class="sref">pctldev /a>,  a href="+code=map" class="sref">map /a>,  a href="+code=num_maps" class="sref">num_maps /a>);>  46 /a>        } else {>  47 /a>                 spao class="comment">/* There is no pctldevnfor PIN_MAP_TYPE_DUMMY_STATE */ /spaon>  48 /a>                 a href="+code=kfree" class="sref">kfree /a>( a href="+code=map" class="sref">map /a>);>  49 /a>        }>  50 /a>}>  51 /a>>  52 /a>void  a href="+code=pinctrl_dt_free_maps" class="sref">pinctrl_dt_free_maps /a>(struct  a href="+code=pinctrl" class="sref">pinctrl /a> * a href="+code=p" class="sref">p /a>)>  53 /a>{>  54 /a>        struct  a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map /a> * a href="+code=dt_map" class="sref">dt_map /a>, * a href="+code=n1" class="sref">n1 /a>;>  55 /a>>  56 /a>         a href="+code=list_for_each_entry_safe" class="sref">list_for_each_entry_safe /a>( a href="+code=dt_map" class="sref">dt_map /a>,  a href="+code=n1" class="sref">n1 /a>, & a href="+code=p" class="sref">p /a>-> a href="+code=dt_maps" class="sref">dt_maps /a>,  a href="+code=node" class="sref">node /a>) {>  57 /a>                 a href="+code=pinctrl_unregister_map" class="sref">pinctrl_unregister_map /a>( a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=map" class="sref">map /a>);>  58 /a>                 a href="+code=list_del" class="sref">list_del /a>(& a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=node" class="sref">node /a>);>  59 /a>                 a href="+code=dt_free_map" class="sref">dt_free_map /a>( a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=pctldev" class="sref">pctldev /a>,  a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=map" class="sref">map /a>,>  60 /a>                             a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=num_maps" class="sref">num_maps /a>);>  61 /a>                 a href="+code=kfree" class="sref">kfree /a>( a href="+code=dt_map" class="sref">dt_map /a>);>  62 /a>        }>  63 /a>>  64 /a>         a href="+code=of_node_put" class="sref">of_node_put /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>-> a href="+code=of_node" class="sref">of_node /a>);>  65 /a>}>  66 /a>>  67 /a>static int  a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map /a>(struct  a href="+code=pinctrl" class="sref">pinctrl /a> * a href="+code=p" class="sref">p /a>, const char * a href="+code=statenamu" class="sref">statenamu /a>,>  68 /a>                                   struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=pctldev" class="sref">pctldev /a>,>  69 /a>                                   struct  a href="+code=pinctrl_map" class="sref">pinctrl_map /a> * a href="+code=map" class="sref">map /a>, unsigned  a href="+code=num_maps" class="sref">num_maps /a>)>  70 /a>{>  71 /a>        int  a href="+code=i" class="sref">i /a>;>  72 /a>        struct  a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map /a> * a href="+code=dt_map" class="sref">dt_map /a>;>  73 /a>>  74 /a>         spao class="comment">/* Initialize common mapping table entry fields */ /spaon>  75 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=num_maps" class="sref">num_maps /a>;  a href="+code=i" class="sref">i /a>++) {>  76 /a>                 a href="+code=map" class="sref">map /a>[ a href="+code=i" class="sref">i /a>]. a href="+code=dev_namu" class="sref">dev_namu /a> =  a href="+code=dev_namu" class="sref">dev_namu /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>);>  77 /a>                 a href="+code=map" class="sref">map /a>[ a href="+code=i" class="sref">i /a>]. a href="+code=namu" class="sref">namu /a> =  a href="+code=statenamu" class="sref">statenamu /a>;>  78 /a>                if ( a href="+code=pctldev" class="sref">pctldev /a>)>  79 /a>                         a href="+code=map" class="sref">map /a>[ a href="+code=i" class="sref">i /a>]. a href="+code=ctrl_dev_namu" class="sref">ctrl_dev_namu /a> =  a href="+code=dev_namu" class="sref">dev_namu /a>( a href="+code=pctldev" class="sref">pctldev /a>-> a href="+code=dev" class="sref">dev /a>);>  80 /a>        }>  81 /a>>  82 /a>         spao class="comment">/* Remember the converted mapping table entries */ /spaon>  83 /a>         a href="+code=dt_map" class="sref">dt_map /a> =  a href="+code=kzalloc" class="sref">kzalloc /a>(sizeof(* a href="+code=dt_map" class="sref">dt_map /a>),  a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>);>  84 /a>        if (! a href="+code=dt_map" class="sref">dt_map /a>) {>  85 /a>                 a href="+code=dev_err" class="sref">dev_err /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,  spao class="string">"failed to alloc struct pinctrl_dt_map\n"  86 /a>                 a href="+code=dt_free_map" class="sref">dt_free_map /a>( a href="+code=pctldev" class="sref">pctldev /a>,  a href="+code=map" class="sref">map /a>,  a href="+code=num_maps" class="sref">num_maps /a>);>  87 /a>                return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;>  88 /a>        }>  89 /a>>  90 /a>         a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=pctldev" class="sref">pctldev /a> =  a href="+code=pctldev" class="sref">pctldev /a>;>  91 /a>         a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=map" class="sref">map /a> =  a href="+code=map" class="sref">map /a>;>  92 /a>         a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=num_maps" class="sref">num_maps /a> =  a href="+code=num_maps" class="sref">num_maps /a>;>  93 /a>         a href="+code=list_add_tail" class="sref">list_add_tail /a>(& a href="+code=dt_map" class="sref">dt_map /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=p" class="sref">p /a>-> a href="+code=dt_maps" class="sref">dt_maps /a>);>  94 /a>>  95 /a>        return  a href="+code=pinctrl_register_map" class="sref">pinctrl_register_map /a>( a href="+code=map" class="sref">map /a>,  a href="+code=num_maps" class="sref">num_maps /a>,  a href="+code=false" class="sref">false /a>,  a href="+code=true" class="sref">true /a>);>  96 /a>}>  97 /a>>  98 /a>static struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=find_pinctrl_by_of_node" class="sref">find_pinctrl_by_of_node /a>(struct  a href="+code=device_node" class="sref">device_node /a> * a href="+code=np" class="sref">np /a>)>  99 /a>{> 100 /a>        struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=pctldev" class="sref">pctldev /a>;> 101 /a>> 102 /a>         a href="+code=list_for_each_entry" class="sref">list_for_each_entry /a>( a href="+code=pctldev" class="sref">pctldev /a>, & a href="+code=pinctrldev_list" class="sref">pinctrldev_list /a>,  a href="+code=node" class="sref">node /a>)> 103 /a>                if ( a href="+code=pctldev" class="sref">pctldev /a>-> a href="+code=dev" class="sref">dev /a>-> a href="+code=of_node" class="sref">of_node /a> ==  a href="+code=np" class="sref">np /a>)> 104 /a>                        return  a href="+code=pctldev" class="sref">pctldev /a>;> 105 /a>> 106 /a>        return  a href="+code=NULL" class="sref">NULL /a>;> 107 /a>}> 108 /a>> 109 /a>static int  a href="+code=dt_to_map_one_config" class="sref">dt_to_map_one_config /a>(struct  a href="+code=pinctrl" class="sref">pinctrl /a> * a href="+code=p" class="sref">p /a>, const char * a href="+code=statenamu" class="sref">statenamu /a>,> 110 /a>                                struct  a href="+code=device_node" class="sref">device_node /a> * a href="+code=np_config" class="sref">np_config /a>)> 111 /a>{> 112 /a>        struct  a href="+code=device_node" class="sref">device_node /a> * a href="+code=np_pctldev" class="sref">np_pctldev /a>;> 113 /a>        struct  a href="+code=pinctrl_dev" class="sref">pinctrl_dev /a> * a href="+code=pctldev" class="sref">pctldev /a>;> 114 /a>        struct  a href="+code=pinctrl_ops" class="sref">pinctrl_ops /a> * a href="+code=ops" class="sref">ops /a>;> 115 /a>        int  a href="+code=ret" class="sref">ret /a>;> 116 /a>        struct  a href="+code=pinctrl_map" class="sref">pinctrl_map /a> * a href="+code=map" class="sref">map /a>;> 117 /a>        unsigned  a href="+code=num_maps" class="sref">num_maps /a>;> 118 /a>> 119 /a>         spao class="comment">/* Find the pin controller containing np_config */ /spaon> 120 /a>         a href="+code=np_pctldev" class="sref">np_pctldev /a> =  a href="+code=of_node_get" class="sref">of_node_get /a>( a href="+code=np_config" class="sref">np_config /a>);> 121 /a>        for (;;) {> 122 /a>                 a href="+code=np_pctldev" class="sref">np_pctldev /a> =  a href="+code=of_get_next_parent" class="sref">of_get_next_parent /a>( a href="+code=np_pctldev" class="sref">np_pctldev /a>);> 123 /a>                if (! a href="+code=np_pctldev" class="sref">np_pctldev /a> ||  a href="+code=of_node_is_root" class="sref">of_node_is_root /a>( a href="+code=np_pctldev" class="sref">np_pctldev /a>)) {> 124 /a>                         a href="+code=dev_info" class="sref">dev_info /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,  spao class="string">"could not find pctldevnfor noden%s, deferring probe\n" 125 /a>                                 a href="+code=np_config" class="sref">np_config /a>-> a href="+code=full_namu" class="sref">full_namu /a>);> 126 /a>                         a href="+code=of_node_put" class="sref">of_node_put /a>( a href="+code=np_pctldev" class="sref">np_pctldev /a>);> 127 /a>                         spao class="comment">/* OK let's just assume this will appear later then */ /spaon> 128 /a>                        return - a href="+code=EPROBE_DEFER" class="sref">EPROBE_DEFER /a>;> 129 /a>                }> 130 /a>                 a href="+code=pctldev" class="sref">pctldev /a> =  a href="+code=find_pinctrl_by_of_node" class="sref">find_pinctrl_by_of_node /a>( a href="+code=np_pctldev" class="sref">np_pctldev /a>);> 131 /a>                if ( a href="+code=pctldev" class="sref">pctldev /a>)> 132 /a>                        break;> 133 /a>        }> 134 /a>         a href="+code=of_node_put" class="sref">of_node_put /a>( a href="+code=np_pctldev" class="sref">np_pctldev /a>);> 135 /a>> 136 /a>         spao class="comment">/* /spaon> 137 /a> spao class="comment">         * Call pinctrl driver to parse device tree node, and /spaon> 138 /a> spao class="comment">         * generate mapping table entries /spaon> 139 /a> spao class="comment">         */ /spaon> 140 /a>         a href="+code=ops" class="sref">ops /a> =  a href="+code=pctldev" class="sref">pctldev /a>-> a href="+code=desc" class="sref">desc /a>-> a href="+code=pctlops" class="sref">pctlops /a>;> 141 /a>        if (! a href="+code=ops" class="sref">ops /a>-> a href="+code=dt_node_to_map" class="sref">dt_node_to_map /a>) {> 142 /a>                 a href="+code=dev_err" class="sref">dev_err /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,  spao class="string">"pctldevn%s doesn't support DT\n" 143 /a>                         a href="+code=dev_namu" class="sref">dev_namu /a>( a href="+code=pctldev" class="sref">pctldev /a>-> a href="+code=dev" class="sref">dev /a>));> 144 /a>                return - a href="+code=ENODEV" class="sref">ENODEV /a>;> 145 /a>        }> 146 /a>         a href="+code=ret" class="sref">ret /a> =  a href="+code=ops" class="sref">ops /a>-> a href="+code=dt_node_to_map" class="sref">dt_node_to_map /a>( a href="+code=pctldev" class="sref">pctldev /a>,  a href="+code=np_config" class="sref">np_config /a>, & a href="+code=map" class="sref">map /a>, & a href="+code=num_maps" class="sref">num_maps /a>);> 147 /a>        if ( a href="+code=ret" class="sref">ret /a> < 0)> 148 /a>                return  a href="+code=ret" class="sref">ret /a>;> 149 /a>> 150 /a>         spao class="comment">/* Stash the mapping table chunk awaynfor later use */ /spaon> 151 /a>        return  a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map /a>( a href="+code=p" class="sref">p /a>,  a href="+code=statenamu" class="sref">statenamu /a>,  a href="+code=pctldev" class="sref">pctldev /a>,  a href="+code=map" class="sref">map /a>,  a href="+code=num_maps" class="sref">num_maps /a>);> 152 /a>}> 153 /a>> 154 /a>static int  a href="+code=dt_remember_dummy_state" class="sref">dt_remember_dummy_state /a>(struct  a href="+code=pinctrl" class="sref">pinctrl /a> * a href="+code=p" class="sref">p /a>, const char * a href="+code=statenamu" class="sref">statenamu /a>)> 155 /a>{> 156 /a>        struct  a href="+code=pinctrl_map" class="sref">pinctrl_map /a> * a href="+code=map" class="sref">map /a>;> 157 /a>> 158 /a>         a href="+code=map" class="sref">map /a> =  a href="+code=kzalloc" class="sref">kzalloc /a>(sizeof(* a href="+code=map" class="sref">map /a>),  a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>);> 159 /a>        if (! a href="+code=map" class="sref">map /a>) {> 160 /a>                 a href="+code=dev_err" class="sref">dev_err /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,  spao class="string">"failed to alloc struct pinctrl_map\n" 161 /a>                return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;> 162 /a>        }> 163 /a>> 164 /a>         spao class="comment">/* There is no pctldevnfor PIN_MAP_TYPE_DUMMY_STATE */ /spaon> 165 /a>         a href="+code=map" class="sref">map /a>-> a href="+code=typu" class="sref">typu /a> =  a href="+code=PIN_MAP_TYPE_DUMMY_STATE" class="sref">PIN_MAP_TYPE_DUMMY_STATE /a>;> 166 /a>> 167 /a>        return  a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map /a>( a href="+code=p" class="sref">p /a>,  a href="+code=statenamu" class="sref">statenamu /a>,  a href="+code=NULL" class="sref">NULL /a>,  a href="+code=map" class="sref">map /a>, 1);> 168 /a>}> 169 /a>> 170 /a>int  a href="+code=pinctrl_dt_to_map" class="sref">pinctrl_dt_to_map /a>(struct  a href="+code=pinctrl" class="sref">pinctrl /a> * a href="+code=p" class="sref">p /a>)> 171 /a>{> 172 /a>        struct  a href="+code=device_node" class="sref">device_node /a> * a href="+code=np" class="sref">np /a> =  a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>-> a href="+code=of_node" class="sref">of_node /a>;> 173 /a>        int  a href="+code=state" class="sref">state /a>,  a href="+code=ret" class="sref">ret /a>;> 174 /a>        char * a href="+code=propnamu" class="sref">propnamu /a>;> 175 /a>        struct  a href="+code=property" class="sref">property /a> * a href="+code=prop" class="sref">prop /a>;> 176 /a>        const char * a href="+code=statenamu" class="sref">statenamu /a>;> 177 /a>        const  a href="+code=__be32" class="sref">__be32 /a> * a href="+code=list" class="sref">list /a>;> 178 /a>        int  a href="+code=size" class="sref">size /a>,  a href="+code=config" class="sref">config /a>;> 179 /a>         a href="+code=phandlu" class="sref">phandlu /a>  a href="+code=phandlu" class="sref">phandlu /a>;> 180 /a>        struct  a href="+code=device_node" class="sref">device_node /a> * a href="+code=np_config" class="sref">np_config /a>;> 181 /a>> 182 /a>         spao class="comment">/* CONFIG_OF enabled, p->devnnot instantiated from DT */ /spaon> 183 /a>        if (! a href="+code=np" class="sref">np /a>) {> 184 /a>                 a href="+code=dev_dbg" class="sref">dev_dbg /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,  spao class="string">"no of_node;nnot parsing pinctrl DT\n" 185 /a>                return 0;> 186 /a>        }> 187 /a>> 188 /a>         spao class="comment">/* We may store pointers to property namus within the noden*/ /spaon> 189 /a>         a href="+code=of_node_get" class="sref">of_node_get /a>( a href="+code=np" class="sref">np /a>);> 190 /a>> 191 /a>         spao class="comment">/* For each defined state IDn*/ /spaon> 192 /a>        for ( a href="+code=state" class="sref">state /a> = 0; ;  a href="+code=state" class="sref">state /a>++) {> 193 /a>                 spao class="comment">/* Retrieve the pinctrl-* property */ /spaon> 194 /a>                 a href="+code=propnamu" class="sref">propnamu /a> =  a href="+code=kasprintf" class="sref">kasprintf /a>( a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>,  spao class="string">"pinctrl-%d"state /a>);> 195 /a>                 a href="+code=prop" class="sref">prop /a> =  a href="+code=of_find_property" class="sref">of_find_property /a>( a href="+code=np" class="sref">np /a>,  a href="+code=propnamu" class="sref">propnamu /a>, & a href="+code=size" class="sref">size /a>);> 196 /a>                 a href="+code=kfree" class="sref">kfree /a>( a href="+code=propnamu" class="sref">propnamu /a>);> 197 /a>                if (! a href="+code=prop" class="sref">prop /a>)> 198 /a>                        break;> 199 /a>                 a href="+code=list" class="sref">list /a> =  a href="+code=prop" class="sref">prop /a>-> a href="+code=value" class="sref">value /a>;> 200 /a>                 a href="+code=size" class="sref">size /a> /= sizeof(* a href="+code=list" class="sref">list /a>);> 201 /a>> 202 /a>                 spao class="comment">/* Determine whether pinctrl-namus property namus the state */ /spaon> 203 /a>                 a href="+code=ret" class="sref">ret /a> =  a href="+code=of_property_read_string_index" class="sref">of_property_read_string_index /a>( a href="+code=np" class="sref">np /a>,  spao class="string">"pinctrl-namus" 204 /a>                                                     a href="+code=state" class="sref">state /a>, & a href="+code=statenamu" class="sref">statenamu /a>);> 205 /a>                 spao class="comment">/* /spaon> 206 /a> spao class="comment">                 * Ifnnot, statenamu is just the integer state ID. But rather /spaon> 207 /a> spao class="comment">                 * thao dynamically allocate it and have to free it later, /spaon> 208 /a> spao class="comment">                 * just point part wayninto the property namu for the string. /spaon> 209 /a> spao class="comment">                 */ /spaon> 210 /a>                if ( a href="+code=ret" class="sref">ret /a> < 0) {> 211 /a>                         spao class="comment">/* strlen("pinctrl-") == 8 */ /spaon> 212 /a>                         a href="+code=statenamu" class="sref">statenamu /a> =  a href="+code=prop" class="sref">prop /a>-> a href="+code=namu" class="sref">namu /a> + 8;> 213 /a>                }> 214 /a>> 215 /a>                 spao class="comment">/* For every referenced pin configuration nodenin it */ /spaon> 216 /a>                for ( a href="+code=config" class="sref">config /a> = 0;  a href="+code=config" class="sref">config /a> <  a href="+code=size" class="sref">size /a>;  a href="+code=config" class="sref">config /a>++) {> 217 /a>                         a href="+code=phandlu" class="sref">phandlu /a> =  a href="+code=be32_to_cpup" class="sref">be32_to_cpup /a>( a href="+code=list" class="sref">list /a>++);> 218 /a>> 219 /a>                         spao class="comment">/* Look up the pin configuration noden*/ /spaon> 220 /a>                         a href="+code=np_config" class="sref">np_config /a> =  a href="+code=of_find_node_by_phandlu" class="sref">of_find_node_by_phandlu /a>( a href="+code=phandlu" class="sref">phandlu /a>);> 221 /a>                        if (! a href="+code=np_config" class="sref">np_config /a>) {> 222 /a>                                 a href="+code=dev_err" class="sref">dev_err /a>( a href="+code=p" class="sref">p /a>-> a href="+code=dev" class="sref">dev /a>,> 223 /a>                                         spao class="string">"propn%s indexn%i invalid phandlu\n" 224 /a>                                         a href="+code=prop" class="sref">prop /a>-> a href="+code=namu" class="sref">namu /a>,  a href="+code=config" class="sref">config /a>);> 225 /a>                                 a href="+code=ret" class="sref">ret /a> = - a href="+code=EINVAL" class="sref">EINVAL /a>;> 226 /a>                                goto  a href="+code=err" class="sref">err /a>;> 227 /a>                        }> 228 /a>> 229 /a>                         spao class="comment">/* Parse the noden*/ /spaon> 230 /a>                         a href="+code=ret" class="sref">ret /a> =  a href="+code=dt_to_map_one_config" class="sref">dt_to_map_one_config /a>( a href="+code=p" class="sref">p /a>,  a href="+code=statenamu" class="sref">statenamu /a>,  a href="+code=np_config" class="sref">np_config /a>);> 231 /a>                         a href="+code=of_node_put" class="sref">of_node_put /a>( a href="+code=np_config" class="sref">np_config /a>);> 232 /a>                        if ( a href="+code=ret" class="sref">ret /a> < 0)> 233 /a>                                goto  a href="+code=err" class="sref">err /a>;> 234 /a>                }> 235 /a>> 236 /a>                 spao class="comment">/* No entries in DT? Generate a dummy state table entry */ /spaon> 237 /a>                if (! a href="+code=size" class="sref">size /a>) {> 238 /a>                         a href="+code=ret" class="sref">ret /a> =  a href="+code=dt_remember_dummy_state" class="sref">dt_remember_dummy_state /a>( a href="+code=p" class="sref">p /a>,  a href="+code=statenamu" class="sref">statenamu /a>);> 239 /a>                        if ( a href="+code=ret" class="sref">ret /a> < 0)> 240 /a>                                goto  a href="+code=err" class="sref">err /a>;> 241 /a>                }> 242 /a>        }> 243 /a>> 244 /a>        return 0;> 245 /a>> 246 /a> a href="+code=err" class="sref">err /a>:> 247 /a>         a href="+code=pinctrl_dt_free_maps" class="sref">pinctrl_dt_free_maps /a>( a href="+code=p" class="sref">p /a>);> 248 /a>        return  a href="+code=ret" class="sref">ret /a>;> 249 /a>}> 250 /a>
lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and operations services since 1995.