Received: by 10.223.176.46 with SMTP id f43csp818369wra; Fri, 26 Jan 2018 07:23:56 -0800 (PST) X-Google-Smtp-Source: AH8x224v54AM9gN/aEv2/y5t9FlJUG3LUo4OepOMK7WjlUvgLalJAlr5R+iAkiwRmfdUbgZqsma0 X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr14604633plg.268.1516980236272; Fri, 26 Jan 2018 07:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516980236; cv=none; d=google.com; s=arc-20160816; b=whYaD1+27bAklBRPiI1YPCr7mm8RyekSjhg3R+0sDY7s0NlOO29KzhNPhs09F6o0q0 iP+9fzQg+Z4TUmvp7OOabvzbWLUJSlufbFaxm8VXK4PNliSHCdvz1zfJDOjE8NHu3cjD lHhbT9LH1yW2KrMWJLnH1onFMvF1hSPWc9RV0G7/ZpABXuyF6erImlCIrup5zeBk8K5q OW58/evbFy4DDwukSjDIMTq9jwMtzgEegfpe3AVeb8Ybk0Ar7u7M6r//BYDhDXln1fmy DAmu8qLk27wXyitSIMN38/fqI798af8xrCIKpxnCgX4WptrGtPLiiKBq3Al8pYade3RW okjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Mcd5C6tnxoFMS+Vhq9KA90lnvQHuRUYvvt3saAoocUQ=; b=fKw363zQLNfoqSz0ylRLvTzvQjHb+Iv6aB/LnMb3xDrgLr+m6sU55Kti/07UqPaZCi gUO+aedeKHQbcdbTCdfrJ9rean4+W3JhidQ6nf9h3Ycgt0VZIAXgB2NHi2IlKYIY9DSL vfrdPE1zaK2WeK5KAk8SjG7UIe8pPhpDfb20zDn7nk1upNX9RNEEjTQG4qq0sGesr/gz Vu9GZ42Gj4e9BT7Tu+PxmP/eIq1jrqYOT9AiwKvUIQ57NpGpyML1qkz7Wxm0PlPe4n4c 7dvX5OkPDx1P9BYTQTuxSekHD8onuM4NmiaBJdLqnYhinqlw2znQlzms/DO3QLgUWH7S Lu4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iIACbIMn; 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=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32-v6si3817412pld.717.2018.01.26.07.23.42; Fri, 26 Jan 2018 07:23:56 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=iIACbIMn; 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=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753572AbeAZPWQ (ORCPT + 99 others); Fri, 26 Jan 2018 10:22:16 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43538 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbeAZPUD (ORCPT ); Fri, 26 Jan 2018 10:20:03 -0500 Received: by mail-wr0-f194.google.com with SMTP id t16so821773wrc.10; Fri, 26 Jan 2018 07:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mcd5C6tnxoFMS+Vhq9KA90lnvQHuRUYvvt3saAoocUQ=; b=iIACbIMn0tKmIBru4ndKd+Gw9/hYmfcRIBGe+QkR6LncWVQoD8RZBFJ72VL3zVhr8T yLw4cRenodkyFI40hkr55gx0TLLkl7OWWEXU1jyNQQaWIJGdFXuHIKuRwAUhMrlc08AS NfKoTatHfFPGZavSZZCjhMouGTbhZR/ydHR+zQmADynpAuqWZc0/6uowOv9a4J4ag0cZ exVwP01AI31W0OCIQ/MFgtObMI1aWfxFYm0DWDJ7xWQ5M4+BIgiFL9QGNHBH2o7n84a8 fkqGCr6wad7xooUy+lgmPgc1gdPekmhhUS3AKbbotBbKoPB3hi93q94oaq2IpLoo5ubz +SVQ== 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:in-reply-to :references; bh=Mcd5C6tnxoFMS+Vhq9KA90lnvQHuRUYvvt3saAoocUQ=; b=FdZ9TUVsDntIOOrbjkQ//6wdFHPO7u9cAlNgjZkbJrJsjwnK1U+GAGboip/TzKaceM AFFDJhhhCsQXekAUwc4SJk7/syOCytFmHu8EOSBGJPZSjzf7TgozevLVQWgLB10WiI5D BIU3Not3kh/w6GXDjAcQZgO7OIUMaTbB723NCI0V6TS+anej3xpAu5C0ZMk2MBkloHLp WnI6gDfkv1magGOPeA2tg8drLcq+CSMTWBtUGKO5CtaSgrsqLm5wruazmCJt7vYqmOY9 5G3bBC8TEGlzLxKUuiwSte8izn9Da9TbIg4ISfx28CI06qzkgoDj/rpgC1I6G4+F3lj2 cvkQ== X-Gm-Message-State: AKwxytfUl75JQi66PKNoxjR7BcBd/37aRcAm/qgro02Jy2jJHWY59jMo xxcK8Etguq/lCHLT/Cej5uo= X-Received: by 10.223.164.146 with SMTP id g18mr11376801wrb.241.1516980001599; Fri, 26 Jan 2018 07:20:01 -0800 (PST) Received: from debian-laptop.fritz.box (p578F04D2.dip0.t-ipconnect.de. [87.143.4.210]) by smtp.gmail.com with ESMTPSA id e15sm4586130wmd.26.2018.01.26.07.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:20:01 -0800 (PST) From: Philipp Rossak To: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, davem@davemloft.net, hans.verkuil@cisco.com, mchehab@kernel.org, rask@formelder.dk, clabbe.montjoie@gmail.com, sean@mess.org, krzk@kernel.org, quentin.schulz@free-electrons.com, icenowy@aosc.io, edu.molinas@gmail.com, singhalsimran0@gmail.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 09/16] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor Date: Fri, 26 Jan 2018 16:19:34 +0100 Message-Id: <20180126151941.12183-10-embed3d@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180126151941.12183-1-embed3d@gmail.com> References: <20180126151941.12183-1-embed3d@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds support for the H3 ths sensor. The H3 supports interrupts. The interrupt is configured to update the the sensor values every second. The calibration data is writen at the begin of the init process. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 77e07f042730..f2e0ec65c53e 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -145,6 +145,31 @@ static const struct gpadc_data sun8i_a33_gpadc_data = { .support_irq = false, }; +static const struct gpadc_data sun8i_h3_ths_data = { + .temp_offset = -1791, + .temp_scale = -121, + .temp_data = {SUNXI_THS_TDATA0, 0, 0, 0}, + .sample_start = sunxi_ths_sample_start, + .sample_end = sunxi_ths_sample_end, + .has_bus_clk = true, + .has_bus_rst = true, + .has_mod_clk = true, + .sensor_count = 1, + .supports_nvmem = true, + .support_irq = true, + .ctrl0_map = SUNXI_THS_ACQ0(0xff), + .ctrl2_map = SUNXI_THS_ACQ1(0x3f), + .sensor_en_map = SUNXI_THS_TEMP_SENSE_EN0, + .filter_map = SUNXI_THS_FILTER_EN | + SUNXI_THS_FILTER_TYPE(0x2), + .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 | + SUNXI_THS_INTS_SHUT_INT_0 | + SUNXI_THS_INTS_TDATA_IRQ_0 | + SUNXI_THS_INTS_ALARM_OFF_0, + .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 | + SUNXI_THS_TEMP_PERIOD(0x7), +}; + struct sun4i_gpadc_iio { struct iio_dev *indio_dev; struct completion completion; @@ -643,6 +668,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = { .compatible = "allwinner,sun8i-a33-ths", .data = &sun8i_a33_gpadc_data, }, + { + .compatible = "allwinner,sun8i-h3-ths", + .data = &sun8i_h3_ths_data, + }, { /* sentinel */ } }; -- 2.11.0