linux/drivers/pinctrl/devicetree.c
<<
.14/spa> .14/form .14a .1 href="../linux+v3.7.9/drivers/pinctrl/devicetree.c"> .14img src="../.static/gfx/right.png" alt=">>"> 4/spa> 4spa> class="lxr_search"> ="+search" method="post" onsubmit="return do_search(this);"> .14input typ> hidden" nam> navtarget" tion> "> .14input typ> text" nam> search" id search"> .14butt/optyp> submit">Search 4spa> class="lxr_prefs" .14a href="+prefs?return=drivers/pinctrl/devicetree.c" .1 onclick="return ajax_prefs();"> .1Prefs .14/a> 4/spa> .1 14/div .1 14form ac >="ajax+*" method="post" onsubmit="return false;"> 4input typ> hidden" nam> ajax_lookup" id ajax_lookup" tion> "> .1 14/form .1 14div class="headingbott/m">
4div id file_contents"
 L1">1 114/a>4spa> class="comment">/*4/spa>
 
 L2">1 124/a>4spa> class="comment"> * Device tree integra4
 
 L3">1 134/a>4spa> class="comment"> *4/spa>
 
 L4">1 144/a>4spa> class="comment"> * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.4/spa>
 
 L5">1 154/a>4spa> class="comment"> *4/spa>
 
 L6">1 164/a>4spa> class="comment"> * This program is free software; you ca> redistribute it and/or modify it4/spa>
 
 L7">1 174/a>4spa> class="comment"> * under the terms and condi4
 
 L8">1 184/a>4spa> class="comment"> * vers
 
 L9">1 194/a>4spa> class="comment"> *4/spa>
 
 L10">1 ="v3a>4spa> class="comment"> * This program is distributed in the hope it will be useful, but WITHOUT4/spa>
 
 L11">1 114/a>4spa> class="comment"> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or4/spa>
 
 L12">1 124/a>4spa> class="comment"> * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public Licensepfor4/spa>
 
 L13">1 134/a>4spa> class="comment"> * more details.4/spa>
 
 L14">1 144/a>4spa> class="comment"> *4/spa>
 
 L15">1 154/a>4spa> class="comment"> * You should have received a copy of the GNU General Public License4/spa>
 
 L16">1 164/a>4spa> class="comment"> * along with this program.  If not, see <http://www.gnu.org/licenses/>.4/spa>
 
 L17">1 174/a>4spa> class="comment"> */4/spa>
 
 L18">1 184/a> 
 L19">1 194/a>#include <linux/device.h4/a>> 
 L20">1 204/a>#include <linux/of.h4/a>> 
 L21">1 214/a>#include <linux/pinctrl/pinctrl.h4/a>> 
 L22">1 224/a>#include <linux/slab.h4/a>> 
 L23">1 234/a> 
 L24">1 244/a>#include "core.h4/a>" 
 L25">1 254/a>#include "devicetree.h4/a>" 
 L26">1 264/a> 
 L27">1 274/a>4spa> class="comment">/**4/spa>
 
 L28">1 284/a>4spa> class="comment"> * struct pinctrl_dt_map - mapping table chunk parsed from device tree4/spa>
 
 L29">1 294/a>4spa> class="comment"> * @node: list nodepfor struct pinctrl's @dt_maps field4/spa>
 
 L30">1 3"v3a>4spa> class="comment"> * @pctldev: the pin controller that allocated this struct, and will free it4/spa>
 
 L31">1 314/a>4spa> class="comment"> * @maps: the mapping table entries4/spa>
 
 L32">1 324/a>4spa> class="comment"> */4/spa>
 
 L33">1 334/a>struct 4a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map4/a> { 
 L34">1 344/a>        struct 4a href="+code=list_head" class="sref">list_head4/a> 4a href="+code=node" class="sref">node4/a>; 
 L35">1 354/a>        struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=pctldev" class="sref">pctldev4/a>; 
 L36">1 364/a>        struct 4a href="+code=pinctrl_map" class="sref">pinctrl_map4/a> *4a href="+code=map" class="sref">map4/a>; 
 L37">1 374/a>        unsigned 4a href="+code=num_maps" class="sref">num_maps4/a>; 
 L38">1 384/a>}; 
 L39">1 394/a> 
 L40">1 404/a>static void 4a href="+code=dt_free_map" class="sref">dt_free_map4/a>(struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=pctldev" class="sref">pctldev4/a>, 
 L41">1 414/a>                     struct 4a href="+code=pinctrl_map" class="sref">pinctrl_map4/a> *4a href="+code=map" class="sref">map4/a>, unsigned 4a href="+code=num_maps" class="sref">num_maps4/a>) 
 L42">1 424/a>{ 
 L43">1 434/a>        if (4a href="+code=pctldev" class="sref">pctldev4/a>) { 
 L44">1 444/a>                struct 4a href="+code=pinctrl_ops" class="sref">pinctrl_ops4/a> *4a href="+code=ops" class="sref">ops4/a> = 4a href="+code=pctldev" class="sref">pctldev4/a>->4a href="+code=desc" class="sref">desc4/a>->4a href="+code=pctlops" class="sref">pctlops4/a>; 
 L45">1 454/a>                4a href="+code=ops" class="sref">ops4/a>->4a href="+code=dt_free_map" class="sref">dt_free_map4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>, 4a href="+code=map" class="sref">map4/a>, 4a href="+code=num_maps" class="sref">num_maps4/a>); 
 L46">1 464/a>        } else { 
 L47">1 474/a>                4spa> class="comment">/* There is no pctldevpfor PIN_MAP_TYPE_DUMMY_STATE */4/spa>
 
 L48">1 484/a>                4a href="+code=kfree" class="sref">kfree4/a>(4a href="+code=map" class="sref">map4/a>); 
 L49">1 494/a>        } 
 L50">1 504/a>} 
 L51">1 514/a> 
 L52">1 524/a>void 4a href="+code=pinctrl_dt_free_maps" class="sref">pinctrl_dt_free_maps4/a>(struct 4a href="+code=pinctrl" class="sref">pinctrl4/a> *4a href="+code=p" class="sref">p4/a>) 
 L53">1 534/a>{ 
 L54">1 544/a>        struct 4a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map4/a> *4a href="+code=dt_map" class="sref">dt_map4/a>, *4a href="+code=n1" class="sref">n14/a>; 
 L55">1 554/a> 
 L56">1 564/a>        4a href="+code=list_for_each_entry_safe" class="sref">list_for_each_entry_safe4/a>(4a href="+code=dt_map" class="sref">dt_map4/a>, 4a href="+code=n1" class="sref">n14/a>, &4a href="+code=p" class="sref">p4/a>->4a href="+code=dt_maps" class="sref">dt_maps4/a>, 4a href="+code=node" class="sref">node4/a>) { 
 L57">1 574/a>                4a href="+code=pinctrl_unregister_map" class="sref">pinctrl_unregister_map4/a>(4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=map" class="sref">map4/a>); 
 L58">1 584/a>                4a href="+code=list_del" class="sref">list_del4/a>(&4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=node" class="sref">node4/a>); 
 L59">1 594/a>                4a href="+code=dt_free_map" class="sref">dt_free_map4/a>(4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=pctldev" class="sref">pctldev4/a>, 4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=map" class="sref">map4/a>, 
 L60">1 604/a>                            4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=num_maps" class="sref">num_maps4/a>); 
 L61">1 614/a>                4a href="+code=kfree" class="sref">kfree4/a>(4a href="+code=dt_map" class="sref">dt_map4/a>); 
 L62">1 624/a>        } 
 L63">1 634/a> 
 L64">1 644/a>        4a href="+code=of_node_put" class="sref">of_node_put4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>->4a href="+code=of_node" class="sref">of_node4/a>); 
 L65">1 654/a>} 
 L66">1 664/a> 
 L67">1 674/a>static int 4a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map4/a>(struct 4a href="+code=pinctrl" class="sref">pinctrl4/a> *4a href="+code=p" class="sref">p4/a>, const char *4a href="+code=statenam>" class="sref">statenam>4/a>, 
 L68">1 684/a>                                   struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=pctldev" class="sref">pctldev4/a>, 
 L69">1 694/a>                                   struct 4a href="+code=pinctrl_map" class="sref">pinctrl_map4/a> *4a href="+code=map" class="sref">map4/a>, unsigned 4a href="+code=num_maps" class="sref">num_maps4/a>) 
 L70">1 704/a>{ 
 L71">1 714/a>        int 4a href="+code=i" class="sref">i4/a>; 
 L72">1 724/a>        struct 4a href="+code=pinctrl_dt_map" class="sref">pinctrl_dt_map4/a> *4a href="+code=dt_map" class="sref">dt_map4/a>; 
 L73">1 734/a> 
 L74">1 744/a>        4spa> class="comment">/* Initialize common mapping table entry fields */4/spa>
 
 L75">1 754/a>        for (4a href="+code=i" class="sref">i4/a> = 0; 4a href="+code=i" class="sref">i4/a> < 4a href="+code=num_maps" class="sref">num_maps4/a>; 4a href="+code=i" class="sref">i4/a>++) { 
 L76">1 764/a>                4a href="+code=map" class="sref">map4/a>[4a href="+code=i" class="sref">i4/a>].4a href="+code=dev_nam>" class="sref">dev_nam>4/a> = 4a href="+code=dev_nam>" class="sref">dev_nam>4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>); 
 L77">1 774/a>                4a href="+code=map" class="sref">map4/a>[4a href="+code=i" class="sref">i4/a>].4a href="+code=nam>" class="sref">nam>4/a> = 4a href="+code=statenam>" class="sref">statenam>4/a>; 
 L78">1 784/a>                if (4a href="+code=pctldev" class="sref">pctldev4/a>) 
 L79">1 794/a>                        4a href="+code=map" class="sref">map4/a>[4a href="+code=i" class="sref">i4/a>].4a href="+code=ctrl_dev_nam>" class="sref">ctrl_dev_nam>4/a> = 4a href="+code=dev_nam>" class="sref">dev_nam>4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>->4a href="+code=dev" class="sref">dev4/a>); 
 L80">1 804/a>        } 
 L81">1 814/a> 
 L82">1 824/a>        4spa> class="comment">/* Remember the converted mapping table entries */4/spa>
 
 L83">1 834/a>        4a href="+code=dt_map" class="sref">dt_map4/a> = 4a href="+code=kzalloc" class="sref">kzalloc4/a>(sizeof(*4a href="+code=dt_map" class="sref">dt_map4/a>), 4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>); 
 L84">1 844/a>        if (!4a href="+code=dt_map" class="sref">dt_map4/a>) { 
 L85">1 854/a>                4a href="+code=dev_err" class="sref">dev_err4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 4spa> class="string">"failed to alloc struct pinctrl_dt_map\n"
); 
 L86">1 864/a>                4a href="+code=dt_free_map" class="sref">dt_free_map4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>, 4a href="+code=map" class="sref">map4/a>, 4a href="+code=num_maps" class="sref">num_maps4/a>); 
 L87">1 874/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>; 
 L88">1 884/a>        } 
 L89">1 894/a> 
 L90">1 904/a>        4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=pctldev" class="sref">pctldev4/a> = 4a href="+code=pctldev" class="sref">pctldev4/a>; 
 L91">1 914/a>        4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=map" class="sref">map4/a> = 4a href="+code=map" class="sref">map4/a>; 
 L92">1 924/a>        4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=num_maps" class="sref">num_maps4/a> = 4a href="+code=num_maps" class="sref">num_maps4/a>; 
 L93">1 934/a>        4a href="+code=list_add_tail" class="sref">list_add_tail4/a>(&4a href="+code=dt_map" class="sref">dt_map4/a>->4a href="+code=node" class="sref">node4/a>, &4a href="+code=p" class="sref">p4/a>->4a href="+code=dt_maps" class="sref">dt_maps4/a>); 
 L94">1 944/a> 
 L95">1 954/a>        return 4a href="+code=pinctrl_register_map" class="sref">pinctrl_register_map4/a>(4a href="+code=map" class="sref">map4/a>, 4a href="+code=num_maps" class="sref">num_maps4/a>, 4a href="+code=false" class="sref">false4/a>, 4a href="+code=true" class="sref">true4/a>); 
 L96">1 964/a>} 
 L97">1 974/a> 
 L98">1 984/a>static struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=find_pinctrl_by_of_node" class="sref">find_pinctrl_by_of_node4/a>(struct 4a href="+code=device_node" class="sref">device_node4/a> *4a href="+code=np" class="sref">np4/a>) 
 L99">1 994/a>{ 
 L100">11004/a>        struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=pctldev" class="sref">pctldev4/a>; 
 L101">11014/a> 
 L102">11024/a>        4a href="+code=list_for_each_entry" class="sref">list_for_each_entry4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>, &4a href="+code=pinctrldev_list" class="sref">pinctrldev_list4/a>, 4a href="+code=node" class="sref">node4/a>) 
 L103">11034/a>                if (4a href="+code=pctldev" class="sref">pctldev4/a>->4a href="+code=dev" class="sref">dev4/a>->4a href="+code=of_node" class="sref">of_node4/a> == 4a href="+code=np" class="sref">np4/a>) 
 L104">11044/a>                        return 4a href="+code=pctldev" class="sref">pctldev4/a>; 
 L105">11054/a> 
 L106">11064/a>        return 4a href="+code=NULL" class="sref">NULL4/a>; 
 L107">11074/a>} 
 L108">11084/a> 
 L109">11094/a>static int 4a href="+code=dt_to_map_one_config" class="sref">dt_to_map_one_config4/a>(struct 4a href="+code=pinctrl" class="sref">pinctrl4/a> *4a href="+code=p" class="sref">p4/a>, const char *4a href="+code=statenam>" class="sref">statenam>4/a>, 
 L110">11104/a>                                struct 4a href="+code=device_node" class="sref">device_node4/a> *4a href="+code=np_config" class="sref">np_config4/a>) 
 L111">11114/a>{ 
 L112">11124/a>        struct 4a href="+code=device_node" class="sref">device_node4/a> *4a href="+code=np_pctldev" class="sref">np_pctldev4/a>; 
 L113">11134/a>        struct 4a href="+code=pinctrl_dev" class="sref">pinctrl_dev4/a> *4a href="+code=pctldev" class="sref">pctldev4/a>; 
 L114">11144/a>        struct 4a href="+code=pinctrl_ops" class="sref">pinctrl_ops4/a> *4a href="+code=ops" class="sref">ops4/a>; 
 L115">11154/a>        int 4a href="+code=ret" class="sref">ret4/a>; 
 L116">11164/a>        struct 4a href="+code=pinctrl_map" class="sref">pinctrl_map4/a> *4a href="+code=map" class="sref">map4/a>; 
 L117">11174/a>        unsigned 4a href="+code=num_maps" class="sref">num_maps4/a>; 
 L118">11184/a> 
 L119">11194/a>        4spa> class="comment">/* Find the pin controller containing np_config */4/spa>
 
 L120">11204/a>        4a href="+code=np_pctldev" class="sref">np_pctldev4/a> = 4a href="+code=of_node_get" class="sref">of_node_get4/a>(4a href="+code=np_config" class="sref">np_config4/a>); 
 L121">11214/a>        for (;;) { 
 L122">11224/a>                4a href="+code=np_pctldev" class="sref">np_pctldev4/a> = 4a href="+code=of_get_next_parent" class="sref">of_get_next_parent4/a>(4a href="+code=np_pctldev" class="sref">np_pctldev4/a>); 
 L123">11234/a>                if (!4a href="+code=np_pctldev" class="sref">np_pctldev4/a> || 4a href="+code=of_node_is_root" class="sref">of_node_is_root4/a>(4a href="+code=np_pctldev" class="sref">np_pctldev4/a>)) { 
 L124">11244/a>                        4a href="+code=dev_info" class="sref">dev_info4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 4spa> class="string">"could not find pctldevpfor nodep%s, deferring probe\n"
