Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp339129lqt; Mon, 18 Mar 2024 09:12:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBlKSVgN2lygi4RkMXzkTw2RMz9n4tW2wugZ3QSsn1ZFNQTUqKnVfhryFHZrEOxHsHaBlgQWAn5cHODMzvMPfIvFg/CI83rxgAIyaX3g== X-Google-Smtp-Source: AGHT+IH1yVgB2zSgHZWef/7Ya5D4riRFp1mLmbI3dpec/xyQl87YvPZTDj5r6RwjUFgFIqvWJ/RH X-Received: by 2002:a05:6512:3a90:b0:513:cb71:f9b with SMTP id q16-20020a0565123a9000b00513cb710f9bmr6202026lfu.68.1710778371869; Mon, 18 Mar 2024 09:12:51 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gg16-20020a170906e29000b00a462e1b0002si4495548ejb.436.2024.03.18.09.12.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:12:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106364-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=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RA8YGDjO; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-106364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 5E9631F22463 for ; Mon, 18 Mar 2024 16:12:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43D2953397; Mon, 18 Mar 2024 16:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RA8YGDjO" Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 5EA59537E4 for ; Mon, 18 Mar 2024 16:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710778363; cv=none; b=N59rpE2oesh793KMrhnmTmxyfxz2SL+KId4OQ8dQrDyLnVRmIJ43RqJU5crRDtrLjjNZ/pbvxkZeekTbbTxtOSeWdxpl2VEjoQCAffHdx8x+A32rGdgo5Tnwk1ohfKH8/1GOGo3fTu95CIqg+f563b/LCKTKSlt7OazBTGrrk9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710778363; c=relaxed/simple; bh=qWIWRdlhHxM2YpAOK/CdrCJzY7erfxdMa6eYTRm+3dw=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=aYzd0kEQeOyZPhtt1RFGdrPy4fs6uM/OErVighx/Wu8E0R84f06ZVMrgTRPwPXVHQ6z7Lb3dR/tXBcrhD31+b3H2xi2Ac1zRSs2JkhNylMbsxrlzsYP/V9RS1IuudwSBimm0tT3wJBqCERTlUtO9InGBc0YiGI4nKUcmNZ7H6RQ= 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=RA8YGDjO; arc=none smtp.client-ip=209.85.208.178 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-lj1-f178.google.com with SMTP id 38308e7fff4ca-2d4a901e284so24454311fa.1 for ; Mon, 18 Mar 2024 09:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710778360; x=1711383160; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=G9oKEy66iQx7fLJGG39Ko2q9eHHj3gCyG5CIVLyLT/E=; b=RA8YGDjOJMIoNz4+OUKFaBLtLr8J8Ocy3rMUGM9RIPCwSeVxIrXz8ESllrm9zZnKZv jUaKcL/KWDI1tcahpkZAivgU5Lnb5TKWVO4UEJBYS4UwujTq5EUmOkp1U4YnAeGLOV3x IdH6xjopRgehIVTIF1ScHzIxeCFj4ydMoRIcMdqUTgdNSxuKut6Sq42HW19sigZJyX2m 6PW8nn3nzX1HFZjei1Ph5BacvvozHDkiG6yvljnzKlpPBKyjK3cTjZJc/h32DaxZ68r7 n6Lfd5EKULExqCx5yGzQBdG4XXYDljJ4VOZUUugssf51tG3vXHzEGq13zssSGuyNagda 9MWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778360; x=1711383160; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G9oKEy66iQx7fLJGG39Ko2q9eHHj3gCyG5CIVLyLT/E=; b=TllcVbGONhf4yNNgCVYD5ITGAlIDxK6sQRgp7yHijNNEJnjErntvYgA268kQ/4NV8a UlFD8c/gZNeIhG748Aqt+t6PzNaZb8gLz8EW70EseJBh6wW4musRGRHo3JQjXhpKuoGo BUyBSLyFAX+Se5T1j9V7Jp4OUpRs0qVmrLcxAHDU8vzffNHRSrlXVarq1v09Pidshggp sCytdVCR8LdzyccevCV2NzmOlmgI5VwOlVUKTsSuSupiwB3N5HJ5qoIBvFOmG03UOKc2 etBAIOZb7mlvN+aYHn8NWxUgck2tUfh3T+64/343LDu0pGM+iBPOlOwTFWIyfEv813BD jcaQ== X-Forwarded-Encrypted: i=1; AJvYcCXbJctP0EkKPLFmuu6P4KhyrvOZ0q7QWMnkg51xWtwN1EOJ4LiRKdo0pktxVH4eupJ/36mK53qDoXv7bb8vspilTu6tjyYMCsPvkVjI X-Gm-Message-State: AOJu0YyA1Y5gjzYybDIjHmGGdtxr0PV4oNiaPEl0dGpPawNE4/yntPmG BjOdBOm5t1mljFEgnxvGxMcbr2FSqO2fqO+ZSFN/QWDYXTGs+4HQn/HcnWqu3GY= X-Received: by 2002:a05:651c:337:b0:2d4:513d:7b34 with SMTP id b23-20020a05651c033700b002d4513d7b34mr4857648ljp.17.1710778359619; Mon, 18 Mar 2024 09:12:39 -0700 (PDT) Received: from [192.168.1.20] ([178.197.222.97]) by smtp.gmail.com with ESMTPSA id e25-20020a170906845900b00a4652efd795sm5016635ejy.83.2024.03.18.09.12.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Mar 2024 09:12:39 -0700 (PDT) Message-ID: <04b39945-e4e1-43bd-83bf-0d7eb3730352@linaro.org> Date: Mon, 18 Mar 2024 17:12:37 +0100 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 2/2] hwmon: pmbus: adp1050 : Add driver support Content-Language: en-US To: Radu Sabau , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Delphine CC Chiu , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org References: <20240318112140.385244-1-radu.sabau@analog.com> <20240318112140.385244-3-radu.sabau@analog.com> From: Krzysztof Kozlowski 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/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrcnp5c3p0b2Yua296bG93c2tpQGxpbmFyby5vcmc+wsGUBBMBCgA+FiEE m9B+DgxR+NWWd7dUG5NDfTtBYpsFAmI+BxMCGwMFCRRfreEFCwkIBwIGFQoJCAsCBBYCAwEC HgECF4AACgkQG5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9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20240318112140.385244-3-radu.sabau@analog.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 18/03/2024 12:21, Radu Sabau wrote: > Add support for ADP1050 Digital Controller for Isolated Power Supplies > with PMBus interface Voltage, Current and Temperature Monitor. > .. > +static int adp1050_probe(struct i2c_client *client) > +{ > + u32 vin_scale_monitor, iin_scale_monitor; > + int ret; > + > + if (!i2c_check_functionality(client->adapter, > + I2C_FUNC_SMBUS_WRITE_WORD_DATA)) > + return -ENODEV; > + > + /* Unlock CHIP's password in order to be able to read/write to it's > + * VIN_SCALE and IIN_SCALE registers. > + */ > + ret = i2c_smbus_write_word_data(client, ADP1050_CHIP_PASSWORD, 0xFFFF); > + if (ret < 0) { > + dev_err_probe(&client->dev, "Device can't be unlocked.\n"); Syntax is: return dev_err_probe(). Same in other places. > + return ret; > + } > + > + ret = i2c_smbus_write_word_data(client, ADP1050_CHIP_PASSWORD, 0xFFFF); > + if (ret < 0) { > + dev_err_probe(&client->dev, "Device couldn't be unlocked.\n"); > + return ret; > + } > + > + /* If adi,vin-scale-monitor isn't set or is set to 0 means that the > + * VIN monitor isn't used, therefore 0 is used as scale in order > + * for the readings to return 0. > + */ Please use Linux coding style comments. /* and aligned */. > + if (device_property_read_u32(&client->dev, "adi,vin-scale-monitor", > + &vin_scale_monitor)) > + vin_scale_monitor = 0; > + > + /* If adi,iin-scale-monitor isn't set or is set to 0 means that the > + * IIN monitor isn't used, therefore 0 is used as scale in order > + * for the readings to return 0. > + */ > + if (device_property_read_u32(&client->dev, "adi,iin-scale-monitor", > + &iin_scale_monitor)) > + iin_scale_monitor = 0; > + > + ret = i2c_smbus_write_word_data(client, ADP1050_VIN_SCALE_MONITOR, > + vin_scale_monitor); > + if (ret < 0) > + return ret; > + > + ret = i2c_smbus_write_word_data(client, ADP1050_IIN_SCALE_MONITOR, > + iin_scale_monitor); > + if (ret < 0) > + return ret; > + > + return pmbus_do_probe(client, &adp1050_info); > +} > + > +static const struct i2c_device_id adp1050_id[] = { > + {"adp1050", 0}, > + {} > +}; > +MODULE_DEVICE_TABLE(i2c, adp1050_id); > + > +static const struct of_device_id adp1050_of_match[] = { > + { .compatible = "adi,adp1050"}, > + {} > +}; > +MODULE_DEVICE_TABLE(of, adp1050_of_match); > + > +static struct i2c_driver adp1050_driver = { > + .driver = { > + .name = "adp1050", > + .of_match_table = of_match_ptr(adp1050_of_match), Drop of_match_ptr, you will have here warnings. > + }, > + .probe = adp1050_probe, > + .id_table = adp1050_id, > +}; > +module_i2c_driver(adp1050_driver); > + > +MODULE_AUTHOR("Radu Sabau "); > +MODULE_DESCRIPTION("Analog Devices ADP1050 HWMON PMBus Driver"); > +MODULE_LICENSE("GPL"); > +MODULE_IMPORT_NS(PMBUS); Best regards, Krzysztof