Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp241428lqp; Tue, 11 Jun 2024 23:13:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWH7JroCOMT8HHcmMcCG4z2ZnyXHcwr6pM90I79E7LyQkSyeaU/eIB8wD6g49AX84/YkGkg0qBjniILcFbY69rQ46KF2Zq3UjwISTRSPg== X-Google-Smtp-Source: AGHT+IHzLBD1o8eOpEKuSLbFiX8jDhGLQ3a9F4NSXuUb8fWbMVwLPi9CANTv5MfxnjW8CTuUbwmB X-Received: by 2002:a17:906:3e4a:b0:a6f:1a1a:d3f5 with SMTP id a640c23a62f3a-a6f47d4ef5emr63810466b.8.1718172782174; Tue, 11 Jun 2024 23:13:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718172782; cv=pass; d=google.com; s=arc-20160816; b=jbXWBsgxHbcJ/yhAb4JV/e/cNEIAJ6KS7GgtiH7yXgv7SwJZ6hMtSjpSLaTf4+qScY dD0MQ3RDSL7nptoRekUvGIIbxwVu4AAvby7XpJXoTUhwPMHUcwz7nyQmZcbgWCmIBwd/ mDu1a5Ps8Q0AZCNqV/T7nrqY52S0VfN8x/chzi/C3bXv4uxF+mP+4FAmf86Lq5u+MZZb wTf6N2sohCn6yV3oucWjLz326JJOww24gJy4cJEh1xbPS/Dx4+qExxJRwE3iOXNxjqo+ fsdVZmFDC6THbATsy6zMgyF4OGN/wCz5yG7GUBRTtBFh6U4NhqEQZm8pp60xs3vFCrNy cpRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=g5h7rK0sr+2BxDz/k9zC8M7ipcnnpqL/bNRXKRcGg18=; fh=i7uTZ1PjOnhA46zA8WB+XAzkZSC+/RTWQ0c7QeQSvPE=; b=oVSEhiIRIdeIQeLn/nAUNrMTqsOhUB/4XPZDQxB6Z1zIRWYWKjU+sXye4HW2KqqnHc jDyf1F+coSUccz68K4pkZUREmHZo978x+LlHpDJnUjAJA4Cxrz3zgA9KG59uv7FnuaH1 hFNmvq3zZan9KwHDc8onuB22KDvmbE7HvnQfDtxN78G+Sx23WUh+JL28Pw4DgFWplTll DiIv6eY4EIsdKilOd4tW46DLchH6zak5NZQJCI2k2pbeohYTey28rCPA9wIJPKQa9eun PZ1gIa3RStMKp2lUXzqoEtMKFP8fDIh0GEAicudFYsq7m1ATqNWuAK22mZ377yoTQbZO KObg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoGld2Vr; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-210963-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210963-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f043ff944si405666066b.966.2024.06.11.23.13.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 23:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210963-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoGld2Vr; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-210963-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210963-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B50C51F21445 for ; Wed, 12 Jun 2024 06:13:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73F1413CFAA; Wed, 12 Jun 2024 06:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CoGld2Vr" Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 ACD7513C80A for ; Wed, 12 Jun 2024 06:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718172771; cv=none; b=oiMk89xTmsZt8q6hmgrXmKz2s1sKwrtXEqWDTM7rXVdVDrxBR9oePfPmLmc7EaNAVwnMwA04d86N95Q+MBJqpVqn5vqzkUAb/xMJM6Q4HQO0aYzsq+9AgsZTsCrU29d0driYNcdYz56gZY78GgfYLsq6hi0G8GEe9E8utCwIHSU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718172771; c=relaxed/simple; bh=bMHNn5K5SdcsmFeGjk+EH0zYqXn/MYJ+ePkN09KC/PI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IxH7SIJLSzLg0KRD88M3hQV2RFSLseyZSavny9TMey0AsjetVM2EbMGO7hmjGriBLz0PL4AenfZi5l8680utBScICkZitquN25YAnXNnivMCqmHa2b/XpTC+hhWi7QwlA9/jQcAVsFdrzrWm+a31ekhWGBsleCy4OIDuaaZkbDY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CoGld2Vr; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57c5c51cb89so2475911a12.2 for ; Tue, 11 Jun 2024 23:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718172768; x=1718777568; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=g5h7rK0sr+2BxDz/k9zC8M7ipcnnpqL/bNRXKRcGg18=; b=CoGld2VrgUUzAEX4FisL2Ee2H1ekfSLcYRELx3FhQjRi0ZEVTAgDKns1CetdNhffQd pzs6t++8a65/d0RrFLLjpm2EKWNzqKczGPDek+zSmyzC0Ulx39G0B2SwGtp+OyzRn7jl MSuKrX8H7sYfLHQTi/9XFHskPYDnD5mKv115+ULTV+epvgfuNKGURrLGaa2k0JHCzyI6 j2VuSPZjcuwVWlu5m/F5LtVtC2H64Wvd+XcM8oXZ/gFsyG1hSG9OLLWHL6PKm10dVAku rCSu4GDMqXifn4hlLmrlkGU6ZmM5xilqgE693HGAlRYCSyAI7j2FoojLy9fUaCAKHAlD 5UkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718172768; x=1718777568; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g5h7rK0sr+2BxDz/k9zC8M7ipcnnpqL/bNRXKRcGg18=; b=uCS2XgaVtE8r5PksQ/S+u9sVt6MCDIkOrRjJweoQmEjzrQ4TlYXSg5JOHq9e0lPyAn ZfBtpgY+99OtLu0fs+bMQMANsafb7IMCbyWl2b9MKfRJdvLzcQR2OvDe+H4e7/JDB/YH rKJ7EVwJhY6JwIPLPBOMbMoHlVYCu2kg3IZEQjI5e1I3VAP3H/nQhJtXAsF14FCT5RwE sX9oKhsk7gvJCE/wxUYrC/FHumjm9XYYPhn/9o2EYxRWYpeavfMEOybNGx5yzuQBNbS5 82UKzZuYJQFqXcNCAayWbwn1ntw45uFkfUkBcw5ZGy1ENgsON1K/Yzc/tThiwrDKlV+R 1k1A== X-Forwarded-Encrypted: i=1; AJvYcCXElzWeHGijInr8lATo4/l7BrjSwDgrA4Pg5iw3xTiVNhmk/XQbCoufgcm1YPKyntdSKYZb0+7mXfFanT6D3HP5zX/RKirF+ZBPXi/d X-Gm-Message-State: AOJu0YxuyxTEO/TN/FuW+06VytaWVGnvo9lQE3pNSSkiPszZ4h5vhbxB XXSufz11qzZ1sJ3z8xBIPN7v9xU1rgHw3U7cpFz4ZcAjXBScS4NV6pQCjq5FfyQ= X-Received: by 2002:a50:d494:0:b0:57c:ad11:e759 with SMTP id 4fb4d7f45d1cf-57cad11f283mr293326a12.28.1718172767944; Tue, 11 Jun 2024 23:12:47 -0700 (PDT) Received: from [192.168.1.20] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c55d8aca8sm8664613a12.97.2024.06.11.23.12.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 23:12:47 -0700 (PDT) Message-ID: Date: Wed, 12 Jun 2024 08:12:44 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 2/2] leds: add mp3326 driver To: "Yuxi (Yuxi) Wang" , "pavel@ucw.cz" , "lee@kernel.org" , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "conor+dt@kernel.org" , "wyx137120466@gmail.com" Cc: "linux-leds@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20240611083236.1609-1-Yuxi.Wang@monolithicpower.com> <20240611083236.1609-3-Yuxi.Wang@monolithicpower.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6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UwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/06/2024 04:23, Yuxi (Yuxi) Wang wrote: >> >>> +/* >>> + * PWM in the range of [0 255] >>> + */ >>> +static int led_pwm_store(struct device *dev, struct device_attribute *attr, >>> + const char *buf, size_t count) >> >> Nope. > Hi Krzysztof, > > What do you mean this Nope? > Is it format or function? As sorry, you are reimplementing kernel interfaces, so that's a no. > >> >> ... >> >>> + } >>> + r_val = r_val * 255 / 4095 + (r_val * 255 % 4095) / (4095 / 2); >>> + g_val = g_val * 255 / 4095 + (g_val * 255 % 4095) / (4095 / 2); >>> + b_val = b_val * 255 / 4095 + (b_val * 255 % 4095) / (4095 / 2); >>> + if (led->num_colors == 1) >>> + return sysfs_emit(buf, "0x%x\n", r_val); >>> + else >>> + return sysfs_emit(buf, "0x%x 0x%x 0x%x\n", r_val, g_val, b_val); >>> +} >>> + >>> +static int led_enable_store(struct device *dev, >>> + struct device_attribute *attr, const char *buf, >>> + size_t count) >> >> Eeeee? store to enable LED? Really? > Yes. The users need this function and we provide it. NAK, I don't care about your users. You re-implemented existing ABI. Without any ABI docs that's just pure duplication. > > >> >> ... >> >>> +{ >>> + struct led_classdev *lcdev = dev_get_drvdata(dev); >>> + struct mp3326_led *led = container_of(lcdev, struct mp3326_led, cdev); >>> + struct mp3326 *chip = led->private_data; >>> + int ret; >>> + uint val, i; >> >> >>> + >>> +static DEVICE_ATTR_RW(led_pwm); >>> +static DEVICE_ATTR_RW(led_enable); >>> +static DEVICE_ATTR_RO(led_short_fault); >>> +static DEVICE_ATTR_RO(led_open_fault); >> >> No, for multiple reasons: >> 1. Where ABI documentation? >> 2. There is a standard sysfs interface. No need for most of that. Please >> explain why standard interface does not fit your needs - for each new >> interface. > Hi krzysztof, > > 1. Where ABI documentation? > A: > Sorry, the abi is insufficient. Which one is insufficient? > > Can I add it as comment above the function? > > 2. There is a standard sysfs interface. No need for most of that. Please > explain why standard interface does not fit your needs - for each new > interface. > A: > Leds has two ways to light dim. One is analog dimming, another pwm dimming. > They are different in practice. > > In RGB module, pwm dimming can control color and analog dimming can control intensity. > > Mp3326 supports the two ways which can operate contemporary. > > In practice, I have needs below. > 1. Operate rgb color and intensity. > 2. enable/disable some channel > 3. short/open fault notice. > > However, The standard interface only has three functions below, they are not fit my needs. > 1. multi_index > 2. multi_intensity(only can dim using one way, so I use it as analog dimming) > 3. led_mc_calc_color > Please point to which ABI is not sufficient. > > In order to fit my needs, I add the interface below. > led_pwm > led_enable Because especially this one sounds like you are mocking us. > led_short_fault > led_open_fault > Best regards, Krzysztof