Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2933844pxb; Sat, 6 Feb 2021 13:00:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPBYy3pjWACLoravfxxlpsMV2PY9oAtcACEZ4YLZR7dGs5JWYjwQfaO29AIUSBHlwPA4yq X-Received: by 2002:aa7:c396:: with SMTP id k22mr8258143edq.284.1612645225559; Sat, 06 Feb 2021 13:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612645225; cv=none; d=google.com; s=arc-20160816; b=ohP+BpRFt9hGZ8E/5ahGXt1839VQ4SXeu/F3iT0xzur96fpmEmp0EleGoCrlPB+r9P tzPG0B/dPdmcTgcq0X4u8RUeeV43FMTdNqduKse/UEOqKDMI3c5bITFVqBF7/YHT/vPn s4IxUrNiOf400U/Sl+Z5gVoEgSn8sE0HMXk3MFOvrBPPfbz+cm4U1wykrXpBYuHN7zhV gZJ2uxgiG8HaRH0lzE9pfemYYlbRKS9602VjtmzIeafibw8NISw/D4mYSgfkLzBbmqXY BRdHmvjoXd+J3GvyDtp9M564vpyUYr8kPI7NbKLZio4IuHgtuN5c47vUGS2w0UYGITeT VRgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=fODc4Y13jnUgYFxRk0/SlJ0oEOTVWjVViI6j6TXwrmA=; b=oSEdJosm3p2atG1T/Zp6fynWMPAjrz/qQWfcFTrerRi4nboJ5Ah1bwLwxfxSX9TydO f/7dXfhswUh9geKZ4oKww5DxagkfJMDHJqyzqZOQ2bPSa8NODe9ndS34aowVRMYdBhvQ yKPDveMkF67Bovjz7bSNnZp+FSvb3+zoClDkktU6jEL2koriJXA3W+9pyZQIHG5mLeNU U9eEr+dMDh2UkASpDxG5OyUiduLm1VLUcsYsu8T2SoYKqYw2vtj12981P89ThYNebLd6 1PU7I0ZdOtYYslfUw/fepTT5mCjlHcoyn8TOH4GNne/vCYRKQMpwFggb73jedbOwsaIS XnUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="i+BNW/3l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si7814689ejc.561.2021.02.06.13.00.00; Sat, 06 Feb 2021 13:00:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="i+BNW/3l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbhBFU7Y (ORCPT + 99 others); Sat, 6 Feb 2021 15:59:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbhBFU7X (ORCPT ); Sat, 6 Feb 2021 15:59:23 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E49EC06174A; Sat, 6 Feb 2021 12:58:43 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id s18so11750383ljg.7; Sat, 06 Feb 2021 12:58:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=fODc4Y13jnUgYFxRk0/SlJ0oEOTVWjVViI6j6TXwrmA=; b=i+BNW/3lPIn8qBEL4dJSYVVoNBe4G3m2fgH7TV4qRli2Y4zuXfrL3ikjrrJSXN9QOV /jx3qFgEgkW+O7Gl44iV8Vi3upllIZM4E2ARLbwYwztquYKNqOGjsor5pdhM8G8dx1C1 bqw6EKRkRC51ozp047gC4F2wIBPE/O2iVcpAUOkCoD3oCzOY4NzC9fkdQZL3gGeI8cYC 3hCFf/DBMCKnopIFFpORPEg8kciDMfINbpVT2nUvJ2W1glufCsg4bkGr7iN3vNQgexUs dL1a++FA+Mh8vP8liREDQuw0Ewsjbq+A6ZWdFDV/K51vKCH2hQOxq39Rm/Y+F9I+SxK5 8RUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fODc4Y13jnUgYFxRk0/SlJ0oEOTVWjVViI6j6TXwrmA=; b=IBWliyORz+uqgxjXBHQ0pZDtFdSRCu0TV71mA0ccCXvwNTZCUB0NCZKElZrGKLbAOq czK9LPIEvKY4Xa+oSSv8wAIq37HbbcWFNDoML5uo9Y0pyAKJ2enIuvW0xvIpQC/0SXIF hHYJWpD0fV0/7ZotBH8L0kS6JLRWDLkcRpV1nj+josW030wDCw7OlUNYTJ0lESHPlDYi Yza2Y+OYk3hdGSK4LBTFog0cF5Qq/qRhF9C41ZNmoIpt4wqlSKFZoiM7j/oqz7/3DxcU ZHXc5tw5QwLau0kMNb04encKal5vx50fEuzT3hiVJFD7wAcbBnaUJpwVa4VabVuD+DYo MeTA== X-Gm-Message-State: AOAM532132npUc0fQgrD09OwR9TiykG3ZOFrXtqhq6G8zZgb5WiLd9iH Rab2yV/kurl35nQ6chdZy2ZmECumMTQ= X-Received: by 2002:a2e:8444:: with SMTP id u4mr1155075ljh.342.1612645121429; Sat, 06 Feb 2021 12:58:41 -0800 (PST) Received: from [192.168.0.131] ([194.183.54.57]) by smtp.gmail.com with ESMTPSA id b39sm1376435ljf.68.2021.02.06.12.58.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Feb 2021 12:58:40 -0800 (PST) Subject: Re: AW: [PATCH v2 1/4] leds: lp50xx: add setting of default intensity from DT To: Sven Schuchmann , Pavel Machek Cc: Dan Murphy , Rob Herring , "linux-leds@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20210204143726.27977-1-schuchmann@schleissheimer.de> <20210204145201.GB14305@duo.ucw.cz> <20210205102338.GA27854@amd> From: Jacek Anaszewski Message-ID: Date: Sat, 6 Feb 2021 21:58:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sven, On 2/6/21 2:14 PM, Sven Schuchmann wrote: > Hello Dan, > >> Von: Jacek Anaszewski >> Gesendet: Freitag, 5. Februar 2021 19:37 >> Hi Pavel, >> >> On 2/5/21 11:23 AM, Pavel Machek wrote: >>> Hi! >>> >>>>>> patternProperties: >>>>>> "(^led-[0-9a-f]$|led)": >>>>>> @@ -99,6 +104,7 @@ examples: >>>>>> reg = <0x1>; >>>>>> color = ; >>>>>> function = LED_FUNCTION_CHARGING; >>>>>> + default-intensity = <100 0 0>; >> >> How will you know which array position is for which child LED? >> I presume DT child nodes are not guaranteed to be parsed in the order >> of declaration? > > I tried to fiddle this out, but it seems Jacek is right over here. > The multi-led definition looks like this (from the documentation leds-lp50xx.yaml) > > multi-led@1 { > #address-cells = <1>; > #size-cells = <0>; > reg = <0x1>; > color = ; > function = LED_FUNCTION_CHARGING; > > led-0 { > color = ; > }; > > led-1 { > color = ; > }; > > led-2 { > color = ; > }; > }; > > But it seems that the color definition of each led is ignored. > By ignored I mean the driver does not take care which color > is at which position. So if I change led-0 to be LED_COLOR_ID_BLUE > and led-2 to be LED_COLOR_ID_RED nothing will change if I write > from userspace. Could you help to clarify? > Then it is even hard to know which led to set with default-intensity. See Documentation/ABI/testing/sysfs-class-led-multicolor and documentation of multi_index and multi_intensity files. It is the multi_index file that tells what is the order of colors in the multi_intensity file. And that depends on the order of enumeration of the nodes by DT parser. > Also it seems that the enumeration of the multi-leds should > start with multi-led@0 (and not 1 as in the documentation). The @unit-address part of node name must match the first address specified in the reg property of the node, so this is correct. -- Best regards, Jacek Anaszewski