Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1165771lqb; Thu, 30 May 2024 02:09:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdt+fJV75GdhqtGATEq0FEPmLng5yPRmcAnb++TIC8DNKuInMeR3QzbKo4vXABeGJhQrHxfu/OpmBu1JgyTqJ8VAgK7LSKnY6kBpXNHQ== X-Google-Smtp-Source: AGHT+IHDgv5b+PIJKXtc5+GSJUlmEJgrQDhUCxBKRzIQ/qhSU/LXn+guvJQDpSorxmHGOpn7Poen X-Received: by 2002:a17:902:ec92:b0:1f3:62c:247f with SMTP id d9443c01a7336-1f61be15ccemr20222935ad.11.1717060181069; Thu, 30 May 2024 02:09:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717060181; cv=pass; d=google.com; s=arc-20160816; b=0avpE0VRaws3iQiIpWJT6ppWymF5KRs1J1UsvdD3+HGDLnTogFa6WEMt9nNrGLd5wg mvNp8/vMNHaBN1aR8PDBjZoNEZWczqm1SmDRuH5jGfwqbpJUS7GhZwshIIrQTVr+3ojo Dy558daHykRqg3GWVT85uo9+kC1bIQa1C/r02F+ENxhEPeAi51Fu2gNZVtNKazEh1102 S6fyleJc5kC4MW4GdV0Wld7vLjTUgny63aKBZPeK/A2F+6wXQ6TGIsuBHiaJRglyhl5c 2PsRHCpcuT3I6JJ98NvufDZW/cBaGocs+ipvosjRWIE9jaY/CSsgMm+bbOi+IoVcVujh X5dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HTb6DRemekT6qkVgIaJPrKDmPnXos4y4Ym/k63xzBmA=; fh=9qFKlQHnevDYoWhe53H9RyyL76BSeUyH5C9Z519y6Ig=; b=H+kq9rNbynjiRm4H49BYHycGjvNHoLLoacrlNnAiAkygCKwJggbPo8PDU+obQRCUWs iBR0bnfgpd5qdkaEmw5ox6gyf0IBZ33RgvyPTfneIjHyKoTx4045v3S4FwueXYg/FzH6 t0pi/eSButyaHdzHkdyFJRXWkBBV414R1dBBuNbBlRtfygwtKak/T0Azv9+s6yLDLnZQ Jh4j/6amHg4jnGFtjA1hBcqQT0OXZiFnmNDUxxyr6sO27KLkQkrF7aN+Dp7OESIkAJ1Q /4vmvhByEkRZZjuPc9LigzsEcBTjua+Jv2kpwuLGh2xBaOx7DVus5fXrcWUq+yf7dOia dVww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b="JJ/ooLuq"; arc=pass (i=1 spf=pass spfdomain=t-8ch.de dkim=pass dkdomain=t-8ch.de dmarc=pass fromdomain=t-8ch.de); spf=pass (google.com: domain of linux-kernel+bounces-195142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=t-8ch.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f499cebd85si73265465ad.435.2024.05.30.02.09.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195142-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=@t-8ch.de header.s=mail header.b="JJ/ooLuq"; arc=pass (i=1 spf=pass spfdomain=t-8ch.de dkim=pass dkdomain=t-8ch.de dmarc=pass fromdomain=t-8ch.de); spf=pass (google.com: domain of linux-kernel+bounces-195142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=t-8ch.de 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 43272286E86 for ; Thu, 30 May 2024 09:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BC1318396E; Thu, 30 May 2024 09:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=t-8ch.de header.i=@t-8ch.de header.b="JJ/ooLuq" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B129515666B; Thu, 30 May 2024 09:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060104; cv=none; b=SdSyfdTNwk+AhJ1rNzruqf+DYY8NeM4fv0hsPB35sZXDRMnjZ0FBWUNnakb7vxjMa9lzoBK2OQPJ8T/z2Qjy194GkdQM1NcFjPZnEVNyzJG5HasbLER4KLJZ4fdbGAoMIHh24dajR5K7gAi1o4jwEhbwumsaQdeO8Y1K4UKQ5ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060104; c=relaxed/simple; bh=EJpiJuLnLplPlSX97jzmByJ0QFWruhAlXtw+kfZ0+Bw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=vBjEXC9JM1O7w3ceC59lOyG8ht46gyTMInQmtuzaS+kZ8kQOxEoQEHWRE4kOsPPER9Y4+xFJJ1REu/8D/U/+x1H9887AaIyURl5iwwYtt/NrhyTN47m5bwevjllfISMNjdyiciAWy3/aF4mYPjQ+/muaH51Pj2pLnK2SfZpnWqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=t-8ch.de; spf=pass smtp.mailfrom=t-8ch.de; dkim=pass (1024-bit key) header.d=t-8ch.de header.i=@t-8ch.de header.b=JJ/ooLuq; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=t-8ch.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-8ch.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1717060092; bh=EJpiJuLnLplPlSX97jzmByJ0QFWruhAlXtw+kfZ0+Bw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JJ/ooLuqra1+kbE6aNHdyuEQd5hWdBzjUrtkT/ol+JITu/NLqv5OmCVEvABgx1T24 bh/cyiMMwgWkOYG7LF9wHYxwKCUcNsCTccrck4NlgGnVhnn4VyTftTsGhbVn027/Yg ZlMwGZALU61ALxRoesPAWPwBVRStkjjQhAR7kQU8= Date: Thu, 30 May 2024 11:08:12 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Hristo Venev , =?utf-8?B?UmVuw6k=?= Rebe , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Radu Sabau Subject: Re: [PATCH 2/3] hwmon: Add support for SPD5118 compliant temperature sensors Message-ID: <45396bd5-adb8-485a-98d0-eecfb7439bfa@t-8ch.de> References: <20240529205204.81208-1-linux@roeck-us.net> <20240529205204.81208-3-linux@roeck-us.net> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240529205204.81208-3-linux@roeck-us.net> On 2024-05-29 13:52:03+0000, Guenter Roeck wrote: > Add support for SPD5118 (Jedec JESD300-5B.01) compliant temperature > sensors. Such sensors are typically found on DDR5 memory modules. > > Cc: René Rebe > Signed-off-by: Guenter Roeck > --- > +/* Return 0 if detection is successful, -ENODEV otherwise */ > +static int spd5118_detect(struct i2c_client *client, struct i2c_board_info *info) > +{ > + struct i2c_adapter *adapter = client->adapter; > + int regval; > + > + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | > + I2C_FUNC_SMBUS_WORD_DATA)) > + return -ENODEV; > + > + regval = i2c_smbus_read_word_swapped(client, SPD5118_REG_TYPE); > + if (regval != 0x5118) > + return -ENODEV; > + > + regval = i2c_smbus_read_word_data(client, SPD5118_REG_VENDOR); > + if (regval < 0 || !spd5118_vendor_valid(regval & 0xff, regval >> 8)) > + return -ENODEV; > + > + regval = i2c_smbus_read_byte_data(client, SPD5118_REG_CAPABILITY); > + if (regval < 0) > + return -ENODEV; > + > + regval = i2c_smbus_read_byte_data(client, SPD5118_REG_TEMP_CLR); > + if (regval) > + return -ENODEV; > + regval = i2c_smbus_read_byte_data(client, SPD5118_REG_ERROR_CLR); > + if (regval) > + return -ENODEV; > + > + if (!(regval & SPD5118_CAP_TS_SUPPORT) || (regval & 0xfc)) > + return -ENODEV; This breaks automatic detection for me. I think the test should after the read of SPD5118_REG_CAPABILITY and test that register, similar on how it is done in _probe(). > + > + regval = i2c_smbus_read_byte_data(client, SPD5118_REG_REVISION); > + if (regval < 0 || (regval & 0xc1)) > + return -ENODEV; > + > + regval = i2c_smbus_read_byte_data(client, SPD5118_REG_TEMP_CONFIG); > + if (regval < 0) > + return -ENODEV; > + if (regval & ~SPD5118_TS_DISABLE) > + return -ENODEV; > + > + strscpy(info->type, "spd5118", I2C_NAME_SIZE); > + return 0; > +}