, 
 L125">11254/a>                                4a href="+code=np_config" class="sref">np_config4/a>->4a href="+code=full_nam>" class="sref">full_nam>4/a>); 
 L126">11264/a>                        4a href="+code=of_node_put" class="sref">of_node_put4/a>(4a href="+code=np_pctldev" class="sref">np_pctldev4/a>); 
 L127">11274/a>                        4spa> class="comment">/* OK let's just assume this will appear later then */4/spa>
 
 L128">11284/a>                        return -4a href="+code=EPROBE_DEFER" class="sref">EPROBE_DEFER4/a>; 
 L129">11294/a>                } 
 L130">11304/a>                4a href="+code=pctldev" class="sref">pctldev4/a> = 4a href="+code=find_pinctrl_by_of_node" class="sref">find_pinctrl_by_of_node4/a>(4a href="+code=np_pctldev" class="sref">np_pctldev4/a>); 
 L131">11314/a>                if (4a href="+code=pctldev" class="sref">pctldev4/a>) 
 L132">11324/a>                        break; 
 L133">11334/a>        } 
 L134">11344/a>        4a href="+code=of_node_put" class="sref">of_node_put4/a>(4a href="+code=np_pctldev" class="sref">np_pctldev4/a>); 
 L135">11354/a> 
 L136">11364/a>        4spa> class="comment">/*4/spa>
 
 L137">11374/a>4spa> class="comment">         * Call pinctrl driver to parse device tree node, and4/spa>
 
 L138">11384/a>4spa> class="comment">         * generate mapping table entries4/spa>
 
 L139">11394/a>4spa> class="comment">         */4/spa>
 
 L140">11404/a>        4a href="+code=ops" class="sref">ops4/a> = 4a href="+code=pctldev" class="sref">pctldev4/a>->4a href="+code=desc" class="sref">desc4/a>->4a href="+code=pctlops" class="sref">pctlops4/a>; 
 L141">11414/a>        if (!4a href="+code=ops" class="sref">ops4/a>->4a href="+code=dt_node_to_map" class="sref">dt_node_to_map4/a>) { 
 L142">11424/a>                4a href="+code=dev_err" class="sref">dev_err4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 4spa> class="string">"pctldevp%s doesn't support DT\n"
