From patchwork Fri Jan 26 15:19:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10186343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 12FB260383 for ; Fri, 26 Jan 2018 15:23:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03C0029C19 for ; Fri, 26 Jan 2018 15:23:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAE9B29C2A; Fri, 26 Jan 2018 15:22:59 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6604E29C19 for ; Fri, 26 Jan 2018 15:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FvExQ0etDBTS7USYpO9L6um4eBAd4LHuZPnvwe8QGvo=; b=ooMerD009d9+xaQtZp7j3bw/V/ rbplkOjj7L29mE8SPRIKB3dRIbgS/jKLyc+PYGEMRRMKQZZZpXfRJh6vRYpTI+QgjfqcOuoL2B+R9 sN1pX+ylG+QajoU1wJet5eDgdL3gw2uAhcqOZhsfhy8FCZZ9jt6UuIemdczydUFz4HM+/YvHByvpF liA1HdW5a23hb66yQFGv5Jrt736LQHtgfIDiO78x+PLQyossG4rLuTC1MdHLMZaSqtR4y4tQUWle9 jjXXgHgLWdmMaWw+BRftnYjjDxAU0NHLuDJW+/viXewbGwIMTHnPQEmCUwSpqt3FNdsisLalec+cx Sxb0Q9Eg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ef5qB-0004hA-VP; Fri, 26 Jan 2018 15:22:56 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ef5nb-0000pc-RR for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2018 15:20:18 +0000 Received: by mail-wr0-x241.google.com with SMTP id i56so829386wra.7 for ; Fri, 26 Jan 2018 07:20:04 -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=INNu35L59gfSYuXcU6atjshs5oPBbHRGteo6ugTb3cE=; b=AsDDLd8seWOYJjkH9lAVV5RrnnCzyOgXRWEWcfpIljwTYzKJMAURiSQt+EFFk+IR+Z 3WxpmjCHyKUCr7opg8HflpdwVRe8ffjrYMgqEqDs4jP6ADMsLoVzuZ4rg8WGgUNeIfMk SYZHPTOl/asV5tCKZ+XYz9gyrtYwz1dveax3q0+U6HI4z0v1+Ifi1LT3BlZ6AgmdMzss Z+b1aABxX1lMgEC9WiTqXiDIAFJKS+4DjwnO1UJ/54HYuVxmB7E9YNsUqdaLf++smgxS FlX1R+P4gBmBYmWpETMN+WQhF9+SD1miPq27+le9+A7iScvTOEZjZfxjdkHI67EoGtog 8uqQ== 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=INNu35L59gfSYuXcU6atjshs5oPBbHRGteo6ugTb3cE=; b=tIYt/OWFcti9bU3RN89KeJz5n+RLuQhnrBq5TcKMlDi5l87bJHXiGjp5DCgeGRH9o/ AGnfi8h2/GOmMbMuZu3chLpe6KdoE55T9/G6ZdSNn2KAAESp3SmvFtyHdMpe6CT3lKEQ GEfOGGu75H5AvB+3+7Dt+wJVIaEOlMSCB4Xc/rMxK3AcUjPJDyG4LKEGp15c0Z3MjTwn oSOhhNoKRgAx9440PA/ZH3/4fsSIZF0Tv3CpqT6t6X0kXx3nzHOUbF136WPjXp7UZehZ 1+0/PLSdk0RzYLYaWoH0pvY7Z7aI6Kh25twV0oG/OJCscZ7qB3tcZGi0vYWB/MOWfybJ VBTg== X-Gm-Message-State: AKwxytelGz3IRMtc8tQCdodznYR3So9vAnPfVeB3u2l5ADHCFu4N4z5L pGX/7nZoeOVIav1fZVdfGC0= X-Google-Smtp-Source: AH8x225zDzcxm+Awo3M1Y2PL6fsaaH17X2hattfs3IcEc9b5Sd+KXdg+JlUoLhC3kxtnQolknYGyVg== X-Received: by 10.223.171.131 with SMTP id s3mr12839643wrc.160.1516980003385; Fri, 26 Jan 2018 07:20:03 -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.20.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:20:02 -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 Subject: [PATCH 10/16] iio: adc: sun4i-gpadc-iio: add support for A83T thermal sensor Date: Fri, 26 Jan 2018 16:19:35 +0100 Message-Id: <20180126151941.12183-11-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> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for the A83T ths sensor. The A83T does not support interrupts. This seems to be broken. The calibration data is writen at the begin of the init process. Signed-off-by: Philipp Rossak --- drivers/iio/adc/sun4i-gpadc-iio.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index f2e0ec65c53e..b8693afcdbea 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 = { SUNXI_THS_TEMP_PERIOD(0x7), }; +static const struct gpadc_data sun8i_a83t_ths_data = { + .temp_offset = -2724, + .temp_scale = -70, + .temp_data = {SUNXI_THS_TDATA0, + SUNXI_THS_TDATA1, + SUNXI_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 = SUNXI_THS_ACQ0(0x1f3), + .ctrl2_map = SUNXI_THS_ACQ1(0x1f3), + .sensor_en_map = SUNXI_THS_TEMP_SENSE_EN0 | + SUNXI_THS_TEMP_SENSE_EN1 | + SUNXI_THS_TEMP_SENSE_EN2, + .filter_map = SUNXI_THS_FILTER_EN | + SUNXI_THS_FILTER_TYPE(0x2), + .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 | + SUNXI_THS_INTS_ALARM_INT_1 | + SUNXI_THS_INTS_ALARM_INT_2 | + SUNXI_THS_INTS_SHUT_INT_0 | + SUNXI_THS_INTS_SHUT_INT_1 | + SUNXI_THS_INTS_SHUT_INT_2 | + SUNXI_THS_INTS_TDATA_IRQ_0 | + SUNXI_THS_INTS_TDATA_IRQ_1 | + SUNXI_THS_INTS_TDATA_IRQ_2, + .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 | + SUNXI_THS_INTC_TDATA_IRQ_EN1 | + SUNXI_THS_INTC_TDATA_IRQ_EN2 | + SUNXI_THS_TEMP_PERIOD(0x257), +}; + struct sun4i_gpadc_iio { struct iio_dev *indio_dev; struct completion completion; @@ -672,6 +706,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths_data, }, + { + .compatible = "allwinner,sun8i-a83t-ths", + .data = &sun8i_a83t_ths_data, + }, { /* sentinel */ } };