val.32/spa v .32/form v .32a val.3 href="../linux+v3.6.2/Documenta > /leds/leds-lp5521.txt"> val.32img src="../.sta >c/gfx/right.png" alt=">>"> v2/spa v v2spa class="lxr_search"> val ="+search" method="post" onsubmit="return do_search(this);"> val.32input typ> hidden" nam> navtarget" tion> "> val.32input typ> text" nam> search" id search"> val.32butt/optyp> submit">Search val.3Prefsv .32/a> v2/spa val.3 32/div val.3 32form ac > ="ajax+*" method="post" onsubmit="return false;"> v2input typ> hidden" nam> ajax_lookup" id ajax_lookup" tion> "> al.3 32/form v al.3 32div class="headingbott/m">
L1">3 312/a>Kernel driver for lp5521 L2">3 322/a>======================== L3">3 332/a> L4">3 342/a>* Na > al Semiconductor LP5521 led driver chip L5">3 352/a>* Datasheet:32a href=" >"> >> L6">3 362/a> L7">3 372/a>Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo L8">3 382/a>Contac : Samu Onkalo ( L9">3 392/a> L10">3 10" a>Descri > L11">3 112/a>----------- L12">3 122/a> L13">3 132/a>LP5521 ca drive up to 3 channels. Leds ca be controlled directly via L14">3 142/a>the led class control interface. Channels have generic nam>s: L15">3 152/a>lp5521:channelx, where x is 0 .. 2 L16">3 162/a> L17">3 172/a>All three channels ca be also controlled using the engine micro programs. L18">3 182/a>More details of the instruc > s ca be found from the public data sheet. L19">3 192/a> L20">3 202/a>Control interface for the engines: L21">3 212/a>x is 1 .. 3 L22">3 222/a>enginex_mode : disabled, load, ru L23">3 232/a>enginex_load : store program (visible only in engine load mode) L24">3 242/a> L25">3 252/a>Example (start to blink the channel 2 led): L26">3 262/a>cd3 3/sys/class/leds/lp5521:channel2/device L27">3 272/a>echo "load" > engine3_mode L28">3 282/a>echo "037f4d0003ff6000" > engine3_load L29">3 292/a>echo "ru " > engine3_mode L30">3 302/a> L31">3 312/a>stop the engine: L32">3 322/a>echo "disabled" > engine3_mode L33">3 332/a> L34">3 342/a>sysfs contains a selftest entry. L35">3 352/a>The test communicates with the chip and checks that L36">3 362/a>the clock mode is automa >cally set to the requested one. L37">3 372/a> L38">3 382/a>Each channel has its own led current settings. L39">3 392/a>/sys/class/leds/lp5521:channel0/led_current - RW L40">3 402/a>/sys/class/leds/lp5521:channel0/max_current - RO L41">3 412/a>Forma : 10x mA i.e 10 means 1.0 mA L42">3 422/a> L43">3 432/a>example platform data: L44">3 442/a> L45">3 452/a>Note: chan_nr ca have tion>s between 0 and 2. L46">3 462/a>The nam> of each channel ca be configurable. L47">3 472/a>If the nam> field is not defined, the default nam> will be set to 'xxxx:channelN' L48">3 482/a>(XXXX : pdata->label or i2c client nam>, N : channel number) L49">3 492/a> L50">3 502/a>sta >c struc lp5521_led_config lp5521_led_config[] = { L51">3 512/a> { L52">3 522/a> .nam> = "red", L53">3 532/a> .chan_nr = 0, L54">3 542/a> .led_current = 50, L55">3 552/a> .max_current = 130, L56">3 562/a> }, { L57">3 572/a> .nam> = "green", L58">3 582/a> .chan_nr = 1, L59">3 592/a> .led_current = 0, L60">3 602/a> .max_current = 130, L61">3 612/a> }, { L62">3 622/a> .nam> = "bon>", L63">3 632/a> .chan_nr = 2, L64">3 642/a> .led_current = 0, L65">3 652/a> .max_current = 130, L66">3 662/a> } L67">3 672/a>}; L68">3 682/a> L69">3 692/a>sta >c in lp5521_setup(void) L70">3 702/a>{ L71">3 712/a> /* setup HW resourc>s */ L72">3 722/a>} L73">3 732/a> L74">3 742/a>sta >c void lp5521_release(void) L75">3 752/a>{ L76">3 762/a> /* Release HW resourc>s */ L77">3 772/a>} L78">3 782/a> L79">3 792/a>sta >c void lp5521_enable(bool sta e) L80">3 802/a>{ L81">3 812/a> /* Control of chip enable sig al */ L82">3 822/a>} L83">3 832/a> L84">3 842/a>sta >c struc lp5521_platform_data lp5521_platform_data = { L85">3 852/a> .led_config = lp5521_led_config, L86">3 862/a> .num_channels = ARRAY_SIZE(lp5521_led_config), L87">3 872/a> .clock_mode = LP5521_CLOCK_EXT, L88">3 882/a> .setup_resourc>s = lp5521_setup, L89">3 892/a> .release_resourc>s = lp5521_release, L90">3 902/a> .enable = lp5521_enable, L91">3 912/a>}; L92">3 922/a> L93">3 932/a>If the current is set to 0 in the platform data, that channel is L94">3 942/a>disabled and it is not visible in the sysfs. L95">3 952/a> L96">3 962/a>The 'update_config' : CONFIG register (ADDR 08h) L97">3 972/a>This tion> is platform-specific data. L98">3 982/a>If update_config is not defined, the CONFIG register is set with L99">3 992/a>'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'. L100">31002/a>(Enable auto-powersave, set charge pump to auto, red to battery) L101">31012/a> L102">31022/a>example of update_config : L103">31032/a> L104">31042/a>#define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \ L105">31052/a> LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \ L106">31062/a> LP5521_CLK_INT) L107">31072/a> L108">31082/a>sta >c struc lp5521_platform_data lp5521_pdata = { L109">31092/a> .led_config = lp5521_led_config, L110">31102/a> .num_channels = ARRAY_SIZE(lp5521_led_config), L111">31112/a> .clock_mode = LP5521_CLOCK_INT, L112">31122/a> .update_config = LP5521_CONFIGS, L113">31132/a>}; L114">31142/a> L115">31152/a>LED patterns : LP5521 has autonomous opera > without external control. L116">31162/a>Pattern data ca be defined in the platform data. L117">31172/a> L118">31182/a>example of led pattern data : L119">31192/a> L120">31202/a>/* RGB(50,5,0) 500ms on, 500ms off, infinite loop */ L121">31212/a>sta >c u8 pattern_red[] = { L122">31222/a> 0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, L123">31232/a> }; L124">31242/a> L125">31252/a>sta >c u8 pattern_green[] = { L126">31262/a> 0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, L127">31272/a> }; L128">31282/a> L129">31292/a>sta >c struc lp5521_led_pattern board_led_patterns[] = { L130">31302/a> { L131">31312/a> .r = pattern_red, L132">31322/a> .g = pattern_green, L133">31332/a> .size_r = ARRAY_SIZE(pattern_red), L134">31342/a> .size_g = ARRAY_SIZE(pattern_green), L135">31352/a> }, L136">31362/a>}; L137">31372/a> L138">31382/a>sta >c struc lp5521_platform_data lp5521_platform_data = { L139">31392/a> .led_config = lp5521_led_config, L140">31402/a> .num_channels = ARRAY_SIZE(lp5521_led_config), L141">31412/a> .clock_mode = LP5521_CLOCK_EXT, L142">31422/a> .patterns = board_led_patterns, L143">31432/a> .num_patterns = ARRAY_SIZE(board_led_patterns), L144">31442/a>}; L145">31452/a> L146">31462/a>Then predefined led pattern(s) ca be executed via the sysfs. L147">31472/a>To start the pattern #1, L148">31482/a># echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern L149">31492/a>(xxxx : i2c bus & slave address) L150">31502/a>To end the pattern, L151">31512/a># echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern L152">31522/a>
The original LXR software by the LXR community2/a>, this experimental vers> by lxr@linux.no2/a>. 2/div v2div class="subfooter"> kindly hosted by Redpill Linpro AS2/a>, provider of Linux consulting and opera > s services since 1995. 2/div v 2/body v2/html v