From patchwork Fri Jan 26 15:19:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 10186331 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 7A83F60383 for ; Fri, 26 Jan 2018 15:22:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B81E29C25 for ; Fri, 26 Jan 2018 15:22:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F42B29C2E; Fri, 26 Jan 2018 15:22:26 +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=ham 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 E089D29C25 for ; Fri, 26 Jan 2018 15:22:25 +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=LH0TYjqqChSBoZblOMyDJfbFIgZ/TwOb9g63PEufhOQ=; b=bgiAEBzQH7vxqOlrZmrLp15dT2 PNC4T5zc9436+LpUJEtgJ7sIdjk/hBeO+asURrB/4qZwjQq8vK+2QhN5gxnJQQdzjRfyqig6sGZbd 6Bq1Gmpo6QDGYFi2QNpBE0Z8rTlqpOJmYHipgYH3wcOK9dbwCAh4Ep7gH0O/ujdBKSoOCjo88z0t3 U3oIhn0El6NOBkapf88z3JerzvfbrwyQmi0LHPe0OdyT8wrXob9csIbTFtnaN2IOOVF//Tj3nC7FR TvpaVvhKMJAHTlJIPumzdrUsm4yNZ8KygLkaViIZewMoZ41asSoMdf01K3lrCdJt2ImshSFOa9YOr Q1RFSC3Q==; 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 1ef5pg-00048l-72; Fri, 26 Jan 2018 15:22:24 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ef5na-0000cy-1H for linux-arm-kernel@lists.infradead.org; Fri, 26 Jan 2018 15:20:17 +0000 Received: by mail-wr0-x243.google.com with SMTP id v31so817162wrc.11 for ; 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=E9xI1iQ2OK1LAKn1CVjKWc+vLCqfiz3wlj7fvCAcA5DqaW3rADmsW7oAC0oLoSU7b1 +Nm6n0OA+RBKCtCKKSj8JLWF4EUhElcXN3WckKwF2l8cW63V9FuBB4vuTWrmomZwVkzG CbpGM/JkeatStQufTh9v2d28tIKsm5A6+zvr55IPbDsrwHrHXWiA8MMWRM3Ct223N/Ds d+uRowpHtdXJRCB/dMGAaZF/G7a3Zl589LirdvlJY1CTJ9/e/LxFqq1Yws7Lod36SrJO irfpIX7UOfvnWe6XoJHeJWVdKBHmgWcim9pWnTGwYrRn70THdMUg5cTl4YUNdQqNtwt1 1v9Q== X-Gm-Message-State: AKwxytfgK4aFo09xRw7UXJP+zuY0AXAoNXzPqupYactGdS88tqEeTH5J RdPAMYjpTyR0wJfPsxfJubM= X-Google-Smtp-Source: AH8x226OHxnjPDukjUiEUjnoOaYqDvk1Oi1Ly4ZMDxw9GRlsENJ9w9bRVj3yh1ZeQ1cVQOFsXZWEEQ== 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 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> 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 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 */ } };