Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1045149ybt; Tue, 7 Jul 2020 06:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMMo6fTf/WrxsMP5t8P2yICKdKaI3lYl0x3rU7GaA+wanvOMR3NkWFPn3vll0n8BqFWaO7 X-Received: by 2002:aa7:d04a:: with SMTP id n10mr63114916edo.132.1594129014972; Tue, 07 Jul 2020 06:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594129014; cv=none; d=google.com; s=arc-20160816; b=vdSsa7ETMU0hgCXMSFhvroTrEMjKt8fX9S9diVoQKZYgKL1Kygo0eyp6sRGA0+veKn ygJAJ4D5QOgeG8dBAQGetPnVQzKdrhICHVBpV1f0/4jGWvw1DKjAJDjuVvR5Yu6LYnSo 4H4CZtE2RqsmQ81autjzarZZku4yi6wsqnBoBNJ1gbGuGVODG0RT2powOJm4L9H0KPsv +BJbeRV6oW+JT8aUeq/qtztg9HcO012zh9D9d3htyRTfgM4jiSmER+Sc/lHV1dFb2++2 0/PwqdZMtq1r6ECVFTY9KIKBBlVIe/5XB0+OIEyUSVyiqktx2Mmc6HFEPm72dOpHjTeP a7uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=rba0+/EuRhhUcr8Ye+cdIuQHVXXU4BWfVIEg0RcA/xA=; b=Jl0IrrwkF+ouZP/eYL5imIH+93hvs7tRagCp3APbBcknAKnItBF/5jYghOMvjkwCSp iXIKxjpbc7KCIdZBQcKxwVZMPB5kqg4ARhANMX+Py/q3qQAWfYV0xUIxvVwSNQXKjFdZ 1IQMSkoGNbB52gNqqyblVn4ueDlzIy0AHGpGkmo0EzVT2a8jB9e5wOViLrEMwrSVtuEl OZ4QIKevtj8JfGVrBmlnzhpPGzdp3mfJ4UluVrx87nHyh1uwwd2/NMq4g9YjR6JqvVZD tu+PmofOtmishsZ9nO+RpsLTbt835Bu2dIHoPvwLUbk45PXLb1iVIi6sOCHXkmCZf9Ni VLiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Y1qEte5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si15600057edr.502.2020.07.07.06.36.31; Tue, 07 Jul 2020 06:36:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Y1qEte5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbgGGNfk (ORCPT + 99 others); Tue, 7 Jul 2020 09:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727987AbgGGNfk (ORCPT ); Tue, 7 Jul 2020 09:35:40 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492F7C061755; Tue, 7 Jul 2020 06:35:40 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id m9so8186613pfh.0; Tue, 07 Jul 2020 06:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=rba0+/EuRhhUcr8Ye+cdIuQHVXXU4BWfVIEg0RcA/xA=; b=Y1qEte5JG5fzV82+gBU9bc3hrKeZorMmLDq7pEgrLd9mme+lzJZRhmMXNSj6EUzeLv yEYtaQdLrr0wFR+jTu15NwGhcx2CiPY4BgoQiOJTURPSXXS6SbTlr+WmYg6tcOFYtNsD y3nDJIm2kEtlFDyX/BFxxj4s/Ed14puOliFKtIwAjQHNb6o5tq4FLUyWRXSEasMAltEO slgPy92HZjtZmjsrL/VX6LtMCT3zWe451iaL9OjXP/fx2xDbnpqfVveRk1h1ajom75+a VVBV4PokEhSMLHS3JXKMVZThCOJPXtYTK3bDn+d0LjTrCGpy4da0GKakVwWFAld3HQW6 rj2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mime-version:content-disposition:user-agent; bh=rba0+/EuRhhUcr8Ye+cdIuQHVXXU4BWfVIEg0RcA/xA=; b=XuzSL0mjynQdBUuI0ijIwJan8gLUQ9rREZc1E8HVsCmE0AcAnk85ddULZIui+2VWyj SNKrf4t9Kz9CLz81X1BkfdNruqW7AAvgHUApoRa5I4ejFva8nSBPd4XsJKrMUf3k22GV HPl+0M6tObtYuDioZPIt5WAQDuFHhqUj0DAWK5INzEwH4LJIBJIF6bBx94baxJ8FmPpl uXe9kWA8jDmGJqiA1MO/NlIN63sytJfAfHmcG338Bm+bFWfIbNjsHoZwSKpqNUiwqJX3 7lbm2cDZToFqwaRZIvObH/kpv4ddV0+6HZ+jb5mp8i0Jyc8dizjMnZfj1luq13Tqts42 Qv3A== X-Gm-Message-State: AOAM533jKJA3/1ICgMr366Cq+tuSeAgYvLx4LSsskbPz/J2J1s/mWaKc giA7lWJ3gEP06VzXmakE/NQ1RyI/3yU= X-Received: by 2002:a62:2641:: with SMTP id m62mr19970062pfm.263.1594128939869; Tue, 07 Jul 2020 06:35:39 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id x10sm1019289pgp.47.2020.07.07.06.35.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jul 2020 06:35:39 -0700 (PDT) Date: Tue, 7 Jul 2020 06:35:38 -0700 From: Guenter Roeck To: Chris Ruehl Cc: Jack Lo , devicetree@vger.kernel.org, Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] hwmon: shtc1: add support for device tree bindings Message-ID: <20200707133538.GA217605@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 07, 2020 at 04:01:02PM +0800, Chris Ruehl wrote: > Add support for DTS bindings for the sensirion shtc1,shtw1 and shtc3. > > Signed-off-by: Chris Ruehl For my reference: Reviewed-by: Guenter Roeck Waiting for feedback/approval from DT maintainers. Thanks, Guenter > --- > drivers/hwmon/shtc1.c | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c > index a0078ccede03..827d421b2b8f 100644 > --- a/drivers/hwmon/shtc1.c > +++ b/drivers/hwmon/shtc1.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > /* commands (high precision mode) */ > static const unsigned char shtc1_cmd_measure_blocking_hpm[] = { 0x7C, 0xA2 }; > @@ -196,6 +197,7 @@ static int shtc1_probe(struct i2c_client *client, > enum shtcx_chips chip = id->driver_data; > struct i2c_adapter *adap = client->adapter; > struct device *dev = &client->dev; > + struct device_node *np = dev->of_node; > > if (!i2c_check_functionality(adap, I2C_FUNC_I2C)) { > dev_err(dev, "plain i2c transactions not supported\n"); > @@ -233,8 +235,14 @@ static int shtc1_probe(struct i2c_client *client, > data->client = client; > data->chip = chip; > > - if (client->dev.platform_data) > - data->setup = *(struct shtc1_platform_data *)dev->platform_data; > + if (np) { > + data->setup.blocking_io = of_property_read_bool(np, "sensirion,blocking_io"); > + data->setup.high_precision = !of_property_read_bool(np, "sensicon,low_precision"); > + } else { > + if (client->dev.platform_data) > + data->setup = *(struct shtc1_platform_data *)dev->platform_data; > + } > + > shtc1_select_command(data); > mutex_init(&data->update_lock); > > @@ -257,8 +265,19 @@ static const struct i2c_device_id shtc1_id[] = { > }; > MODULE_DEVICE_TABLE(i2c, shtc1_id); > > +static const struct of_device_id shtc1_of_match[] = { > + { .compatible = "sensirion,shtc1" }, > + { .compatible = "sensirion,shtw1" }, > + { .compatible = "sensirion,shtc3" }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, shtc1_of_match); > + > static struct i2c_driver shtc1_i2c_driver = { > - .driver.name = "shtc1", > + .driver = { > + .name = "shtc1", > + .of_match_table = shtc1_of_match, > + }, > .probe = shtc1_probe, > .id_table = shtc1_id, > }; > -- > 2.20.1 >