Received: by 10.223.176.5 with SMTP id f5csp2776658wra; Mon, 29 Jan 2018 03:54:38 -0800 (PST) X-Google-Smtp-Source: AH8x227p0/txwg5QOTBePFaXrMbjkI7XxolvqJAnb1Tlpd2SWmpqT2i6Q891vZBQsPJd/tTe3iSM X-Received: by 10.98.68.91 with SMTP id r88mr26883392pfa.52.1517226877903; Mon, 29 Jan 2018 03:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517226877; cv=none; d=google.com; s=arc-20160816; b=TxVNNwz+3UIpnUNBiRnar4fQA2rsO14+QQLL9A3yLuOpHKKQOI35L1dwEPJOOvB224 SLQTaeuXzy4HQpqfAyK4PYaiV75CEgFN+yWaFB9T2XopyY1ck2T/8mZM0LAiCbRUjzTj luB+vytNDIqnff5owx9QN5iv85ThupYDVHrhDNIawijexJw92Hapnu3zLLp0V8O/7HpL J3jo1TrtbqVwF8SYwFa720F/bv5kA8/cpfSp5+Y8GBUCloFXzK8vdP6bdVAlAS9xx6jA D38vdmFO4DJP46cP+m3AkZHriylR+85jwq67VZFtTtvXiQkrK9lKTssGOxHXRKYz7e00 824A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=SFyWyvynACMLN7mXIOs5mcH2lrMKhFKyYKm+kYhSG/8=; b=fjRdGmV4FOXSp0/GrIOdcABGrufN6SL8MUJaDOxAkKof4v+O8tIptOcYvO1/SvuMn0 snM+AOnMu2430b98xPFvrnQF19DAs/WKwO643hJ+5oJpAK/6GDfqxEHauXowEcNJJLkT VIvE/i4lstdoqIPwS5UxSDKoUgK7GTfxgqnK+h3xykksdVjawcpEwdXa8C8u6K/mi5O9 509SG8BvaS5j/6vRFS4nKemCcaY0MRphEVrmvLAACTYEmH/X7ZOXuM1CzTv56JDRJ/qU Yk5UBNVf4fKWKf1G83J7DlCbIjGaR3ODHZJtI4qK9UHJ9yobHEFJYNb9FSX9Nn7TVGYT MrVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nWbjpi4G; 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 z1-v6si9187638plb.178.2018.01.29.03.54.21; Mon, 29 Jan 2018 03:54:37 -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=nWbjpi4G; 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 S1751569AbeA2Lxz (ORCPT + 99 others); Mon, 29 Jan 2018 06:53:55 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51008 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751321AbeA2Lxx (ORCPT ); Mon, 29 Jan 2018 06:53:53 -0500 Received: by mail-wm0-f65.google.com with SMTP id f71so13651941wmf.0; Mon, 29 Jan 2018 03:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SFyWyvynACMLN7mXIOs5mcH2lrMKhFKyYKm+kYhSG/8=; b=nWbjpi4GgB+cJ41/8G6thMZLkNcgLP7RUzP1b5OYPoivBBeSWhDXN9vJuSe9Fnw9xp xDIxe5TAwwLEs7+zAbyqR4SBt8lpA1Gys9GPe/Dllj7LJiJJnUf5q1mt+LYSl5da34hn kiigddLkDQL3RRYXNKq+dXi0OeoqN7PKcyBlFG+KQE7C1lMY8rYu9B+F380UMk9OI3zB VUchQtOhVAxJWSfc8+ZMWKK3NuB38NJavzcasq49bBsQ8dB3cdULjiWzn4jtTR5FoxqH ZXhUjf6sJsI5SA8bxYaEJgyAffEvT0hc59EZLzLO/6aHRkJXhuNZ5MQnPng411aRVoV2 NL6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SFyWyvynACMLN7mXIOs5mcH2lrMKhFKyYKm+kYhSG/8=; b=nn0jcDisM6Ml3IPTwe5IjUew9kojxaOMF0Ii0dK/wWT2Ofph+M1erRieF/55FOInbY ZYOt8hDZS0UW5LZParJoIwdjdS4wdb5MZGJ/OVox9OlJQMQdeczgviXmCQGJ1SPqUAe1 BTkaFA9TkFk+MPWmyyn1YrYgrf4To1/NhoZwhXWpzX+rkib7sqRv9+nv+PzP8dzOrALZ sEMjOSupFU23XXVlvLCpmwPuCeKZEeUOl9ej+GXR81cQLfPv5y6LMzEr7YOq9T4VQRpI 61tqw5O920TBXzrtnelqnl2Z4cH5rax45VDj1w/buHiEnppcJ+7BR5SQAMfFYTQSiIs6 P+Yw== X-Gm-Message-State: AKwxytfqkpgFi/fBWyj1PZ1dfEyLWj6SxmW2LR1v3oyzhKs01ZCMVx75 RChY1CcorrBSNalgdfmBKys= X-Received: by 10.28.143.196 with SMTP id r187mr19485523wmd.68.1517226832333; Mon, 29 Jan 2018 03:53:52 -0800 (PST) Received: from [192.168.2.62] (p578F04D2.dip0.t-ipconnect.de. [87.143.4.210]) by smtp.gmail.com with ESMTPSA id x135sm9739503wmf.35.2018.01.29.03.53.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 03:53:51 -0800 (PST) Subject: Re: [PATCH v2 10/16] iio: adc: sun4i-gpadc-iio: add support for A83T thermal sensor To: Maxime Ripard Cc: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.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, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com References: <20180128232919.12639-1-embed3d@gmail.com> <20180128232919.12639-11-embed3d@gmail.com> <20180129094803.uiojqkmaeuihbe4p@flea.lan> From: Philipp Rossak Message-ID: <94bc070d-8675-95fe-2857-188f7cc66071@gmail.com> Date: Mon, 29 Jan 2018 12:53:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180129094803.uiojqkmaeuihbe4p@flea.lan> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.01.2018 10:48, Maxime Ripard wrote: > On Mon, Jan 29, 2018 at 12:29:13AM +0100, Philipp Rossak wrote: >> This patch adds support for the A83T ths sensor. >> >> The A83T supports interrupts. The interrupt is configured to update the >> the sensor values every second. >> >> Signed-off-by: Philipp Rossak >> --- >> drivers/iio/adc/sun4i-gpadc-iio.c | 38 ++++++++++++++++++++++++++++++++++++++ >> include/linux/mfd/sun4i-gpadc.h | 18 ++++++++++++++++++ >> 2 files changed, 56 insertions(+) >> >> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c >> index 8196203d65fe..9f7895ba1966 100644 >> --- a/drivers/iio/adc/sun4i-gpadc-iio.c >> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c >> @@ -170,6 +170,40 @@ static const struct gpadc_data sun8i_h3_ths_data = { >> SUN8I_H3_THS_TEMP_PERIOD(0x7), >> }; >> >> +static const struct gpadc_data sun8i_a83t_ths_data = { >> + .temp_offset = -2724, >> + .temp_scale = -70, >> + .temp_data = {SUN8I_H3_THS_TDATA0, >> + SUN8I_A83T_THS_TDATA1, >> + SUN8I_A83T_THS_TDATA2, >> + 0}, >> + .sample_start = sunxi_ths_sample_start, >> + .sample_end = sunxi_ths_sample_end, >> + .sensor_count = 3, >> + .supports_nvmem = false, >> + .support_irq = true, >> + .ctrl0_map = SUN4I_GPADC_CTRL0_T_ACQ(0x1f3), >> + .ctrl2_map = SUN8I_H3_THS_ACQ1(0x1f3), > > Where are these values coming from? > These values are calculated with the formulas from the datasheet and also tested on hardware. These settings seem ok. >> + .sensor_en_map = SUN8I_H3_THS_TEMP_SENSE_EN0 | >> + SUN8I_A83T_THS_TEMP_SENSE_EN1 | >> + SUN8I_A83T_THS_TEMP_SENSE_EN2, >> + .filter_map = SUN4I_GPADC_CTRL3_FILTER_EN | >> + SUN4I_GPADC_CTRL3_FILTER_TYPE(0x2), >> + .irq_clear_map = SUN8I_H3_THS_INTS_ALARM_INT_0 | >> + SUN8I_A83T_THS_INTS_ALARM_INT_1 | >> + SUN8I_A83T_THS_INTS_ALARM_INT_2 | >> + SUN8I_H3_THS_INTS_SHUT_INT_0 | >> + SUN8I_A83T_THS_INTS_SHUT_INT_1 | >> + SUN8I_A83T_THS_INTS_SHUT_INT_2 | >> + SUN8I_H3_THS_INTS_TDATA_IRQ_0 | >> + SUN8I_A83T_THS_INTS_TDATA_IRQ_1 | >> + SUN8I_A83T_THS_INTS_TDATA_IRQ_2, > > Do you reall need to clear all these interrupts if you're using only > one? > No, I don't think so, I will remove them in the next version. > Maxime > Philipp