From patchwork Mon Feb 4 20:19:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Gebben X-Patchwork-Id: 10796581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA038922 for ; Mon, 4 Feb 2019 20:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAFC52918E for ; Mon, 4 Feb 2019 20:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F4CB2C24D; Mon, 4 Feb 2019 20:22:35 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 2DC882918E for ; Mon, 4 Feb 2019 20:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727913AbfBDUTb (ORCPT ); Mon, 4 Feb 2019 15:19:31 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:40383 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727890AbfBDUTa (ORCPT ); Mon, 4 Feb 2019 15:19:30 -0500 Received: by mail-it1-f193.google.com with SMTP id h193so2903323ita.5 for ; Mon, 04 Feb 2019 12:19:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sweptlaser-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=MgB/XL8jWBeCcDRexQ0Cte18V2DYsF3bszwxeX/NtcA=; b=vwcV+VXDuPxK0Ty2EiwLylv15zBlKoUtkaztdYHqMc0fenCfuXoknubTRG1byooPVE xew5SbfFcSWd0IzKd8PZgntg3Lu3/bBcbE6Z8R1ipe++uwLopeY1RH7/HeS9Bo2qlTcc cpDaUjYmVxtyRuylAjZGjz1nA9TbnlY5DMNr0lk91lrMRR7CkG6NOE039oB0BYAyz8lU VHGZoifseLCBCfyBXo87DreZTSWh6jwYGi1eUghPwWRvjcPvOmTMZfy6fJ+wYKZX8X0G YZGHjpPmffmyVOoR+08HEGQzzYJi+lS7yDzdgAncDCmRew19wpiM7tlBzscwOBaBt3QH 3hPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=MgB/XL8jWBeCcDRexQ0Cte18V2DYsF3bszwxeX/NtcA=; b=WRQGPOzGqIvR8OHdQZ6/7HiU9QcbBAROKDSjLFxVY1qxnk0knZnDqqByK8o1lSKj3M Pk7dJFkV822ovaqDPLAn65qPI70jLVxTW5DY+dFu3tEsIfsr6F2YjFT/ngkiPP9nlCCk iDWtgxYYPBiTzgxM91Xj3l+3FGcm3oFbXAK3Wiui6DfwnltG1j1tbZ8HfN+Fw6E2yKxz MA+gL1bAleToAC13GWBZVHiBG+osRtHiYhv+D81jVCElNxNoXIczTxZMoFcO1tdY4yE5 aoYh1IoJ/ZsGzPVxepgKsY+JLKFwQMtgGT17/LevB5GlaWBpTOGeQ+eWG/WfcyH14GrY EMgA== X-Gm-Message-State: AHQUAuYKKOCwicMepYz5kTCZGlqoE9M0f63CZ0CuLu0BHeRtsV/Uf926 iuFvAw3avxaLr01tRV4usurbJA== X-Google-Smtp-Source: AHgI3IZuE92xNSFZW0irgvFT24M3kaH0MuFV2hltDK393g9AAcWnxsUTcadFwluGETSlsaEUbefL4A== X-Received: by 2002:a6b:bc83:: with SMTP id m125mr681310iof.83.1549311569797; Mon, 04 Feb 2019 12:19:29 -0800 (PST) Received: from yngvi.hq.sweptlaser.com ([63.147.146.226]) by smtp.googlemail.com with ESMTPSA id x79sm470003ita.34.2019.02.04.12.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 12:19:29 -0800 (PST) From: Jeremy Gebben To: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/4] hwmon: (lm85) remove freq_map size hardcodes Date: Mon, 4 Feb 2019 13:19:03 -0700 Message-Id: <20190204201906.8859-2-jgebben@sweptlaser.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190204201906.8859-1-jgebben@sweptlaser.com> References: <20190204201906.8859-1-jgebben@sweptlaser.com> 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 Allow support for chips that support more than 8 frequencies. Signed-off-by: Jeremy Gebben --- drivers/hwmon/lm85.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 0a325878e8f5..4b15193d195c 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -198,13 +198,13 @@ static int RANGE_TO_REG(long range) #define RANGE_FROM_REG(val) lm85_range_map[(val) & 0x0f] /* These are the PWM frequency encodings */ -static const int lm85_freq_map[8] = { /* 1 Hz */ +static const int lm85_freq_map[] = { /* 1 Hz */ 10, 15, 23, 30, 38, 47, 61, 94 }; -static const int adm1027_freq_map[8] = { /* 1 Hz */ + +static const int adm1027_freq_map[] = { /* 1 Hz */ 11, 15, 22, 29, 35, 44, 59, 88 }; -#define FREQ_MAP_LEN 8 static int FREQ_TO_REG(const int *map, unsigned int map_size, unsigned long freq) @@ -212,9 +212,9 @@ static int FREQ_TO_REG(const int *map, return find_closest(freq, map, map_size); } -static int FREQ_FROM_REG(const int *map, u8 reg) +static int FREQ_FROM_REG(const int *map, unsigned int map_size, u8 reg) { - return map[reg & 0x07]; + return map[reg % map_size]; } /* @@ -296,6 +296,8 @@ struct lm85_data { struct i2c_client *client; const struct attribute_group *groups[6]; const int *freq_map; + unsigned int freq_map_size; + enum chips type; bool has_vid5; /* true if VID5 is configured for ADT7463 or ADT7468 */ @@ -514,7 +516,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) data->autofan[i].config = lm85_read_value(client, LM85_REG_AFAN_CONFIG(i)); val = lm85_read_value(client, LM85_REG_AFAN_RANGE(i)); - data->pwm_freq[i] = val & 0x07; + data->pwm_freq[i] = val % data->freq_map_size; data->zone[i].range = val >> 4; data->autofan[i].min_pwm = lm85_read_value(client, LM85_REG_AFAN_MINPWM(i)); @@ -791,7 +793,8 @@ static ssize_t show_pwm_freq(struct device *dev, if (IS_ADT7468_HFPWM(data)) freq = 22500; else - freq = FREQ_FROM_REG(data->freq_map, data->pwm_freq[nr]); + freq = FREQ_FROM_REG(data->freq_map, data->freq_map_size, + data->pwm_freq[nr]); return sprintf(buf, "%d\n", freq); } @@ -820,7 +823,7 @@ static ssize_t set_pwm_freq(struct device *dev, lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5); } else { /* Low freq. mode */ data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, - FREQ_MAP_LEN, val); + data->freq_map_size, val); lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), (data->zone[nr].range << 4) | data->pwm_freq[nr]); @@ -1196,7 +1199,7 @@ static ssize_t set_temp_auto_temp_min(struct device *dev, TEMP_FROM_REG(data->zone[nr].limit)); lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), ((data->zone[nr].range & 0x0f) << 4) - | (data->pwm_freq[nr] & 0x07)); + | data->pwm_freq[nr]); mutex_unlock(&data->update_lock); return count; @@ -1232,7 +1235,7 @@ static ssize_t set_temp_auto_temp_max(struct device *dev, val - min); lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), ((data->zone[nr].range & 0x0f) << 4) - | (data->pwm_freq[nr] & 0x07)); + | data->pwm_freq[nr]); mutex_unlock(&data->update_lock); return count; } @@ -1569,9 +1572,11 @@ static int lm85_probe(struct i2c_client *client, const struct i2c_device_id *id) case emc6d103: case emc6d103s: data->freq_map = adm1027_freq_map; + data->freq_map_size = ARRAY_SIZE(adm1027_freq_map); break; default: data->freq_map = lm85_freq_map; + data->freq_map_size = ARRAY_SIZE(lm85_freq_map); } /* Set the VRM version */ From patchwork Mon Feb 4 20:19:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Gebben X-Patchwork-Id: 10796577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDA54922 for ; Mon, 4 Feb 2019 20:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF3BC2C259 for ; Mon, 4 Feb 2019 20:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2322C254; Mon, 4 Feb 2019 20:22:21 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 924682C220 for ; Mon, 4 Feb 2019 20:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727939AbfBDUTc (ORCPT ); Mon, 4 Feb 2019 15:19:32 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:37332 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727904AbfBDUTb (ORCPT ); Mon, 4 Feb 2019 15:19:31 -0500 Received: by mail-it1-f195.google.com with SMTP id b5so2955384iti.2 for ; Mon, 04 Feb 2019 12:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sweptlaser-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Wde6ywv5CF0puEGzOKeSGxb2sXn9lYuppXAmRLphNEk=; b=JIivbSlbp2j/EJ4lWyi9eHg5ZUpbMLDwVOvGctIZGJvvJ8XzHh7LdcyYnz7H+Ag8k1 DQAqYfC7FwlsOfjzlNtyw1xZUu4L3xn0JxOK/rzJiOKiz68duOudGzngUQcw2YH9RpF4 L332KkqM07bzhZBUUwng35EvYo/WcegzTPo8AAghxRszniDf5fmxwgTeEzwOI0HzG5sn cSm1jzDu7vb/zkjOvBooKXStTm5A7asXbVwwjwOJiWJjZkV2NWhGe67xIAU0HzeBBohS HPOwWPcOPYRIzIzakv7sLuZzP+YBeGcKfNWhTrBNwr8elEEyYMvRpP7nd38zWrjCTRUH mfug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Wde6ywv5CF0puEGzOKeSGxb2sXn9lYuppXAmRLphNEk=; b=j558mASVBqhmgnBshop+S9t0MtANelaQHP4bPEavvjyYVt60w43UpDTTv+UhzumTQY zO6p1FGZygH7XGXK/QlGYFQZPhd8EXpMepHJIQQpGBK9MCAsGHQohRy/HFknXe+0dVq/ mcLgcofmjlLiVXn/qgWmVNl+JmSEHkRVuNH5Z3JVvzDRphYcKz/edPchkjv637tkGGn3 zEVAJa72QGAjc26Au11ZiR3D45Gmh2Wy6XReZKO41uB4amIT5pf69Z9xDZ3pHJcM1L6I EICDIzSdg3CZTekerb5SL1gDi/FIgygF247sCLMTXTs3/Z0ItyMci7kBDUWLpAwwL2wA Y2+w== X-Gm-Message-State: AHQUAuZdfMUn/DFSDjKQlsoyu4XEsHgHMsdm2N2yA52aEIyxL80P+oyi L8Y61zVLl90jhxxUQE4dDcBXmw== X-Google-Smtp-Source: AHgI3IZFEfx8auZYTldQHlrfwtdXc3aKOjTgWiYOOmN2SQ6WaM/4XDXaPzI22T9ppFP6Viw9wLwGiw== X-Received: by 2002:a5e:d503:: with SMTP id e3mr827208iom.291.1549311570756; Mon, 04 Feb 2019 12:19:30 -0800 (PST) Received: from yngvi.hq.sweptlaser.com ([63.147.146.226]) by smtp.googlemail.com with ESMTPSA id x79sm470003ita.34.2019.02.04.12.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 12:19:30 -0800 (PST) From: Jeremy Gebben To: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/4] dt-bindings: Add LM96000 as a trivial device Date: Mon, 4 Feb 2019 13:19:04 -0700 Message-Id: <20190204201906.8859-3-jgebben@sweptlaser.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190204201906.8859-1-jgebben@sweptlaser.com> References: <20190204201906.8859-1-jgebben@sweptlaser.com> 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 The LM96000 is a temperature sensor and fan controller based on the LM85. Signed-off-by: Jeremy Gebben Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index cc64ec63a6ad..d79fb22bde39 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -322,6 +322,8 @@ properties: - ti,ads7830 # Temperature Monitoring and Fan Control - ti,amc6821 + # Temperature sensor with integrated fan control + - ti,lm96000 # I2C Touch-Screen Controller - ti,tsc2003 # Low Power Digital Temperature Sensor with SMBUS/Two Wire Serial Interface From patchwork Mon Feb 4 20:19:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Gebben X-Patchwork-Id: 10796579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0920D6C2 for ; Mon, 4 Feb 2019 20:22:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEAE52B649 for ; Mon, 4 Feb 2019 20:22:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED2322C1FA; Mon, 4 Feb 2019 20:22:28 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 CD2602C249 for ; Mon, 4 Feb 2019 20:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727571AbfBDUWV (ORCPT ); Mon, 4 Feb 2019 15:22:21 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:37334 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727928AbfBDUTc (ORCPT ); Mon, 4 Feb 2019 15:19:32 -0500 Received: by mail-it1-f194.google.com with SMTP id b5so2955485iti.2 for ; Mon, 04 Feb 2019 12:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sweptlaser-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=nXElogSJfxXDiCsM3B30I0wm02vakS82aG0ktAJScis=; b=QLypJWLMLOhLnYVSx5E2XKPhzmj6DdRBkMXwxZk5EX/GFtGOhjZO0Wky9kSglICgLQ taC7D5RwM8lvwm4XLLhQ3fs+A9QZNP8DnSCq6TOp6cRAkVdiDNlqxph4YAFp/RKivApn fORyq3QYUnO/iI9hGUYkFLe7VodPSX69dSR6OOSagwO2j3D9AkMnOfuw7be1fvEdKpHg oO2/vLR8Oq9ufgWla9HGA6Dzvhvpsr5lFrDYiqnsOlozexIgQhrWTFCcPa4OKYqXvOFo 9rU/NJSX84H+w2eB+YZm0eORLY5Si3DkN1Ki+0SBwp9QKFVAjsf7TMtGOTI0h3W4AAXH FJVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=nXElogSJfxXDiCsM3B30I0wm02vakS82aG0ktAJScis=; b=awc7RLLyd272oCe5EG75zT5obQKMeCPX2jW9vw+0Ormbsfcvo5nsAKEidntNoRCOCt AVG4PgdkqY8041CnHMq5s0XpgGGUApwr6Lh6esUcSP8vhPbbRkN6vFlLnZ21+CrEQPO7 nnyNItgOCyTpE8xF0THyTTweMI/P1Yy8XkWuvivLZnV4BdxYTQs9wDgKGFachKgkVDZS 0ls97YdPjyjaGfc9eMte6AiTfMaw1EL8I+7weXzTstY5llsDbwo2BohxDqFWtS32Sez5 Gbl/CE1NsW7IP/t/2C2L8aMIfT9tuCqAy2Gt12Ag8iRyLYiUfZ4+avUkykhPNwEhc08G Gaxg== X-Gm-Message-State: AHQUAuYuj/YiUNer6B8Hh1Fm7Ya8u1I+SXLrmujle9kT/OdnXRk9Y5AM t1oLR+JbBhXssOABV7gUb4ZZQAUUdGU= X-Google-Smtp-Source: AHgI3IYBkfdUvhxV7oZPlkWqRxDaTqgCl+ocNyekIIsdwGqHgnCOpesWCPWMMEvr9+CfnCSvQ0f8og== X-Received: by 2002:a6b:c9c8:: with SMTP id z191mr768514iof.13.1549311571680; Mon, 04 Feb 2019 12:19:31 -0800 (PST) Received: from yngvi.hq.sweptlaser.com ([63.147.146.226]) by smtp.googlemail.com with ESMTPSA id x79sm470003ita.34.2019.02.04.12.19.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 12:19:31 -0800 (PST) From: Jeremy Gebben To: Jean Delvare , Guenter Roeck , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/4] hwmon: (lm85) support the LM96000 Date: Mon, 4 Feb 2019 13:19:05 -0700 Message-Id: <20190204201906.8859-4-jgebben@sweptlaser.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190204201906.8859-1-jgebben@sweptlaser.com> References: <20190204201906.8859-1-jgebben@sweptlaser.com> 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 It has been supported as a generic lm85 for quite some time. Signed-off-by: Jeremy Gebben --- Documentation/hwmon/lm85 | 6 +++++- drivers/hwmon/lm85.c | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85 index 7c49feaa79d2..4f531f4acc3f 100644 --- a/Documentation/hwmon/lm85 +++ b/Documentation/hwmon/lm85 @@ -3,9 +3,13 @@ Kernel driver lm85 Supported chips: * National Semiconductor LM85 (B and C versions) - Prefix: 'lm85' + Prefix: 'lm85b' or 'lm85c' Addresses scanned: I2C 0x2c, 0x2d, 0x2e Datasheet: http://www.national.com/pf/LM/LM85.html + * Texas Instruments LM96000 + Prefix: 'lm9600' + Addresses scanned: I2C 0x2c, 0x2d, 0x2e + Datasheet: http://www.ti.com/lit/ds/symlink/lm96000.pdf * Analog Devices ADM1027 Prefix: 'adm1027' Addresses scanned: I2C 0x2c, 0x2d, 0x2e diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 4b15193d195c..b23cf8e4c54b 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -41,7 +41,7 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; enum chips { - lm85, + lm85, lm96000, adm1027, adt7463, adt7468, emc6d100, emc6d102, emc6d103, emc6d103s }; @@ -1499,7 +1499,7 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) "Found Winbond WPCD377I, ignoring\n"); return -ENODEV; } - type_name = "lm85"; + type_name = "lm96000"; break; } } else if (company == LM85_COMPANY_ANALOG_DEV) { @@ -1623,6 +1623,7 @@ static const struct i2c_device_id lm85_id[] = { { "lm85", lm85 }, { "lm85b", lm85 }, { "lm85c", lm85 }, + { "lm96000", lm96000 }, { "emc6d100", emc6d100 }, { "emc6d101", emc6d100 }, { "emc6d102", emc6d102 }, @@ -1657,6 +1658,10 @@ static const struct of_device_id lm85_of_match[] = { .compatible = "national,lm85c", .data = (void *)lm85 }, + { + .compatible = "ti,lm96000", + .data = (void *)lm96000 + }, { .compatible = "smsc,emc6d100", .data = (void *)emc6d100 From patchwork Mon Feb 4 20:19:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Gebben X-Patchwork-Id: 10796527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8461A13B4 for ; Mon, 4 Feb 2019 20:19:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 763742BE4E for ; Mon, 4 Feb 2019 20:19:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 748DD2C1C1; Mon, 4 Feb 2019 20:19:35 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 006862BE4E for ; Mon, 4 Feb 2019 20:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727889AbfBDUTe (ORCPT ); Mon, 4 Feb 2019 15:19:34 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:50190 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbfBDUTd (ORCPT ); Mon, 4 Feb 2019 15:19:33 -0500 Received: by mail-it1-f194.google.com with SMTP id z7so3017921iti.0 for ; Mon, 04 Feb 2019 12:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sweptlaser-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=XDhprpW25ibYQtXn/diyTm923UlnRp+IEFM44smCoIQ=; b=re3rzPlLyL0O9k2gcpHK7yxBTUrO9Aa1v67GpOgvI5DJoVXXYE50ShdSMq+TmReMPr FU0EAVpBeEnq7WAmhSKuVYG6EvlvFtWqbLpBxixHuotxTXaWFKJMBEWySFGfTFucxFlG 66Us6Ix0PVZqg8dC7KdutrRHnBy8OSTdBplci4S7hBuGhX+cFzhfPP3Jmc8TPsybvFIo sfNS5G/KxPrC+qoI2iYaXgrveq1JEFtKJAYTYzmeijPPMEBvn3q/1e/BF3Wx9lYeL4OW v2Zqe8DKPn4ShWOj41eQp+6bsEaMFpQyAvVr0GhgNm6meobvxRJnBnbhAnlFbgN/0LEQ 85BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XDhprpW25ibYQtXn/diyTm923UlnRp+IEFM44smCoIQ=; b=l9ikUYcxdinKJ6rBopaAyGxbn1DOSgyQjmJBZP1xhQq5UKctJNzbgPYsI4JVB3JgQc jFwOeyZL/034zdeZKNgJDwAiiordI0MLBrqRC3/pzWFlMmGnP7ccEjNiQinNdGjrO2Q8 WSRw7VGZp3f4KEjRXrCuTVeMsnk8Gu8Nx3Y5THpJ/OvzqqS0maMUGou02Kh3hylCSMg0 MTGkAxF2/DWHrc/qDLGM7eUz8zQ3bSbJ5+RBHdM1zr/mG2/9Oq/HUvtl+EgSEf3rWZKr dTeTPjUJth1Fjp4QVhjD4YD7xNDMX8E1PlDx+K+Y8ZR1O5VlQjuh9jotjFP7zDJpqkmN bZqA== X-Gm-Message-State: AHQUAubIFJnR3h/R1y3t7UCluMTtIfXieGRDq//1tzZVOywbKSXgv39T OysrWCu0dMXiYuWGfs41ujlS7Q== X-Google-Smtp-Source: AHgI3IbedeEYn+jG2jNNEn1fatbi8B0QrS5thMK38+OMLobx55GzhYweBcEM5kSWdzgC1NzO9mMEpw== X-Received: by 2002:a5e:8f07:: with SMTP id c7mr871510iok.242.1549311572609; Mon, 04 Feb 2019 12:19:32 -0800 (PST) Received: from yngvi.hq.sweptlaser.com ([63.147.146.226]) by smtp.googlemail.com with ESMTPSA id x79sm470003ita.34.2019.02.04.12.19.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 12:19:32 -0800 (PST) From: Jeremy Gebben To: Jean Delvare , Guenter Roeck , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/4] hwmon: (lm85) add support for LM96000 high frequencies Date: Mon, 4 Feb 2019 13:19:06 -0700 Message-Id: <20190204201906.8859-5-jgebben@sweptlaser.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190204201906.8859-1-jgebben@sweptlaser.com> References: <20190204201906.8859-1-jgebben@sweptlaser.com> 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 The LM96000 expands the freqency field from 3 to 4 bits, to add more frequencies in the 22.5 to 30 kHz ranges. Signed-off-by: Jeremy Gebben --- Documentation/hwmon/lm85 | 3 +++ drivers/hwmon/lm85.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85 index 4f531f4acc3f..2329c383efe4 100644 --- a/Documentation/hwmon/lm85 +++ b/Documentation/hwmon/lm85 @@ -140,6 +140,9 @@ of voltage and temperature channels. SMSC EMC6D103S is similar to EMC6D103, but does not support pwm#_auto_pwm_minctl and temp#_auto_temp_off. +The LM96000 supports additional high frequency PWM modes (22.5 kHz, 24 kHz, +25.7 kHz, 27.7 kHz and 30 kHz), which can be configured on a per-PWM basis. + Hardware Configurations ----------------------- diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index b23cf8e4c54b..a95d48316f06 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -202,6 +202,11 @@ static const int lm85_freq_map[] = { /* 1 Hz */ 10, 15, 23, 30, 38, 47, 61, 94 }; +static const int lm96000_freq_map[] = { /* 1 Hz */ + 10, 15, 23, 30, 38, 47, 61, 94, + 22500, 24000, 25700, 25700, 27700, 27700, 30000, 30000 +}; + static const int adm1027_freq_map[] = { /* 1 Hz */ 11, 15, 22, 29, 35, 44, 59, 88 }; @@ -1574,6 +1579,10 @@ static int lm85_probe(struct i2c_client *client, const struct i2c_device_id *id) data->freq_map = adm1027_freq_map; data->freq_map_size = ARRAY_SIZE(adm1027_freq_map); break; + case lm96000: + data->freq_map = lm96000_freq_map; + data->freq_map_size = ARRAY_SIZE(lm96000_freq_map); + break; default: data->freq_map = lm85_freq_map; data->freq_map_size = ARRAY_SIZE(lm85_freq_map);