linux/drivers/mfd/abx500-core.c
<<
opti"v4/spaval "v4/formal "v4a opti"v href="../linux+v3 6.2/drivers/mfd/abx500-core.c">opti"v4img src="../.static/gfx/right.png" alt=">>">op4/spavalop4spav class="lxr_search">optiopti"v4input typ hidden" nam navtarget" > ">opti"v4input typ text" nam search" id search">opti"v4butt1" typ submit">Searchopti"vPrefsl "v4/a>op4/spavalti"v v4/divalti"v v4form acon v="ajax+*" method="post" onsubmit="return false;">op4input typ hidden" nam ajax_lookup" id ajax_lookup" > ">oti"v v4/formaloti"v v4div class="headingbott1m">l 4div id file_contents"a
v v14/a>4spav class="comment">/*4/spavalv v24/a>4spav class="comment"> * Copyright (C) 2007-2010 ST-Ericsson4/spavalv v34/a>4spav class="comment"> * License terms: GNU General Public License (GPL) vers11"
24/spavalv v44/a>4spav class="comment"> * Register access funcon vs for the ABX500 Mixed Signal IC family.4/spavalv v54/a>4spav class="comment"> * Author: Mattias Wallin <mattias.wallin@stericsson.com>4/spavalv v64/a>4spav class="comment"> */4/spavalv v74/a>ov v84/a>#include <linux/list.h4/a>>ov v94/a>#include <linux/slab.h4/a>>ov  #include <linux/err.h4/a>>ov 11opa>#include <linux/module.h4/a>>ov 12opa>#include <linux/mfd/abx500.h4/a>>ov 134/a>ov 144/a>staticv4a href="+code=LIST_HEAD" class="sref">LIST_HEAD4/a>(4a href="+code=abx500_list" class="sref">abx500_list4/a>);ov 154/a>ov 164/a>structv4a href="+code=abx500_device_entry" class="sref">abx500_device_entry4/a> {ov 174/a>        structv4a href="+code=list_head" class="sref">list_head4/a> 4a href="+code=list" class="sref">list4/a>;ov 184/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> 4a href="+code=ops" class="sref">ops4/a>;ov 194/a>        structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>;ov 2};ov 214/a>ov 224/a>staticvvoid 4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> **4a href="+code=ops" class="sref">ops4/a>)ov 234/a>{ov 244/a>        structv4a href="+code=abx500_device_entry" class="sref">abx500_device_entry4/a> *4a href="+code=dev_entry" class="sref">dev_entry4/a>;ov 254/a>ov 264/a>        *4a href="+code=ops" class="sref">ops4/a> =v4a href="+code=NULL" class="sref">NULL4/a>;ov 274/a>        4a href="+code=list_for_each_entry" class="sref">list_for_each_entry4/a>(4a href="+code=dev_entry" class="sref">dev_entry4/a>, &4a href="+code=abx500_list" class="sref">abx500_list4/a>, 4a href="+code=list" class="sref">list4/a>) {ov 284/a>                if (4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=dev" class="sref">dev4/a> ==v4a href="+code=dev" class="sref">dev4/a>) {ov 294/a>                        *4a href="+code=ops" class="sref">ops4/a> =v&4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=ops" class="sref">ops4/a>;ov 304/a>                        return;ov 314/a>                }ov 324/a>        }ov 334/a>}ov 344/a>ov 354/a>intv4a href="+code=abx500_register_ops" class="sref">abx500_register_ops4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>)ov 364/a>{ov 374/a>        structv4a href="+code=abx500_device_entry" class="sref">abx500_device_entry4/a> *4a href="+code=dev_entry" class="sref">dev_entry4/a>;ov 384/a>ov 394/a>        4a href="+code=dev_entry" class="sref">dev_entry4/a> =v4a href="+code=kzalloc" class="sref">kzalloc4/a>(sizeof(structv4a href="+code=abx500_device_entry" class="sref">abx500_device_entry4/a>), 4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>);ov 404/a>        if (!4a href="+code=dev_entry" class="sref">dev_entry4/a>) {ov 414/a>                4a href="+code=dev_err" class="sref">dev_err4/a>(4a href="+code=dev" class="sref">dev4/a>, 4spav class="string">"register_ops kzalloc failed"4/spava);ov 424/a>                return -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>;ov 434/a>        }ov 444/a>        4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=dev" class="sref">dev4/a> =v4a href="+code=dev" class="sref">dev4/a>;ov 454/a>        4a href="+code=memcpy" class="sref">memcpy4/a>(&4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=ops" class="sref">ops4/a>, 4a href="+code=ops" class="sref">ops4/a>, sizeof(structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a>));ov 464/a>ov 474/a>        4a href="+code=list_add_tail" class="sref">list_add_tail4/a>(&4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=list" class="sref">list4/a>, &4a href="+code=abx500_list" class="sref">abx500_list4/a>);ov 484/a>        return 0;ov 494/a>}ov 504/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_register_ops" class="sref">abx500_register_ops4/a>);ov 514/a>ov 524/a>void 4a href="+code=abx500_remove_ops" class="sref">abx500_remove_ops4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>)ov 534/a>{ov 544/a>        structv4a href="+code=abx500_device_entry" class="sref">abx500_device_entry4/a> *4a href="+code=dev_entry" class="sref">dev_entry4/a>, *4a href="+code=tmp" class="sref">tmp4/a>;ov 554/a>ov 564/a>        4a href="+code=list_for_each_entry_safe" class="sref">list_for_each_entry_safe4/a>(4a href="+code=dev_entry" class="sref">dev_entry4/a>, 4a href="+code=tmp" class="sref">tmp4/a>, &4a href="+code=abx500_list" class="sref">abx500_list4/a>, 4a href="+code=list" class="sref">list4/a>)ov 574/a>        {ov 584/a>                if (4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=dev" class="sref">dev4/a> ==v4a href="+code=dev" class="sref">dev4/a>) {ov 594/a>                        4a href="+code=list_del" class="sref">list_del4/a>(&4a href="+code=dev_entry" class="sref">dev_entry4/a>->4a href="+code=list" class="sref">list4/a>);ov 604/a>                        4a href="+code=kfree" class="sref">kfree4/a>(4a href="+code=dev_entry" class="sref">dev_entry4/a>);ov 614/a>                }ov 624/a>        }ov 634/a>}ov 644/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_remove_ops" class="sref">abx500_remove_ops4/a>);ov 654/a>ov 664/a>intv4a href="+code=abx500_set_register_interruptible" class="sref">abx500_set_register_interruptible4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bank" class="sref">bank4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=reg" class="sref">reg4/a>,ov 674/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=	  >
" class="sref">	  >
4/a>)ov 684/a>{ov 694/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov 704/a>ov 714/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov 724/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=set_register" class="sref">set_register4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov 734/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=set_register" class="sref">set_register4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=bank" class="sref">bank4/a>, 4a href="+code=reg" class="sref">reg4/a>, 4a href="+code=	  >
" class="sref">	  >
4/a>);ov 744/a>        elseov 754/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov 764/a>}ov 774/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_set_register_interruptible" class="sref">abx500_set_register_interruptible4/a>);ov 784/a>ov 794/a>intv4a href="+code=abx500_get_register_interruptible" class="sref">abx500_get_register_interruptible4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bank" class="sref">bank4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=reg" class="sref">reg4/a>,ov 804/a>        4a href="+code=u8" class="sref">u84/a> *4a href="+code=	  >
" class="sref">	  >
4/a>)ov 814/a>{ov 824/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov 834/a>ov 844/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov 854/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_register" class="sref">get_register4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov 864/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_register" class="sref">get_register4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=bank" class="sref">bank4/a>, 4a href="+code=reg" class="sref">reg4/a>, 4a href="+code=	  >
" class="sref">	  >
4/a>);ov 874/a>        elseov 884/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov 894/a>}ov 904/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_get_register_interruptible" class="sref">abx500_get_register_interruptible4/a>);ov 914/a>ov 924/a>intv4a href="+code=abx500_get_register_page_interruptible" class="sref">abx500_get_register_page_interruptible4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bank" class="sref">bank4/a>,ov 934/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=first_reg" class="sref">first_reg4/a>, 4a href="+code=u8" class="sref">u84/a> *4a href="+code=reg	  s" class="sref">reg	  s4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=numregs" class="sref">numregs4/a>)ov 944/a>{ov 954/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov 964/a>ov 974/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov 984/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_register_page" class="sref">get_register_page4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov 994/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_register_page" class="sref">get_register_page4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=bank" class="sref">bank4/a>,ov1004/a>                        4a href="+code=first_reg" class="sref">first_reg4/a>, 4a href="+code=reg	  s" class="sref">reg	  s4/a>, 4a href="+code=numregs" class="sref">numregs4/a>);ov1014/a>        elseov1024/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov1034/a>}ov1044/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_get_register_page_interruptible" class="sref">abx500_get_register_page_interruptible4/a>);ov1054/a>ov1064/a>intv4a href="+code=abx500_mask_and_set_register_interruptible" class="sref">abx500_mask_and_set_register_interruptible4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bank" class="sref">bank4/a>,ov1074/a>        4a href="+code=u8" class="sref">u84/a> 4a href="+code=reg" class="sref">reg4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bitmask" class="sref">bitmask4/a>, 4a href="+code=u8" class="sref">u84/a> 4a href="+code=bit	  >
s" class="sref">bit	  >
s4/a>)ov1084/a>{ov1094/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov1104/a>ov1114/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov1124/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=mask_and_set_register" class="sref">mask_and_set_register4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov1134/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=mask_and_set_register" class="sref">mask_and_set_register4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=bank" class="sref">bank4/a>,ov1144/a>                        4a href="+code=reg" class="sref">reg4/a>, 4a href="+code=bitmask" class="sref">bitmask4/a>, 4a href="+code=bit	  >
s" class="sref">bit	  >
s4/a>);ov1154/a>        elseov1164/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov1174/a>}ov1184/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_mask_and_set_register_interruptible" class="sref">abx500_mask_and_set_register_interruptible4/a>);ov1194/a>ov12intv4a href="+code=abx500_get_chip_id" class="sref">abx500_get_chip_id4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>)ov1214/a>{ov1224/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov1234/a>ov1244/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov1254/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_chip_id" class="sref">get_chip_id4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov1264/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=get_chip_id" class="sref">get_chip_id4/a>(4a href="+code=dev" class="sref">dev4/a>);ov1274/a>        elseov1284/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov1294/a>}ov1304/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_get_chip_id" class="sref">abx500_get_chip_id4/a>);ov1314/a>ov1324/a>intv4a href="+code=abx500_event_registers_startup_state_get" class="sref">abx500_event_registers_startup_state_get4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=u8" class="sref">u84/a> *4a href="+code=event" class="sref">event4/a>)ov1334/a>{ov1344/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov1354/a>ov1364/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov1374/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=event_registers_startup_state_get" class="sref">event_registers_startup_state_get4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov1384/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=event_registers_startup_state_get" class="sref">event_registers_startup_state_get4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=event" class="sref">event4/a>);ov1394/a>        elseov1404/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov1414/a>}ov1424/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_event_registers_startup_state_get" class="sref">abx500_event_registers_startup_state_get4/a>);ov1434/a>ov1444/a>intv4a href="+code=abx500_startup_irq_enabled" class="sref">abx500_startup_irq_enabled4/a>(structv4a href="+code=device" class="sref">device4/a> *4a href="+code=dev" class="sref">dev4/a>, unsigned intv4a href="+code=irq" class="sref">irq4/a>)ov1454/a>{ov1464/a>        structv4a href="+code=abx500_ops" class="sref">abx500_ops4/a> *4a href="+code=ops" class="sref">ops4/a>;ov1474/a>ov1484/a>        4a href="+code=lookup_ops" class="sref">lookup_ops4/a>(4a href="+code=dev" class="sref">dev4/a>->4a href="+code=parent" class="sref">parent4/a>, &4a href="+code=ops" class="sref">ops4/a>);ov1494/a>        if ((4a href="+code=ops" class="sref">ops4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>) && (4a href="+code=ops" class="sref">ops4/a>->4a href="+code=startup_irq_enabled" class="sref">startup_irq_enabled4/a> !=v4a href="+code=NULL" class="sref">NULL4/a>))ov1504/a>                return 4a href="+code=ops" class="sref">ops4/a>->4a href="+code=startup_irq_enabled" class="sref">startup_irq_enabled4/a>(4a href="+code=dev" class="sref">dev4/a>, 4a href="+code=irq" class="sref">irq4/a>);ov1514/a>        elseov1524/a>                return -4a href="+code=ENOTSUPP" class="sref">ENOTSUPP4/a>;ov1534/a>}ov1544/a>4a href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOL4/a>(4a href="+code=abx500_startup_irq_enabled" class="sref">abx500_startup_irq_enabled4/a>);ov1554/a>ov1564/a>4a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR4/a>(4spav class="string">"Mattias Wallin <mattias.wallin@stericsson.com>"4/spava);ov1574/a>4a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION4/a>(4spav class="string">"ABX500 core driver"4/spava);ov1584/a>4a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE4/a>(4spav class="string">"GPL"4/spava);ov1594/a>
The original LXR software by the LXR community4/a>, this experimental vers11" by lxr@linux.no4/a>. 4/dival4div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS4/a>, provider of Linux consulting and operaon vs services since 1995. 4/dival 4/bodyal4/htmlal