From patchwork Wed Mar 21 15:04:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvaro Gamez X-Patchwork-Id: 10299645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6E7760385 for ; Wed, 21 Mar 2018 15:04:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 943B328EC4 for ; Wed, 21 Mar 2018 15:04:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86FD528EE4; Wed, 21 Mar 2018 15:04:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B922228EC4 for ; Wed, 21 Mar 2018 15:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752280AbeCUPEK (ORCPT ); Wed, 21 Mar 2018 11:04:10 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:35400 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752122AbeCUPEJ (ORCPT ); Wed, 21 Mar 2018 11:04:09 -0400 Received: by mail-wm0-f54.google.com with SMTP id r82so10479608wme.0 for ; Wed, 21 Mar 2018 08:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hazent-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=W01k0PQz5lRiYoFrSL008plDlNdPi+D5/8N+thc1EQA=; b=Js8gYe8dsS6jt2oEONcYxpvIyNv4VijglYK9YDY496ynjlYWnnoh6kAE3CGRIohZqx nf6ifryjhxd0ocBJbnMeUCfh/gYOZacuYiqS5isC1WT/1i7HskDmEWz2fBW5LJ4sOCdC lEqxymDspT8og5qThFxvghaFyVsapXGxVzYjfAER/WBCnr3RI5hUJ5mRkIDmKZQEpcMU 9iTyqBpJG6wr2cP5mZZ3XTfEDbTnBILUQWUDapHcSsXSaaxcvACQp0LP+bAMoqebToDY opPnnOgm9/ovV5DE4/tCqqRGU7MeppoM39ZO05RLcktafboa+dEV1C1R0oME0QobnYfb XGXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=W01k0PQz5lRiYoFrSL008plDlNdPi+D5/8N+thc1EQA=; b=C5TVKgXTuarGhCs8qVF3wb4o3BbFsCH9Tp9S4Cnfaiz//ykIPrchiyX9YimJyd7Aua JtLi32M8348seCU2GyChgaenkjow20MrVgFEkVMng2/G3EqtMPs/ODgzBKXAh6snRpLm qZKukEyawLUffuwT/3xvFj/sm63sLNI+DfWbsfgw33yxoUTcok34kp3A4tvOXXCOkfYB VUhbeXRHy0VLuatNRWdQXuFDht+YGR307f5HbkqJ/wO/OCg7TNUQyQHxLpghw/B2bmEI +3tNW1P3vCLzEtmHK1/0bccAWboAIEeuQnqiMq/kEStUCFfSSRGXlnx1+hgH/WOLrrVt 2SrA== X-Gm-Message-State: AElRT7HjtMDGMO5wEONiB2lAdJ7YZNHW3h7D5SkqsWvJMAWIVOifuOB5 PCKGeUA+l5uPBHqSDXGlw4SJEg== X-Google-Smtp-Source: AG47ELu6AekbIzQom8Fa3yvo99CLCVSuIQfPTNQoQZZhEAxMugaoUawNZOA8Hmkq+Y6bUBdHL77i6w== X-Received: by 10.28.24.66 with SMTP id 63mr2866032wmy.115.1521644648302; Wed, 21 Mar 2018 08:04:08 -0700 (PDT) Received: from salem.gmr.ssr.upm.es (salem.gmr.ssr.upm.es. [138.4.36.7]) by smtp.gmail.com with ESMTPSA id 67sm4865186wmq.17.2018.03.21.08.04.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 08:04:07 -0700 (PDT) From: Alvaro Gamez Machado To: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Cc: Alvaro Gamez Machado Subject: [PATCH] hwmon: (lm92) Do not try to detect MAX6635 Date: Wed, 21 Mar 2018 16:04:52 +0100 Message-Id: <20180321150452.9257-1-alvaro.gamez@hazent.com> X-Mailer: git-send-email 2.16.2 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Maxim MAX663x family are mostly compatible with LM92, but they lack any identification register. Weakening the detect function would make it prone to false positives, and current one doesn't detect all chips. Therefore, the detect function for max6635 devices is removed in favor of explicit device instatiation. Signed-off-by: Alvaro Gamez Machado Reviewed-by: Jean Delvare --- Documentation/hwmon/lm92 | 4 +--- drivers/hwmon/lm92.c | 58 ------------------------------------------------ 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/Documentation/hwmon/lm92 b/Documentation/hwmon/lm92 index 22f68ad032cf..f2a5adcf4ead 100644 --- a/Documentation/hwmon/lm92 +++ b/Documentation/hwmon/lm92 @@ -12,9 +12,7 @@ Supported chips: Datasheet: http://www.national.com/pf/LM/LM76.html * Maxim MAX6633/MAX6634/MAX6635 Prefix: 'lm92' - Addresses scanned: I2C 0x48 - 0x4b - MAX6633 with address in 0x40 - 0x47, 0x4c - 0x4f needs force parameter - and MAX6634 with address in 0x4c - 0x4f needs force parameter + Addresses scanned: none, force parameter needed Datasheet: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3074 Authors: diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 2a91974a10bb..18509b5af11e 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c @@ -259,62 +259,6 @@ static void lm92_init_client(struct i2c_client *client) config & 0xFE); } -/* - * The MAX6635 has no identification register, so we have to use tricks - * to identify it reliably. This is somewhat slow. - * Note that we do NOT rely on the 2 MSB of the configuration register - * always reading 0, as suggested by the datasheet, because it was once - * reported not to be true. - */ -static int max6635_check(struct i2c_client *client) -{ - u16 temp_low, temp_high, temp_hyst, temp_crit; - u8 conf; - int i; - - /* - * No manufacturer ID register, so a read from this address will - * always return the last read value. - */ - temp_low = i2c_smbus_read_word_data(client, LM92_REG_TEMP_LOW); - if (i2c_smbus_read_word_data(client, LM92_REG_MAN_ID) != temp_low) - return 0; - temp_high = i2c_smbus_read_word_data(client, LM92_REG_TEMP_HIGH); - if (i2c_smbus_read_word_data(client, LM92_REG_MAN_ID) != temp_high) - return 0; - - /* Limits are stored as integer values (signed, 9-bit). */ - if ((temp_low & 0x7f00) || (temp_high & 0x7f00)) - return 0; - temp_hyst = i2c_smbus_read_word_data(client, LM92_REG_TEMP_HYST); - temp_crit = i2c_smbus_read_word_data(client, LM92_REG_TEMP_CRIT); - if ((temp_hyst & 0x7f00) || (temp_crit & 0x7f00)) - return 0; - - /* - * Registers addresses were found to cycle over 16-byte boundaries. - * We don't test all registers with all offsets so as to save some - * reads and time, but this should still be sufficient to dismiss - * non-MAX6635 chips. - */ - conf = i2c_smbus_read_byte_data(client, LM92_REG_CONFIG); - for (i = 16; i < 96; i *= 2) { - if (temp_hyst != i2c_smbus_read_word_data(client, - LM92_REG_TEMP_HYST + i - 16) - || temp_crit != i2c_smbus_read_word_data(client, - LM92_REG_TEMP_CRIT + i) - || temp_low != i2c_smbus_read_word_data(client, - LM92_REG_TEMP_LOW + i + 16) - || temp_high != i2c_smbus_read_word_data(client, - LM92_REG_TEMP_HIGH + i + 32) - || conf != i2c_smbus_read_byte_data(client, - LM92_REG_CONFIG + i)) - return 0; - } - - return 1; -} - static struct attribute *lm92_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_crit.dev_attr.attr, @@ -348,8 +292,6 @@ static int lm92_detect(struct i2c_client *new_client, if ((config & 0xe0) == 0x00 && man_id == 0x0180) pr_info("lm92: Found National Semiconductor LM92 chip\n"); - else if (max6635_check(new_client)) - pr_info("lm92: Found Maxim MAX6635 chip\n"); else return -ENODEV;