From patchwork Fri Dec 13 15:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Zaikonnikov X-Patchwork-Id: 11290767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD9086C1 for ; Fri, 13 Dec 2019 20:37:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6283F24718 for ; Fri, 13 Dec 2019 20:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=trafsysas.onmicrosoft.com header.i=@trafsysas.onmicrosoft.com header.b="cjhWDXUq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727948AbfLMPza (ORCPT ); Fri, 13 Dec 2019 10:55:30 -0500 Received: from mail-eopbgr10115.outbound.protection.outlook.com ([40.107.1.115]:9535 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727937AbfLMPza (ORCPT ); Fri, 13 Dec 2019 10:55:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bqceUWBkAUVEKdilUNJYVw1RM5AtcIb+cRTQEswXWh7ZJYj5xfxH4bSqdpFBU3MA0KCfx7CK2SOl9s+TnmkDKAf75c3/vJKbGn8lUxBJ6NWtwE7PnWwXGFeQ0MOx+6w/XIJzdmcmR9JLiD+gNTJZnx153tKOF5gKA1p7IkdAf0USQbLrpzZLHNoanARcqJr/a7rlsdkFheXcwB/3raQIqS8mLi0JOhB5I3DuZupPHvB5jpar+cyR9LWulnQiqO/0jHOQ9DFT64O+QdL8+6QNWG9ORAndxjTJvGzsM+QcU6zn+9sLBetK4Qutph7/LkhR3rZJcJ2Z9uPGBTlX+Tfo0g== 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=yxlT9v54cPuIo/eW9MCJDO3TEtce4bEFuR8FLbYcixM=; b=Gsjp3TsXZ6+Vb+fnFa7F/scfPa60soEixQxAR19oi2l30oEunH2FvT7akcQ0HqIEY8IGbQsjstYMD0MhTvc+WHh0nsfYi4BDUWkwlyDZTx3wpjuB1Yw3d5wsBaDwPGyM9sSpW4Chj5bMtK6fCyOP0ZxiJ3Mf/RMng8arTrte/vFR4/gMmJcWNEA6REWRpl+oSDK8XjUfk7N7OBQnpUJZdioWOHn5xbqfOnQwpUDTMmCMKK8BzCe06ilFMU4jgNRZrgTiJjIvw98y7kl4ghEBDO6/38zjx3ipPjLvqp/bOjF+saJTKfBak7k/c5/kCRk4oa78/59uT0AVn+8SGF/ifw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=norphonic.com; dmarc=pass action=none header.from=norphonic.com; dkim=pass header.d=norphonic.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trafsysas.onmicrosoft.com; s=selector2-trafsysas-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yxlT9v54cPuIo/eW9MCJDO3TEtce4bEFuR8FLbYcixM=; b=cjhWDXUqa97dvgh6lqeaQAa3/r/FFdGh4R0h/RWHRaUQY4K/1tgpCFRQGChST2X42cQtuZhdL9y67GYjPORcyS+UcasoK0VehnF2dJ0jzL1DTrt1MkNHhpSOwEtP9OKWRP86ZKuDMPLmCcW30dZVtQDsYcGRPNi5NW3qHGpYpX4= Received: from VI1PR06MB5790.eurprd06.prod.outlook.com (20.177.202.94) by VI1PR06MB4655.eurprd06.prod.outlook.com (20.178.12.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Fri, 13 Dec 2019 15:55:23 +0000 Received: from VI1PR06MB5790.eurprd06.prod.outlook.com ([fe80::a56e:b59e:d95f:c568]) by VI1PR06MB5790.eurprd06.prod.outlook.com ([fe80::a56e:b59e:d95f:c568%4]) with mapi id 15.20.2538.017; Fri, 13 Dec 2019 15:55:23 +0000 From: Eugene Zalkonnikov To: Jonathan Cameron CC: Hartmut Knaack , Lars-Peter Clausen , "development@norphonic.com" , "linux-iio@vger.kernel.org" Subject: [PATCH v3 1/2] Driver for TI HDC20x0 humidity and temperature sensors Thread-Topic: [PATCH v3 1/2] Driver for TI HDC20x0 humidity and temperature sensors Thread-Index: AQHVsc26SON/FxISfkecdCGvyqtp7Q== Date: Fri, 13 Dec 2019 15:55:23 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ez@norphonic.com; x-originating-ip: [62.97.226.122] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea89e289-88bd-4cea-d3d7-08d77fe4dd2a x-ms-traffictypediagnostic: VI1PR06MB4655: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0250B840C1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(376002)(366004)(396003)(39840400004)(136003)(199004)(189003)(76116006)(66476007)(6916009)(91956017)(66556008)(36756003)(66946007)(66446008)(86362001)(2906002)(508600001)(64756008)(81166006)(81156014)(6512007)(4743002)(54906003)(5660300002)(8676002)(4326008)(316002)(2616005)(71200400001)(33656002)(26005)(8936002)(186003)(966005)(6486002)(6506007);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR06MB4655;H:VI1PR06MB5790.eurprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: norphonic.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +Mp+DUGZo3AY88jasyyN+O5V/fzAVC+1QdBjAVrtiKErWO+3bDJg/JxTsz5bGxjGLqChXEIauWzXrYgSsBk0iZFb57ihktZJC750/ZAPj5A64Tk1KKX24NHyiltoiAz9eYqUEUwxaZC029KeQNsxRyly9PTW5GVEYI4Y6GuFERDPfrrx7zn1NOPPtrkfrwAy4DVkZHZROMwOXKX7UKrJWD7cAb2LafZB6rImxWZeZ2wFvOJ7qsylmaeQw0o3ZJSFHhfUDHqsJbX1V6VqdI22rfEYEofgH5lzaVaFJMQfpDlUb24mjkVXtF1wFL2DN2QUvt6aLwS8J3yHru1B7JLIvVN2aU7yy1A+s7YsDCv/yRHhenrbU84CzdpND/NMtIDjJDb4AN+km4Wegd9rakR8IX8JVsBPYOuz9Dyn8yuL7n8d43jYp36b6GJvBSwaccw6QqUOrjBcqjuPbR4vrZC2SNpeEcJGQDlJKVMNBVRyNXc= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: norphonic.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea89e289-88bd-4cea-d3d7-08d77fe4dd2a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2019 15:55:23.4567 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: cbf3f496-45ad-415e-97cb-4e62d6cd974f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: VrQS8rgF7zNckYDMuag4pAQQ7IM8IvLe/IBYp1LzA3lopk0QRDrlzzADkKMR+rpy10Yby3eXvHmJWz6EP2oMww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB4655 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Changes to scope of locking. Signed-off-by: Eugene Zaikonnikov diff -uprN -X linux-5.3.8/Documentation/dontdiff linux-5.3.8/drivers/iio/humidity/hdc2010.c linux-5.3.8_hdc2010/drivers/iio/humidity/hdc2010.c --- linux-5.3.8/drivers/iio/humidity/hdc2010.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-5.3.8_hdc2010/drivers/iio/humidity/hdc2010.c 2019-12-13 16:44:13.321334255 +0100 @@ -0,0 +1,332 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * hdc2010.c - Support for the TI HDC2010 and HDC2080 + * temperature + relative humidity sensors + * + * Copyright (C) 2019 Norphonic AS + * Author: Eugene Zaikonnikov + * + * Datasheets: + * http://www.ti.com/product/HDC2010/datasheet + * http://www.ti.com/product/HDC2080/datasheet + */ + +#include +#include +#include + +#include +#include + +#define HDC2010_REG_TEMP_LOW 0x00 +#define HDC2010_REG_TEMP_HIGH 0x01 +#define HDC2010_REG_HUMIDITY_LOW 0x02 +#define HDC2010_REG_HUMIDITY_HIGH 0x03 +#define HDC2010_REG_INTERRUPT_DRDY 0x04 +#define HDC2010_REG_TEMP_MAX 0x05 +#define HDC2010_REG_HUMIDITY_MAX 0x06 +#define HDC2010_REG_INTERRUPT_EN 0x07 +#define HDC2010_REG_TEMP_OFFSET_ADJ 0x08 +#define HDC2010_REG_HUMIDITY_OFFSET_ADJ 0x09 +#define HDC2010_REG_TEMP_THR_L 0x0a +#define HDC2010_REG_TEMP_THR_H 0x0b +#define HDC2010_REG_RH_THR_L 0x0c +#define HDC2010_REG_RH_THR_H 0x0d +#define HDC2010_REG_RESET_DRDY_INT_CONF 0x0e +#define HDC2010_REG_MEASUREMENT_CONF 0x0f + +#define HDC2010_MEAS_CONF GENMASK(2, 1) +#define HDC2010_MEAS_TRIG BIT(0) +#define HDC2010_HEATER_EN BIT(3) +#define HDC2010_AMM GENMASK(6, 4) + +struct hdc2010_data { + struct i2c_client *client; + struct mutex lock; + u8 measurement_config; + u8 interrupt_config; + u8 drdy_config; +}; + +enum hdc2010_addr_groups { + HDC2010_GROUP_TEMP = 0, + HDC2010_GROUP_HUMIDITY +}; + +struct hdc2010_reg_record { + unsigned long primary; + unsigned long peak; +}; + +static const struct hdc2010_reg_record hdc2010_reg_translation[] = { + [HDC2010_GROUP_TEMP] = { + .primary = HDC2010_REG_TEMP_LOW, + .peak = HDC2010_REG_TEMP_MAX, + }, + [HDC2010_GROUP_HUMIDITY] = { + .primary = HDC2010_REG_HUMIDITY_LOW, + .peak = HDC2010_REG_HUMIDITY_MAX, + }, +}; + +static IIO_CONST_ATTR(out_current_heater_raw_available, + "0 1"); + +static struct attribute *hdc2010_attributes[] = { + &iio_const_attr_out_current_heater_raw_available.dev_attr.attr, + NULL +}; + +static const struct attribute_group hdc2010_attribute_group = { + .attrs = hdc2010_attributes, +}; + +static const struct iio_chan_spec hdc2010_channels[] = { + { + .type = IIO_TEMP, + .address = HDC2010_GROUP_TEMP, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_PEAK) | + BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type = IIO_HUMIDITYRELATIVE, + .address = HDC2010_GROUP_HUMIDITY, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_PEAK) | + BIT(IIO_CHAN_INFO_SCALE), + }, + { + .type = IIO_CURRENT, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .extend_name = "heater", + .output = 1, + }, + IIO_CHAN_SOFT_TIMESTAMP(2), +}; + +static int hdc2010_update_drdy_config(struct hdc2010_data *data, + char mask, char val) +{ + char tmp = (~mask & data->drdy_config) | val; + int ret; + + ret = i2c_smbus_write_byte_data(data->client, + HDC2010_REG_RESET_DRDY_INT_CONF, tmp); + if (!ret) + data->drdy_config = tmp; + + return ret; +} + +static int hdc2010_get_measurement_word(struct hdc2010_data *data, + struct iio_chan_spec const *chan) +{ + struct i2c_client *client = data->client; + s32 ret; + + ret = i2c_smbus_read_word_data(data->client, + hdc2010_reg_translation[chan->address].primary); + + if (ret < 0) { + dev_err(&client->dev, "Could not read sensor data\n"); + } + + return ret; +} + +static int hdc2010_get_measurement_byte(struct hdc2010_data *data, + struct iio_chan_spec const *chan) +{ + struct i2c_client *client = data->client; + s32 ret; + + ret = i2c_smbus_read_byte_data(data->client, + hdc2010_reg_translation[chan->address].peak); + + if (ret < 0) { + dev_err(&client->dev, "Could not read sensor data\n"); + } + + return ret; +} + +static int hdc2010_get_heater_status(struct hdc2010_data *data) +{ + return !!(data->drdy_config & HDC2010_HEATER_EN); +} + +static int hdc2010_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct hdc2010_data *data = iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: { + int ret; + + if (chan->type == IIO_CURRENT) { + *val = hdc2010_get_heater_status(data); + ret = IIO_VAL_INT; + } else { + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + mutex_lock(&data->lock); + ret = hdc2010_get_measurement_word(data, chan); + mutex_unlock(&data->lock); + iio_device_release_direct_mode(indio_dev); + if (ret >= 0) { + *val = ret; + ret = IIO_VAL_INT; + } else + ret = -EINVAL; + } + return ret; + } + case IIO_CHAN_INFO_PEAK: { + int ret; + + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + mutex_lock(&data->lock); + ret = hdc2010_get_measurement_byte(data, chan); + mutex_unlock(&data->lock); + iio_device_release_direct_mode(indio_dev); + if (ret >= 0) { + /* Scaling up the value so we can use same offset as RAW */ + *val = ret * 256; + ret = IIO_VAL_INT; + } else + ret = -EINVAL; + return ret; + } + case IIO_CHAN_INFO_SCALE: + *val2 = 65536; + if (chan->type == IIO_TEMP) + *val = 165000; + else + *val = 100000; + return IIO_VAL_FRACTIONAL; + case IIO_CHAN_INFO_OFFSET: + *val = -15887; + *val2 = 515151; + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +} + +static int hdc2010_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct hdc2010_data *data = iio_priv(indio_dev); + int new, ret = -EINVAL; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (chan->type != IIO_CURRENT || val2 != 0) + return -EINVAL; + + if (val == 1) + new = HDC2010_HEATER_EN; + else if (!val) + new = 0; + else + return -EINVAL; + + mutex_lock(&data->lock); + ret = hdc2010_update_drdy_config(data, HDC2010_HEATER_EN, new); + mutex_unlock(&data->lock); + return ret; + default: + return -EINVAL; + } +} + +static const struct iio_info hdc2010_info = { + .read_raw = hdc2010_read_raw, + .write_raw = hdc2010_write_raw, + .attrs = &hdc2010_attribute_group, +}; + +static int hdc2010_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct iio_dev *indio_dev; + struct hdc2010_data *data; + u8 tmp; + int ret; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C)) + return -EOPNOTSUPP; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + mutex_init(&data->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->name = dev_name(&client->dev); + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &hdc2010_info; + + indio_dev->channels = hdc2010_channels; + indio_dev->num_channels = ARRAY_SIZE(hdc2010_channels); + + /* Enable Automatic Measurement Mode at 5Hz */ + hdc2010_update_drdy_config(data, HDC2010_AMM, HDC2010_AMM); + + /* + * We enable both temp and humidity measurement. + * However the measurement won't start even in AMM until triggered. + */ + tmp = (u8)(~HDC2010_MEAS_CONF | + HDC2010_MEAS_TRIG & data->measurement_config) | + HDC2010_MEAS_TRIG; + + ret = i2c_smbus_write_byte_data(data->client, + HDC2010_REG_MEASUREMENT_CONF, tmp); + if (ret) + return ret; + data->measurement_config = tmp; + + return devm_iio_device_register(&client->dev, indio_dev); +} + +static const struct i2c_device_id hdc2010_id[] = { + { "hdc2010", 0 }, + { "hdc2080", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, hdc2010_id); + +static const struct of_device_id hdc2010_dt_ids[] = { + { .compatible = "ti,hdc2010" }, + { .compatible = "ti,hdc2080" }, + { } +}; +MODULE_DEVICE_TABLE(of, hdc2010_dt_ids); + +static struct i2c_driver hdc2010_driver = { + .driver = { + .name = "hdc2010", + .of_match_table = of_match_ptr(hdc2010_dt_ids), + }, + .probe = hdc2010_probe, + .id_table = hdc2010_id, +}; +module_i2c_driver(hdc2010_driver); + +MODULE_AUTHOR("Eugene Zaikonnikov "); +MODULE_DESCRIPTION("TI HDC2010 humidity and temperature sensor driver"); +MODULE_LICENSE("GPL"); diff -uprN -X linux-5.3.8/Documentation/dontdiff linux-5.3.8/drivers/iio/humidity/Kconfig linux-5.3.8_hdc2010/drivers/iio/humidity/Kconfig --- linux-5.3.8/drivers/iio/humidity/Kconfig 2019-10-29 09:22:48.000000000 +0100 +++ linux-5.3.8_hdc2010/drivers/iio/humidity/Kconfig 2019-11-28 14:31:27.794242693 +0100 @@ -38,6 +38,16 @@ config HDC100X To compile this driver as a module, choose M here: the module will be called hdc100x. +config HDC2010 + tristate "TI HDC2010 relative humidity and temperature sensor" + depends on I2C + help + Say yes here to build support for the Texas Instruments + HDC2010 and HDC2080 relative humidity and temperature sensors. + + To compile this driver as a module, choose M here: the module + will be called hdc2010. + config HID_SENSOR_HUMIDITY tristate "HID Environmental humidity sensor" depends on HID_SENSOR_HUB diff -uprN -X linux-5.3.8/Documentation/dontdiff linux-5.3.8/drivers/iio/humidity/Makefile linux-5.3.8_hdc2010/drivers/iio/humidity/Makefile --- linux-5.3.8/drivers/iio/humidity/Makefile 2019-10-29 09:22:48.000000000 +0100 +++ linux-5.3.8_hdc2010/drivers/iio/humidity/Makefile 2019-11-28 14:30:40.609892061 +0100 @@ -6,6 +6,7 @@ obj-$(CONFIG_AM2315) += am2315.o obj-$(CONFIG_DHT11) += dht11.o obj-$(CONFIG_HDC100X) += hdc100x.o +obj-$(CONFIG_HDC2010) += hdc2010.o obj-$(CONFIG_HID_SENSOR_HUMIDITY) += hid-sensor-humidity.o hts221-y := hts221_core.o \ From patchwork Fri Dec 13 15:57:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Zaikonnikov X-Patchwork-Id: 11290769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02856188B for ; Fri, 13 Dec 2019 20:37:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8B6B2470C for ; Fri, 13 Dec 2019 20:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=trafsysas.onmicrosoft.com header.i=@trafsysas.onmicrosoft.com header.b="KhgLdelc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbfLMP5f (ORCPT ); Fri, 13 Dec 2019 10:57:35 -0500 Received: from mail-eopbgr10133.outbound.protection.outlook.com ([40.107.1.133]:61571 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727970AbfLMP5e (ORCPT ); Fri, 13 Dec 2019 10:57:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TFAZBG4NVMOWTS+M7YgOPMzreiVoIoadHuKmZL57WiBt4MiO7hyTYZpf5NCMA8E6Qqidz1cJQ53rotgosIX3xLu6S7SLN0v6YJUq141Zl6PTpXj2qRmP6g0x6mj00kZtUnrE91b5lR3XO7yNY5n66NWYhjCEKOYsOaksCBuIcheNNrA8agYNEYVbfhGzY4Y3dKLTKw0VYiH+8wP9D5ZdvZDra2x1zIETzIVcJ9pIUhMw49Xaljju0ISMuy1vRaCv+X7ImyQEYZ5P42RReCCa3uqtMJkArf4rVCmr58fv5GBN0dneuRUDZW7PtyyuRfSDT6YlGTL1IF17bLTixqKYjQ== 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=z9D7G2PAc3eBqw7ZZdGrj21vxZIY9SjcWMpWhZsNrWw=; b=eobdiNQgo66o9l/8CTP4OK8Wirm89Mezl4rejAFTFDsp32VR1Qti36u1CeoJP1gzeCLTeax1U/taE+4nYFYa14MInD0DLgQ5zWFvs17nAc7szB0rWVAKC51hLly/936BFxi9dfhBkLDEXVk/qyzKen3Tuhwp7tGHpGREDj41f69rNnvtmK6dEeTXCkGmo6WDyb26GRj8d9L7KEh+m/EbtJHqYUEViUrIaJ6XqCXhBOJ6PsLwpUuG6afGk86otF4nQzbsZ0owUL+mgJmQ4fmmi+N4PZq6oH8ayxbuRz78y9OkEZvuGMFvqUgFnzfqkIbV7VCWtYuOWcKYuZ4YNL4l0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=norphonic.com; dmarc=pass action=none header.from=norphonic.com; dkim=pass header.d=norphonic.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trafsysas.onmicrosoft.com; s=selector2-trafsysas-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z9D7G2PAc3eBqw7ZZdGrj21vxZIY9SjcWMpWhZsNrWw=; b=KhgLdelc6kq0NM1kVWyNhCwsH/NqIkdi+laSDRDyooxSe6r5W0jL+uMoRvTWOIqNENMnUcsB7C+aRRWJOveZnVF/oOyBsAK2vnYXYSNqkT37kOqKJGgzw05pP/bspXscPTudH9b6eIPALm2vyR9NH3rlOz05Hwk/Ei9XbA2yD9w= Received: from VI1PR06MB5790.eurprd06.prod.outlook.com (20.177.202.94) by VI1PR06MB4655.eurprd06.prod.outlook.com (20.178.12.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Fri, 13 Dec 2019 15:57:30 +0000 Received: from VI1PR06MB5790.eurprd06.prod.outlook.com ([fe80::a56e:b59e:d95f:c568]) by VI1PR06MB5790.eurprd06.prod.outlook.com ([fe80::a56e:b59e:d95f:c568%4]) with mapi id 15.20.2538.017; Fri, 13 Dec 2019 15:57:30 +0000 From: Eugene Zalkonnikov To: Jonathan Cameron CC: Hartmut Knaack , Lars-Peter Clausen , "development@norphonic.com" , "linux-iio@vger.kernel.org" Subject: [PATCH v3 2/2] Device tree bindings for TI HDC20x0 humidity and temperature sensors Thread-Topic: [PATCH v3 2/2] Device tree bindings for TI HDC20x0 humidity and temperature sensors Thread-Index: AQHVsc4Gytr7x7X/eUavMykfYM9BXg== Date: Fri, 13 Dec 2019 15:57:30 +0000 Message-ID: <05D5E061-47A3-4446-BC4C-558B2DA054D3@norphonic.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ez@norphonic.com; x-originating-ip: [62.97.226.122] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7f2c36ae-4bff-454e-297e-08d77fe528e1 x-ms-traffictypediagnostic: VI1PR06MB4655: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2733; x-forefront-prvs: 0250B840C1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(376002)(366004)(396003)(39840400004)(136003)(199004)(189003)(76116006)(66476007)(6916009)(91956017)(66556008)(36756003)(66946007)(66446008)(86362001)(2906002)(508600001)(64756008)(81166006)(81156014)(6512007)(4743002)(54906003)(5660300002)(8676002)(4326008)(316002)(2616005)(71200400001)(33656002)(26005)(8936002)(186003)(966005)(6486002)(6506007);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR06MB4655;H:VI1PR06MB5790.eurprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: norphonic.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Bg17JrXLsimyXxsiBMWFuIqzRHiEQJVjYcABGtabnQHRjg20CPWcFJ+h1f9z4s0JMSbsxsfnjfQ98qjSX3AvT8rNa4JYrybLJn6jfsiytSpIQCgibkmwvsZ8cN24wr1dQDEr6AaR8q5Wt8FzXu28MiZDE2EHRz0JjvFEojcQ+kihfkUTTldFUJ5GAPdar6/jiPWXVeW23sp+qo7ibI3bfUh4Xgy2TDqwlGgxE8hfaMhDTcQW6B8z/k6Aqq0QfVfeju+g5o67JOWt85VdVvjeWyAnflNu9q+mtawlq30pZ7gsSLOTwFkNh03C0UD0bFatonuPOP0XX5fUYvig8KLM9zFn3Wv0cs1Egot5SI0c4UWxUJ5gvuqHfV9zzqNtorlJY+5k1s16AM7Smd6uAY72QFq3hdeuSX/5qJs2PW7a34vzNdE70rjp+L4E3u61da+ppQvKAdS+lFWv5/OTUXE+JMK6LdLd1NEjENKAmWZNlMM= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: norphonic.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f2c36ae-4bff-454e-297e-08d77fe528e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2019 15:57:30.5058 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: cbf3f496-45ad-415e-97cb-4e62d6cd974f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: J0pQjYdHky232QoqLf+lj1QUsrp/O8hEjfkHITD6s/nwHHSjCUyQxPioJTpTpdy/tWTz99delihyKUWaxjKR4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR06MB4655 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Signed-off-by: Eugene Zaikonnikov diff -uprN linux-5.3.8/Documentation/ABI/testing/sysfs-bus-iio-humidity-hdc2010 linux-5.3.8_docs/Documentation/ABI/testing/sysfs-bus-iio-humidity-hdc2010 --- linux-5.3.8/Documentation/ABI/testing/sysfs-bus-iio-humidity-hdc2010 1970-01-01 01:00:00.000000000 +0100 +++ linux-5.3.8_docs/Documentation/ABI/testing/sysfs-bus-iio-humidity-hdc2010 2019-12-02 11:09:25.803326999 +0100 @@ -0,0 +1,9 @@ +What: /sys/bus/iio/devices/iio:deviceX/out_current_heater_raw +What: /sys/bus/iio/devices/iio:deviceX/out_current_heater_raw_available +KernelVersion: 5.3.8 +Contact: linux-iio@vger.kernel.org +Description: + Controls the heater device within the humidity sensor to get + rid of excess condensation. + + Valid control values are 0 = OFF, and 1 = ON. diff -uprN linux-5.3.8/Documentation/devicetree/bindings/iio/humidity/hdc2010.yaml linux-5.3.8_docs/Documentation/devicetree/bindings/iio/humidity/hdc2010.yaml --- linux-5.3.8/Documentation/devicetree/bindings/iio/humidity/hdc2010.yaml 1970-01-01 01:00:00.000000000 +0100 +++ linux-5.3.8_docs/Documentation/devicetree/bindings/iio/humidity/hdc2010.yaml 2019-12-02 08:43:32.508277082 +0100 @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/humidity/hdc2010.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HDC2010/HDC2080 humidity and temperature iio sensors + +maintainers: + - Eugene Zaikonnikov + +description: | + Relative humidity and tempereature sensors on I2C bus + + Datasheets are available at: + http://www.ti.com/product/HDC2010/datasheet + http://www.ti.com/product/HDC2080/datasheet + +properties: + compatible: + enum: + - ti,hdc2010 + - ti,hdc2080 + + interrupts: + description: + interrupt mapping for IRQ + maxItems: 1 + +required: + - compatible + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + hdc200x@40 { + compatible = "ti,hdc2010"; + reg = <0x40>; + }; + };