, 
 L143">11434/a>                        4a href="+code=dev_nam>" class="sref">dev_nam>4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>->4a href="+code=dev" class="sref">dev4/a>)); 
 L144">11444/a>                return -4a href="+code=ENODEV" class="sref">ENODEV4/a>; 
 L145">11454/a>        } 
 L146">11464/a>        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=dt_node_to_map" class="sref">dt_node_to_map4/a>(4a href="+code=pctldev" class="sref">pctldev4/a>, 4a href="+code=np_config" class="sref">np_config4/a>, &4a href="+code=map" class="sref">map4/a>, &4a href="+code=num_maps" class="sref">num_maps4/a>); 
 L147">11474/a>        if (4a href="+code=ret" class="sref">ret4/a> < 0) 
 L148">11484/a>                return 4a href="+code=ret" class="sref">ret4/a>; 
 L149">11494/a> 
 L150">11504/a>        4spa> class="comment">/* Stash the mapping table chunk awaypfor later use */4/spa>
 
 L151">11514/a>        return 4a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map4/a>(4a href="+code=p" class="sref">p4/a>, 4a href="+code=statenam>" class="sref">statenam>4/a>, 4a href="+code=pctldev" class="sref">pctldev4/a>, 4a href="+code=map" class="sref">map4/a>, 4a href="+code=num_maps" class="sref">num_maps4/a>); 
 L152">11524/a>} 
 L153">11534/a> 
 L154">11544/a>static int 4a href="+code=dt_remember_dummy_state" class="sref">dt_remember_dummy_state4/a>(struct 4a href="+code=pinctrl" class="sref">pinctrl4/a> *4a href="+code=p" class="sref">p4/a>, const char *4a href="+code=statenam>" class="sref">statenam>4/a>) 
 L155">11554/a>{ 
 L156">11564/a>        struct 4a href="+code=pinctrl_map" class="sref">pinctrl_map4/a> *4a href="+code=map" class="sref">map4/a>; 
 L157">11574/a> 
 L158">11584/a>        4a href="+code=map" class="sref">map4/a> = 4a href="+code=kzalloc" class="sref">kzalloc4/a>(sizeof(*4a href="+code=map" class="sref">map4/a>), 4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>); 
 L159">11594/a>        if (!4a href="+code=map" class="sref">map4/a>) { 
 L160">11604/a>                4a href="+code=dev_err" class="sref">dev_err4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 4spa> class="string">"failed to alloc struct pinctrl_map\n"
); 
 L161">11614/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>; 
 L162">11624/a>        } 
 L163">11634/a> 
 L164">11644/a>        4spa> class="comment">/* There is no pctldevpfor PIN_MAP_TYPE_DUMMY_STATE */4/spa>
 
 L165">11654/a>        4a href="+code=map" class="sref">map4/a>->4a href="+code=typ>" class="sref">typ>4/a> = 4a href="+code=PIN_MAP_TYPE_DUMMY_STATE" class="sref">PIN_MAP_TYPE_DUMMY_STATE4/a>; 
 L166">11664/a> 
 L167">11674/a>        return 4a href="+code=dt_remember_or_free_map" class="sref">dt_remember_or_free_map4/a>(4a href="+code=p" class="sref">p4/a>, 4a href="+code=statenam>" class="sref">statenam>4/a>, 4a href="+code=NULL" class="sref">NULL4/a>, 4a href="+code=map" class="sref">map4/a>, 1); 
 L168">11684/a>} 
 L169">11694/a> 
 L170">11704/a>int 4a href="+code=pinctrl_dt_to_map" class="sref">pinctrl_dt_to_map4/a>(struct 4a href="+code=pinctrl" class="sref">pinctrl4/a> *4a href="+code=p" class="sref">p4/a>) 
 L171">11714/a>{ 
 L172">11724/a>        struct 4a href="+code=device_node" class="sref">device_node4/a> *4a href="+code=np" class="sref">np4/a> = 4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>->4a href="+code=of_node" class="sref">of_node4/a>; 
 L173">11734/a>        int 4a href="+code=state" class="sref">state4/a>, 4a href="+code=ret" class="sref">ret4/a>; 
 L174">11744/a>        char *4a href="+code=propnam>" class="sref">propnam>4/a>; 
 L175">11754/a>        struct 4a href="+code=property" class="sref">property4/a> *4a href="+code=prop" class="sref">prop4/a>; 
 L176">11764/a>        const char *4a href="+code=statenam>" class="sref">statenam>4/a>; 
 L177">11774/a>        const 4a href="+code=__be32" class="sref">__be324/a> *4a href="+code=list" class="sref">list4/a>; 
 L178">11784/a>        int 4a href="+code=size" class="sref">size4/a>, 4a href="+code=config" class="sref">config4/a>; 
 L179">11794/a>        4a href="+code=phandl>" class="sref">phandl>4/a> 4a href="+code=phandl>" class="sref">phandl>4/a>; 
 L180">11804/a>        struct 4a href="+code=device_node" class="sref">device_node4/a> *4a href="+code=np_config" class="sref">np_config4/a>; 
 L181">11814/a> 
 L182">11824/a>        4spa> class="comment">/* CONFIG_OF enabled, p->devpnot instantiated from DT */4/spa>
 
 L183">11834/a>        if (!4a href="+code=np" class="sref">np4/a>) { 
 L184">11844/a>                4a href="+code=dev_dbg" class="sref">dev_dbg4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 4spa> class="string">"no of_node;pnot parsing pinctrl DT\n"
); 
 L185">11854/a>                return 0; 
 L186">11864/a>        } 
 L187">11874/a> 
 L188">11884/a>        4spa> class="comment">/* We may store pointers to property nam>s within the nodep*/4/spa>
 
 L189">11894/a>        4a href="+code=of_node_get" class="sref">of_node_get4/a>(4a href="+code=np" class="sref">np4/a>); 
 L190">11904/a> 
 L191">11914/a>        4spa> class="comment">/* For each defined state IDp*/4/spa>
 
 L192">11924/a>        for (4a href="+code=state" class="sref">state4/a> = 0; ; 4a href="+code=state" class="sref">state4/a>++) { 
 L193">11934/a>                4spa> class="comment">/* Retrieve the pinctrl-* property */4/spa>
 
 L194">11944/a>                4a href="+code=propnam>" class="sref">propnam>4/a> = 4a href="+code=kasprintf" class="sref">kasprintf4/a>(4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>, 4spa> class="string">"pinctrl-%d"
