Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp153010lqs; Mon, 4 Mar 2024 19:29:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWjiCSTzqGr3rhsSg8pv4nf6/BhFQ8l2LrLXkgELkYaiRT/g4oBROhlautlgDQByBy6SO+5oKFEkhzZWmDGz20GaoiEPPzupu/TDPBw3A== X-Google-Smtp-Source: AGHT+IF8co7eBimwRL6q76UF7iXdMYPL4PHy9xcacmAj7SvGKfeoinBy1j0UzAjLqDZ7aOPTOmCX X-Received: by 2002:a9d:77c8:0:b0:6e4:c62d:b5c0 with SMTP id w8-20020a9d77c8000000b006e4c62db5c0mr820924otl.15.1709609394923; Mon, 04 Mar 2024 19:29:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709609394; cv=pass; d=google.com; s=arc-20160816; b=IyuK9p52y39A0Cu7pcDYCIWKbwflrCE4Y1HIiMI4spkOAXiZ07oWy7Se8fTjfZE0Xl 2hIJVhRGB+BKrSfvdRalHQNzxNZ25RPLb3vly76tJL/92uJp1eBlMTCUUTzIO1BXg4LN 5y2Fxo3PZlvNG49LLhTBvu1GFVS6EuCi16BMHtnkg6zwI9p8NFXWbcWjjsiUey3hR+0T lObXOdDpmf31mrODxNeVCxL+/H7VM9+0ebXpdN2W3schFTo/K1wM9TKXbV2c6fNfQBDx M6NpewoWwRzxDFUDq2kTOrGbiUe6AB+gpO58kvs54NrqzFgTYYgUSwFvYlVKvwfPNtVB OtDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qzlmmvRCQh1bj1Yx5DjGSZCSGlxLY62tQPxGASsPEGE=; fh=GYfdUOgHRyJ/xp0erRek8xroYC5NIyharacpYvoPeco=; b=cqxpfxM60Fs/vUK7Adp4119uVHsAyFvkaiDU1uI9JaZRkLFmAFczwPIexM+f4ZLrAq toiy9UEHDp+5A1dvWmUQvPNULqjZqmu5jx4IqSEudTKBnmgoT19gFYiT3IjI6t/KCV+B Ph2Bw6/McNcaPJsa5geGOMKD+HYHELBsa7V0Sls8Qpb5SXLnDbhUOHoOw0umu4xTp0qo W7wC0NVkJfTwKfK/aWnDB0IAKUHcPkSJdA19fxvAAoyETv+Yx0I+aTD6uiZQkAo2gqEM 9OgfivyqtuvcSQt9bCj+60UjSU4Op1tWpbsiYXs/dHVcOs69ShyNF7Q0hvkztiyjmcSV 2dwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ko1aSzn5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y3-20020a63e243000000b005cf94b8d9ddsi9413342pgj.869.2024.03.04.19.29.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 19:29:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ko1aSzn5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91617-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 04BD22846AB for ; Tue, 5 Mar 2024 03:29:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3AD5381C6; Tue, 5 Mar 2024 03:29:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ko1aSzn5" Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 693F029CE9; Tue, 5 Mar 2024 03:29:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709609387; cv=none; b=U3bH+IUUI4MWbGA+Pxnu42+zLB0Z8Lci44QDiZlH51A0bFbv7EcFPnsCnTIuuieOkVAqmy5OSSQxfkwV2wx4rlnWQc7Do3jl1q/FFyeOpDn4JjoACbT0e1Iy5dJP3TXBHMcTbELicUc6NR5vgd98+kjm4ZKnhW6j+Q9rk6YGjbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709609387; c=relaxed/simple; bh=DjAO2u7PVrXzRcnJJKgnPLvebnRRPbpCp1OkVSCAaR8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F1d4w8TWvdW6JnSJIdnNvuds1hTvyGHSfm4QjQgfg+8+xBMDADabewsHr0x8/rcxujXohpeYBScKarmW5gZR7Q/TUCCW4aVBMlCZvAqQDmVmz7noQjj8bTJqHPCCa08WqA1sm/AC+DU58FEmcf5X0RCtqmFsDE0R9n8+0cf344Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ko1aSzn5; arc=none smtp.client-ip=209.85.219.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-6900f479e3cso2673676d6.0; Mon, 04 Mar 2024 19:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709609384; x=1710214184; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=qzlmmvRCQh1bj1Yx5DjGSZCSGlxLY62tQPxGASsPEGE=; b=ko1aSzn5jqz3m+qoHIr6xUhvzSg9785j6yBy9AFYyXuxO+DvYSUCptnndG8Ph1pLWp 0FWPl+E9EluIPkNO7YY27afR/vdDmZhfvGVNBuPOgbkUnasIRCzQpXO2fTtEVI8Nzt4N /WR7p4Ugttlw4NmmvD9iiUu/07nb2gjdw+KtPMt6aQHk12qgi6IWG8x4GQfU9oqDKq7x yN7/g1gV0XPGzq+YZnlvbwfkYSmjaqbkke5N8379LkITWTKVuFOZ7keP5a8PNTZBQ2XO ZxSdWXXdE+KrNQPcF8cMrwuWorkq3rlSsj5kZ04ei0ypd4pZQoRsKmlNP3sxagsTM3S+ BOBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709609384; x=1710214184; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qzlmmvRCQh1bj1Yx5DjGSZCSGlxLY62tQPxGASsPEGE=; b=Ef7GCI++FjTVfcxjAWPd31W5RA3pxKRZthHCsgw2bVI/0emk4wibVhXE6PiTUa5Lcd QJpNw7qC/kME2IDL6etCYQRUMRuyLZSjjG7A8xQ5Vq1bwu+3a7o4Pny4+89ftbtoq+P/ UdXOdMsgCmwgTuNRfUccQEEbvhE1gOIuhpy3LuuaCdqt6QJYlkaAMn0S79GLf9mvdidY 5ek7Jz9apRABfal7FdwmIlaA22ctdO+KyggTDBKERx+zQe3mJ7UNuq1H08r/9NFlSG0w YUyx5oZNQmOVNk6zkEzGgrRm3Gr5fM/oHcOd7ZG+BIC18lPoMf0HVyN0PpkfEA2gpP9Z TKKQ== X-Forwarded-Encrypted: i=1; AJvYcCWA03q97Rg1f5trsOoAXsFY90QC3o62SiiFOa1AyqlCJRjkx1os8l9FZThd1VrS5gNPIsu3kSqTuWFa8ovJT8N8wIP9qTvFoB4/lmqbh49LiaQBIZYVItGQWr44iwhtMqZLHnWTWqd9blO496R1t47lnZAIWNCGOEQbca4a+zGoZrmDvpY= X-Gm-Message-State: AOJu0Yx4CK2lUKqXbLYMJBoH8ZtZlSXGSiuAI/BAd0gw2Y1XWcN5eNeM WRhPzolDSAo/RL5EvnNNGnoTRQUpLQojnzwM+TasvCDNUrZmG77/ X-Received: by 2002:a0c:e0cd:0:b0:68f:30a1:4bea with SMTP id x13-20020a0ce0cd000000b0068f30a14beamr723384qvk.33.1709609384122; Mon, 04 Mar 2024 19:29:44 -0800 (PST) Received: from abdel (bras-base-ktnron0692w-grc-13-174-95-13-129.dsl.bell.ca. [174.95.13.129]) by smtp.gmail.com with ESMTPSA id mu18-20020a056214329200b0068fddcdc381sm5845758qvb.18.2024.03.04.19.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 19:29:43 -0800 (PST) Date: Mon, 4 Mar 2024 22:29:41 -0500 From: Abdel Alkuor To: Lee Jones Cc: Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alice Chen , Jean-Jacques Hiblot , ChiYuan Huang , ChiaEn Wu , Lukas Bulwahn , =?utf-8?B?QW5kcsOp?= Apitzsch , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] leds: Add NCP5623 multi-led driver Message-ID: References: <20240217230956.630522-1-alkuor@gmail.com> <20240217230956.630522-2-alkuor@gmail.com> <20240301085046.GE1209090@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240301085046.GE1209090@google.com> On Fri, Mar 01, 2024 at 08:50:46AM +0000, Lee Jones wrote: Hi Lee, > > +#define NCP5623_REG(x) ((x) << 0x5) > > What's 0x5? Probably worth defining. This is a function offset. I'll add a define. > > > + guard(mutex)(&ncp->lock); > > Are these self-unlocking? Correct. Here is a short introduction about it https://www.marcusfolkesson.se/blog/mutex-guards-in-the-linux-kernel/ > > > + ncp->old_brightness = brightness; > > The nomenclature is confusing here. > > For the most part, this will carry the present value, no? > Yes, I'll change it to current_brightness instead > > + ret = ncp5623_write(ncp->client, > > + NCP5623_DIMMING_TIME_REG, pattern[0].delta_t / 8); > > Why 8? Magic numbers should be replaced with #defines. > This is dim step in ms. I'll add a define for it. > > +static int ncp5623_pattern_clear(struct led_classdev *led_cdev) > > +{ > > + return 0; > > +} > > Not sure I see the point in this. > > Is the .pattern_clear() compulsorily? > Unfortunately, it is. For example, in pattern_trig_store_patterns, when hw pattern is used, it is expected to have pattern_clear implemented. static ssize_t pattern_trig_store_patterns(struct led_classdev *led_cdev, const char *buf, const u32 *buf_int, size_t count, bool hw_pattern) { ... if (data->is_hw_pattern) led_cdev->pattern_clear(led_cdev); ... } > > + init_data.fwnode = mc_node; > > + > > + ncp->mc_dev.led_cdev.max_brightness = NCP5623_MAX_BRIGHTNESS; > > + ncp->mc_dev.subled_info = subled_info; > > + ncp->mc_dev.led_cdev.brightness_set_blocking = ncp5623_brightness_set; > > + ncp->mc_dev.led_cdev.pattern_set = ncp5623_pattern_set; > > + ncp->mc_dev.led_cdev.pattern_clear = ncp5623_pattern_clear; > > + ncp->mc_dev.led_cdev.default_trigger = "pattern"; > > + > > + mutex_init(&ncp->lock); > > + i2c_set_clientdata(client, ncp); > > + > > + ret = led_classdev_multicolor_register_ext(dev, &ncp->mc_dev, &init_data); > > + if (ret) > > + goto destroy_lock; > > + > > + fwnode_handle_put(mc_node); > > Didn't you just store this ~16 lines up? > Ops! I'll remove it. Thanks, Abdel