Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp457655ybg; Sat, 26 Oct 2019 01:14:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxb+KW/oKLvDUT2WSiFoIIP9mpexgEJ3be0tYBOLxMUxSUlElz6RWDQrMc6LtG4Htp57PoC X-Received: by 2002:aa7:c257:: with SMTP id y23mr8415718edo.39.1572077671871; Sat, 26 Oct 2019 01:14:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1572077671; cv=pass; d=google.com; s=arc-20160816; b=CC3EDBwzQlDpyD+Z6WvYKHVjQCIvEZmjUaYVCogOf2vHj/MBNGsyXlmEfY5X9upo/x JtdQEFWOekHlj/EuLQkR2PTDm6PQb9tJDhvWldQDFidiGg4tL07o9jW/emY29Hrx16op B9DxD4cRsS7zSFwzHLQWmOLvXM82TX94osYBYGKVDMFeep6hK3M2Nyc7/PCLmgJtGdf3 FFyGlAV1ZzbbOjLVYQEttXTUyrWqiTtaQeij7JeH13HuA077cpqvlTtwfs4z+fEvpp8m 0xB4rZ1kmwrBlY7s/BZ6l8uliSo3Um0AJ5nvMppchN5Ria73KepknOpuzKC9uEx9ioCL Y0Rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=2XFB6AhYhZzv1k4oQ9J6OWAkGMLH3JX/1RXqIVOvp0Q=; b=sjPyUQdW15jXxBrOJiRD2v5UG1GYZQo9WpXRkmpEbcD0r4dPpZJK5z0IXOT1ef462Z lM77TEHW0G6T3MevXh7B34zPuqq4NdNr6t4ddcWezB8oyNc0wqIALfmnyJh006srktoX oALysDlg58usW8O2O5cn6IZ3SV6yQiPmbEeL7OXjfzDQF6WAVs//4m5Baq5b1ewudM+K +/IaoWr0nllzwNU9EzriD9W82lXZQT/vnHPkh7A4HaiOQIaB4A5uTYic4bQkPInk6+IG PrgxQGbkYMIRa57+W/dUYpR41uVJ9KR85Qvo+jnfimeYr2eoti/v0o/uwEi1pujmMdQF emfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@jabil.com header.s=selector2 header.b=pA0SqOyM; arc=pass (i=1 spf=pass spfdomain=jabil.com dkim=pass dkdomain=jabil.com dmarc=pass fromdomain=jabil.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jabil.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si2858372ejc.74.2019.10.26.01.14.08; Sat, 26 Oct 2019 01:14:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@jabil.com header.s=selector2 header.b=pA0SqOyM; arc=pass (i=1 spf=pass spfdomain=jabil.com dkim=pass dkdomain=jabil.com dmarc=pass fromdomain=jabil.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jabil.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbfJZILE (ORCPT + 99 others); Sat, 26 Oct 2019 04:11:04 -0400 Received: from mail-eopbgr750135.outbound.protection.outlook.com ([40.107.75.135]:37344 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725996AbfJZILD (ORCPT ); Sat, 26 Oct 2019 04:11:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TViaHqTZXJR0OEGGPN3JqkJ0hr7SMUrN4MR98gHBAn1So8YNoAxAKZ1HH1w5+i7UaOhYFR6YSftFKOTWditwD9BbqUOEBXj2aH1FlzCTKYZWBQVGluv3TC2w9BjgafGk69r//rpCVG/RGa8O3nPEYD1YWbrfC2AFKrV+ThoIVmN8ccEtMAhXOBzbwP+DxEZ3bCBAv6LI8y9O0yiZ8gZWOrr7R5002QSl+622/aU+4vYgh7T/eUay/QwjHLoUnMyIzImWCmKt47SApPBtH4rbwAfmB0D32r7O6//AsZqD9QJZ6FBTuPvQ53SIl92e27oWBxZw1Mlonh6CTCwxjamrUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2XFB6AhYhZzv1k4oQ9J6OWAkGMLH3JX/1RXqIVOvp0Q=; b=b5Tg00hM1ACsdASPfzvAM7IxeoKkzbujcVhxYVENSW4O5ez7I2DivLK2bMvWT2hqANRqfa+jn3sJrq3UfP62zXacNl+0i3ZFZxm2EwmCyEqQ6bpMuVfyNVwVWB8BvKv/jW7D29fzKLnaGbsMIkSwycDp4lE1R8CBJb273hZIVe9WIXs75zv+PXt4m5d4B5JQNwRLAXD7KWpxpQQ326VDeud1LFd/ItzOVnlh1ISufW9rq+N9AtE30SGZ0o8QsOh0a/ynihaSvmxNIBHof2dKk9UZyQA8qEchhzRjcTvy9lnHP9EdkIQZgdeEJMQkyMxWU2WYxdsrcDZpEq2lS0RnFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jabil.com; dmarc=pass action=none header.from=jabil.com; dkim=pass header.d=jabil.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jabil.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2XFB6AhYhZzv1k4oQ9J6OWAkGMLH3JX/1RXqIVOvp0Q=; b=pA0SqOyMx7fJY/VC1AMUoXhOGXIy8H8Ci5/q2EiBNZQBiX/UxrUNThEGGrClS5F9v4lk8lvc6/pCMIIetr+6JnAcvOV8iOb4zr/ZSphyTCK6q0eimlwD1QYITXvKcB0+Er7e9HwRM3+6ldw9GOkP2uYDMzb/+nYoX0//aqyp/6I= Received: from MN2PR02MB6703.namprd02.prod.outlook.com (52.135.48.83) by MN2PR02MB6749.namprd02.prod.outlook.com (52.135.48.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.23; Sat, 26 Oct 2019 08:10:59 +0000 Received: from MN2PR02MB6703.namprd02.prod.outlook.com ([fe80::524:774a:6751:7177]) by MN2PR02MB6703.namprd02.prod.outlook.com ([fe80::524:774a:6751:7177%5]) with mapi id 15.20.2387.023; Sat, 26 Oct 2019 08:10:59 +0000 From: Rain Wang To: Jean Delvare , Guenter Roeck CC: "linux-kernel@vger.kernel.org" Subject: [PATCH] lm75: add lm75b detection Thread-Topic: [PATCH] lm75: add lm75b detection Thread-Index: AQHVi9TmDrxen4j80EuOn1QRxLtsQA== Date: Sat, 26 Oct 2019 08:10:59 +0000 Message-ID: <20191026081049.GA16839@rainw-fedora28-jabil.corp.JABIL.ORG> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [180.167.230.226] x-clientproxiedby: SG2PR0601CA0007.apcprd06.prod.outlook.com (2603:1096:3::17) To MN2PR02MB6703.namprd02.prod.outlook.com (2603:10b6:208:1d2::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Rain_Wang@Jabil.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9f9fff31-0937-433d-f856-08d759ec08f1 x-ms-traffictypediagnostic: MN2PR02MB6749:|MN2PR02MB6749: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 0202D21D2F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(376002)(39860400002)(366004)(346002)(396003)(136003)(199004)(189003)(33656002)(66446008)(66476007)(71200400001)(6486002)(26005)(66946007)(4326008)(6436002)(6512007)(8936002)(186003)(25786009)(66066001)(478600001)(6116002)(3846002)(316002)(14454004)(7736002)(305945005)(110136005)(9686003)(102836004)(476003)(5660300002)(486006)(256004)(2906002)(14444005)(6506007)(86362001)(386003)(64756008)(66556008)(99286004)(71190400001)(52116002)(8676002)(81156014)(81166006)(1076003)(80792005);DIR:OUT;SFP:1102;SCL:1;SRVR:MN2PR02MB6749;H:MN2PR02MB6703.namprd02.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: Jabil.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OdTtInM2I7dMsx/jtgR+xoheIR1n/aiUqbTVmkLKijqr8unWp8SyRPxnNOHG8iFQIHZDVn/cKQYraNFZz4uoBT7RBCpFX8DccpJpqfJWiBHPAaZGaHC+MxsDaJpx2l+R7uq56RUzbD0oFI2jMAewI6QvKx45Tj1ovPNVA2yJ73Noz52DvCRfOS5PQXinMJgceNgUbpYstgYvgZayabhHvyT59qILGJtTH3efNIOfbJCV5qskF4VCmBvYGsiLL09rcR4X+ErVudZRp19TvBQocHda1zpW1rFRX1Xw78ruseTkAnGqaeELG9q8vZWT2xAh0wKH6DDsQt9RvL1FI/GlZHXKmDUGc79wgs4f+4vJ/lvNqHuVRsygtXXqVn58DHVgBjFGcEFpzIlFnVPtUvnzbrHglw8tHiQ7iT/he98hSA4h2qtUuTfHL8fHt6MbcuNa Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: jabil.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f9fff31-0937-433d-f856-08d759ec08f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2019 08:10:59.6958 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bc876b21-f134-4c12-a265-8ed26b7f0f3b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rBeIysC68t0qBqgp5uo/xtdNLM4yX3h0wJhzdw6cGl7d7B2ZLjpEmvln1eiuxij2azmCtjg5Y9w9WHOgyeG9ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6749 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The National Semiconductor LM75B is very similar as the LM75A, but it has no ID byte register 7, and unused registers return 0xff rather than the last read value like LM75A. Signed-off-by: Rain Wang --- drivers/hwmon/lm75.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 5e6392294c03..a718f9eb4d72 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -760,6 +760,7 @@ static int lm75_detect(struct i2c_client *new_client, int i; int conf, hyst, os; bool is_lm75a =3D 0; + bool is_lm75b =3D 0; =20 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) @@ -780,8 +781,12 @@ static int lm75_detect(struct i2c_client *new_client, * register 7, and unused registers return 0xff rather than the * last read value. * + * The National Semiconductor LM75B is very similar as the + * LM75A, but it has no ID byte register 7, and unused registers=20 + * return 0xff rather than the last read value like LM75A. + * * Note that this function only detects the original National - * Semiconductor LM75 and the LM75A. Clones from other vendors + * Semiconductor LM75 and the LM75A/B. Clones from other vendors * aren't detected, on purpose, because they are typically never * found on PC hardware. They are found on embedded designs where * they can be instantiated explicitly so detection is not needed. @@ -806,6 +811,13 @@ static int lm75_detect(struct i2c_client *new_client, is_lm75a =3D 1; hyst =3D i2c_smbus_read_byte_data(new_client, 2); os =3D i2c_smbus_read_byte_data(new_client, 3); + } else if (i2c_smbus_read_byte_data(new_client, 4) =3D=3D 0xff + && i2c_smbus_read_byte_data(new_client, 5) =3D=3D 0xff + && i2c_smbus_read_byte_data(new_client, 6) =3D=3D 0xff) { + /* LM75B detection */ + is_lm75b =3D 1; + hyst =3D i2c_smbus_read_byte_data(new_client, 2); + os =3D i2c_smbus_read_byte_data(new_client, 3); } else { /* Traditional style LM75 detection */ /* Unused addresses */ hyst =3D i2c_smbus_read_byte_data(new_client, 2); @@ -839,7 +851,8 @@ static int lm75_detect(struct i2c_client *new_client, return -ENODEV; } =20 - strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE); + strlcpy(info->type, is_lm75a ?=20 + "lm75a" : (is_lm75b ? "lm75b" : "lm75"), I2C_NAME_SIZE); =20 return 0; } --=20 2.21.0