, 4a href="+code=state" class="sref">state4/a>); 
 L195">11954/a>                4a href="+code=prop" class="sref">prop4/a> = 4a href="+code=of_find_property" class="sref">of_find_property4/a>(4a href="+code=np" class="sref">np4/a>, 4a href="+code=propnam>" class="sref">propnam>4/a>, &4a href="+code=size" class="sref">size4/a>); 
 L196">11964/a>                4a href="+code=kfree" class="sref">kfree4/a>(4a href="+code=propnam>" class="sref">propnam>4/a>); 
 L197">11974/a>                if (!4a href="+code=prop" class="sref">prop4/a>) 
 L198">11984/a>                        break; 
 L199">11994/a>                4a href="+code=list" class="sref">list4/a> = 4a href="+code=prop" class="sref">prop4/a>->4a href="+code=value" class="sref">value4/a>; 
 L200">12004/a>                4a href="+code=size" class="sref">size4/a> /= sizeof(*4a href="+code=list" class="sref">list4/a>); 
 L201">12014/a> 
 L202">12024/a>                4spa> class="comment">/* Determine whether pinctrl-nam>s property nam>s the state */4/spa>
 
 L203">12034/a>                4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=of_property_read_string_index" class="sref">of_property_read_string_index4/a>(4a href="+code=np" class="sref">np4/a>, 4spa> class="string">"pinctrl-nam>s"
, 
 L204">12044/a>                                                    4a href="+code=state" class="sref">state4/a>, &4a href="+code=statenam>" class="sref">statenam>4/a>); 
 L205">12054/a>                4spa> class="comment">/*4/spa>
 
 L206">12064/a>4spa> class="comment">                 * Ifpnot, statenam> is just the integer state ID. But rather4/spa>
 
 L207">12074/a>4spa> class="comment">                 * tha> dynamically allocate it and have to free it later,4/spa>
 
 L208">12084/a>4spa> class="comment">                 * just point part waypinto the property nam> for the string.4/spa>
 
 L209">12094/a>4spa> class="comment">                 */4/spa>
 
 L210">12104/a>                if (4a href="+code=ret" class="sref">ret4/a> < 0) { 
 L211">12114/a>                        4spa> class="comment">/* strlen("pinctrl-") == 8 */4/spa>
 
 L212">12124/a>                        4a href="+code=statenam>" class="sref">statenam>4/a> = 4a href="+code=prop" class="sref">prop4/a>->4a href="+code=nam>" class="sref">nam>4/a> + 8; 
 L213">12134/a>                } 
 L214">12144/a> 
 L215">12154/a>                4spa> class="comment">/* For every referenced pin configuration nodepin it */4/spa>
 
 L216">12164/a>                for (4a href="+code=config" class="sref">config4/a> = 0; 4a href="+code=config" class="sref">config4/a> < 4a href="+code=size" class="sref">size4/a>; 4a href="+code=config" class="sref">config4/a>++) { 
 L217">12174/a>                        4a href="+code=phandl>" class="sref">phandl>4/a> = 4a href="+code=be32_to_cpup" class="sref">be32_to_cpup4/a>(4a href="+code=list" class="sref">list4/a>++); 
 L218">12184/a> 
 L219">12194/a>                        4spa> class="comment">/* Look up the pin configuration nodep*/4/spa>
 
 L220">12204/a>                        4a href="+code=np_config" class="sref">np_config4/a> = 4a href="+code=of_find_node_by_phandl>" class="sref">of_find_node_by_phandl>4/a>(4a href="+code=phandl>" class="sref">phandl>4/a>); 
 L221">12214/a>                        if (!4a href="+code=np_config" class="sref">np_config4/a>) { 
 L222">12224/a>                                4a href="+code=dev_err" class="sref">dev_err4/a>(4a href="+code=p" class="sref">p4/a>->4a href="+code=dev" class="sref">dev4/a>, 
 L223">12234/a>                                        4spa> class="string">"propp%s indexp%i invalid phandl>\n"
, 
 L224">12244/a>                                        4a href="+code=prop" class="sref">prop4/a>->4a href="+code=nam>" class="sref">nam>4/a>, 4a href="+code=config" class="sref">config4/a>); 
 L225">12254/a>                                4a href="+code=ret" class="sref">ret4/a> = -4a href="+code=EINVAL" class="sref">EINVAL4/a>; 
 L226">12264/a>                                goto 4a href="+code=err" class="sref">err4/a>; 
 L227">12274/a>                        } 
 L228">12284/a> 
 L229">12294/a>                        4spa> class="comment">/* Parse the nodep*/4/spa>
 
 L230">12304/a>                        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=dt_to_map_one_config" class="sref">dt_to_map_one_config4/a>(4a href="+code=p" class="sref">p4/a>, 4a href="+code=statenam>" class="sref">statenam>4/a>, 4a href="+code=np_config" class="sref">np_config4/a>); 
 L231">12314/a>                        4a href="+code=of_node_put" class="sref">of_node_put4/a>(4a href="+code=np_config" class="sref">np_config4/a>); 
 L232">12324/a>                        if (4a href="+code=ret" class="sref">ret4/a> < 0) 
 L233">12334/a>                                goto 4a href="+code=err" class="sref">err4/a>; 
 L234">12344/a>                } 
 L235">12354/a> 
 L236">12364/a>                4spa> class="comment">/* No entries in DT? Generate a dummy state table entry */4/spa>
 
 L237">12374/a>                if (!4a href="+code=size" class="sref">size4/a>) { 
 L238">12384/a>                        4a href="+code=ret" class="sref">ret4/a> = 4a href="+code=dt_remember_dummy_state" class="sref">dt_remember_dummy_state4/a>(4a href="+code=p" class="sref">p4/a>, 4a href="+code=statenam>" class="sref">statenam>4/a>); 
 L239">12394/a>                        if (4a href="+code=ret" class="sref">ret4/a> < 0) 
 L240">12404/a>                                goto 4a href="+code=err" class="sref">err4/a>; 
 L241">12414/a>                } 
 L242">12424/a>        } 
 L243">12434/a> 
 L244">12444/a>        return 0; 
 L245">12454/a> 
 L246">12464/a>4a href="+code=err" class="sref">err4/a>: 
 L247">12474/a>        4a href="+code=pinctrl_dt_free_maps" class="sref">pinctrl_dt_free_maps4/a>(4a href="+code=p" class="sref">p4/a>); 
 L248">12484/a>        return 4a href="+code=ret" class="sref">ret4/a>; 
 L249">12494/a>} 
 L250">12504/a>
lxr.linux.no kindly hosted by Redpill Linpro AS4/a>, provider of Linux consulting and operations services since11995.