From patchwork Wed Dec 18 16:23:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301253 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 BBB9314F6 for ; Wed, 18 Dec 2019 16:24:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C181227BF for ; Wed, 18 Dec 2019 16:24:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="kVX7lYSO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727585AbfLRQYN (ORCPT ); Wed, 18 Dec 2019 11:24:13 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:45033 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbfLRQYL (ORCPT ); Wed, 18 Dec 2019 11:24:11 -0500 Received-SPF: Pass (esa4.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa4.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa4.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa4.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa4.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: X33QiihNNKs7F4+foQ29/DEejNCjDaoL/50JbvcYpgriX0FfPuvQ4aNEOUJvvDVYGh7UvOaPnI A5Ed500AE83W4JHdeBo82W/xHdxvEEkyyg84tCbqAJo0OvlSuG+TKQKN+WwW/44Iu8Cv6n2FEC vAplqMRAEYBwB/CkMy+RKtbP0LfS94ssnN2fdodsMZc//nsOVIY9SDpNtNjNCoRb40r/XyOeM0 EhiGt3WetmpDLTrUuu8Beo399akue2Toal8JkeDLFOD1Zc1IEoSEuaAJxh/ls0JSs/yAnMe5XI kU0= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="58926949" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:01 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:00 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:23:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MW8bfEy9kGyQhdttVa1fINRKOx63agWETMwVXkXfGAsyVpM7ZC4rHngrSKjZToYc4VynT8PX2lFozcT8ygf1A6vN49+MqjOU+z0iajQrTnYAg8ku5xWFa/s1rgwUOd0iG8ye1tZ4TYZA1Udzx5He8pGWwZHIG38vchNt13ETKFjQkltuo5iDr1WmMwr/aAknKlk/BMPclOtF8V8RC4fnb3lCnHTNGSokuBYt636pgiWMBImrwAY23LVdUX+u6MHvZauVoYm6JxtW+NL+J8d/HEkaZuAfMLk4JH5fcdRAOjRc5fF06m4OL/M8eAoHAFJElt0K8WB+bKbCj/nIjwVA5g== 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=w6iiaTiNAGwMTwukhS+6u4KwtuaSg3VgDPHNQ5aNYQM=; b=ibh4hSZ+b2eInPftmfsxf0mpTYwpCITMVAZxjf98SWbT85TQ3MEuvLtrZ2HNu+W7J7L7OiauWPFzVI1ehvcr0XmQNct9+WJXQJeIiSUdy7VMXQtdqT3Yehzjk8Y65kRcCZ2xx+wWCOFyYIjhKE44sVxWUarHRZ0Z2eE73c0IuAjYsMSrhG4JsCwfxr4dFcLkIP5eO/x4BFJCs5LeOPzI0yIBvD8L9gXLCzW1WKzLOJ7yAMdSxlWKAMOOgLokHXHemchSYmPJjOqiyfRWdxEhQhkV4wHBHnpCzTEKNYLY6kllSB2V0kvtg4E9ExvX2Wh8J1abtW95QT1OMxidpOlghQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w6iiaTiNAGwMTwukhS+6u4KwtuaSg3VgDPHNQ5aNYQM=; b=kVX7lYSOB9EOUh6bRuthkTkJWCmXkHr6fvzGxMOS8CWUF4LrGN2+qVqq6s0rojzogupEdpGpdyAyHfPplx+wqa7pjU77K/u6tY+bv2AhWFd1fpMF5Z8078tTpA2GWJX/0dsXEnWbwIHxJ0HQCTHrJ+LHDcUVJtteJFDJxP4RVNc= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1913.namprd11.prod.outlook.com (10.175.87.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Wed, 18 Dec 2019 16:23:59 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:23:59 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 01/10] iio: adc: at91-sama5d2_adc: update for other trigger usage Thread-Topic: [PATCH 01/10] iio: adc: at91-sama5d2_adc: update for other trigger usage Thread-Index: AQHVtb+MG4wZCflqBkexX/EL1yry8g== Date: Wed, 18 Dec 2019 16:23:58 +0000 Message-ID: <1576686157-11939-2-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a5c95de6-49ca-41c9-dc03-08d783d6afc5 x-ms-traffictypediagnostic: DM5PR11MB1913: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(346002)(376002)(136003)(396003)(199004)(189003)(52314003)(2616005)(66556008)(316002)(30864003)(107886003)(8676002)(71200400001)(8936002)(66476007)(26005)(6506007)(2906002)(64756008)(66446008)(66946007)(81156014)(76116006)(81166006)(5660300002)(478600001)(36756003)(54906003)(186003)(4326008)(86362001)(6512007)(110136005)(91956017)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1913;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: daJiZ+OpQoiN0coafOld1xWmoB8HdZdm1YhzzNz5PLRBU9q2aunekoHUWme5quCu6Ft6mysJQ5B3aRTVilXgdchaTsb/qPceHQxcencP89eMyE730T/c5edfnpesy7N4n2WAdcjtFhNHj5lB/NNP5iKzHwVq7Px9WoaBMAT9k6WPSBZWqx8cUCgYVzY+Wn1hH7xMLBkWa5HBx8AOJmVLlBOrlpAapGrARVf7QzJMV95O23S0zOKWnJWDecRsqW9gUsF90F2K4UvPhM+H2u733aDIeUKhduVTRiDu90PJwWwpmv6OrJrhoKylaKPIIxaPv/yAOouwq8BsTBvIz2oLQx4uTL1Porpzpl5jRiYMM+RGA+5greMoJZ6gj4KSBKFh0CXtj9rGAxOSirqmR+xoj13Dhd5+csy/8LaBRTdyqNX18OvbfUTPpel9BjY/FtKuHp3kZ3rBtWJtodB4H8jf3CdEb8s/4ytBmpvVXD3KRegVZuWzwR2Oa/JebtuFhiDH MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a5c95de6-49ca-41c9-dc03-08d783d6afc5 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:23:58.4137 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5Lu40e0ykQPQoiwkOd+scIXNydcVr986/hByzjzip/Z/9WJQKWxGjiSrLnqk9uyHoBRqV+nVXSSvw7TOtDYSBrBsaDPUXfPrZ5rmEoX0bVg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1913 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev This change will allow the at91-sama5d2_adc driver to use other triggers than it's own. In particular, tested with the sysfs trigger. To be able to achieve this functionality, some changes were required: 1) Do not enable/disable channels when enabling/disabling the trigger. This is because the trigger is enabled/disabled only for our trigger (obviously). We need channels enabled/disabled regardless of what trigger is being used. 2) Cope with DMA : DMA cannot be used when using another type of trigger. Other triggers work through pollfunc, so we get polled anyway on every trigger. Thus we have to obtain data at every trigger. 3) When to start conversion? The usual pollfunc (store time from subsystem) is replaced with specific at91 code, that will start the software conversion on the poll action(if it's not our trigger). 4) When is the conversion done ? Usually it should be done at EOC (end of channel) interrupt. But we start the conversion in pollfunc. So, in the handler for this pollfunc, check if data is ready. If not ready, cannot busywait, so, start the workq to get the data later. 5) Buffer config: we need to setup buffer regardless of our own device's trigger. We may get one attached later. 6) IRQ handling: we use our own device IRQ only if it's our own trigger and we do not use DMA . If we use DMA, we use the DMA controller's IRQ. 7) Touchscreen workq: the workq is now also used with other triggers. So, move this from the touchscreen state struct to the at91_adc_state. 8) Timestamp: the timestamp is kept in the pollfunc. However if in the handler we start a workq, the timestamp is no longer accessible. Copy it to our state struct. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 212 ++++++++++++++++++++++--------------- 1 file changed, 127 insertions(+), 85 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index e1850f3..c575970 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -378,7 +378,6 @@ struct at91_adc_touch { bool touching; u16 x_pos; unsigned long channels_bitmask; - struct work_struct workq; }; struct at91_adc_state { @@ -405,6 +404,8 @@ struct at91_adc_state { * sysfs. */ struct mutex lock; + struct work_struct workq; + s64 timestamp; }; static const struct at91_adc_trigger at91_adc_trigger_list[] = { @@ -710,7 +711,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) struct iio_dev *indio = iio_trigger_get_drvdata(trig); struct at91_adc_state *st = iio_priv(indio); u32 status = at91_adc_readl(st, AT91_SAMA5D2_TRGR); - u8 bit; /* clear TRGMOD */ status &= ~AT91_SAMA5D2_TRGR_TRGMOD_MASK; @@ -721,35 +721,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) /* set/unset hw trigger */ at91_adc_writel(st, AT91_SAMA5D2_TRGR, status); - for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { - struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); - - if (!chan) - continue; - /* these channel types cannot be handled by this trigger */ - if (chan->type == IIO_POSITIONRELATIVE || - chan->type == IIO_PRESSURE) - continue; - - if (state) { - at91_adc_writel(st, AT91_SAMA5D2_CHER, - BIT(chan->channel)); - /* enable irq only if not using DMA */ - if (!st->dma_st.dma_chan) { - at91_adc_writel(st, AT91_SAMA5D2_IER, - BIT(chan->channel)); - } - } else { - /* disable irq only if not using DMA */ - if (!st->dma_st.dma_chan) { - at91_adc_writel(st, AT91_SAMA5D2_IDR, - BIT(chan->channel)); - } - at91_adc_writel(st, AT91_SAMA5D2_CHDR, - BIT(chan->channel)); - } - } - return 0; } @@ -873,69 +844,90 @@ static int at91_adc_dma_start(struct iio_dev *indio_dev) return 0; } -static int at91_adc_buffer_postenable(struct iio_dev *indio_dev) +#define AT91_ADC_BUFFER_CHECK_USE_IRQ(use_irq) { \ + use_irq = true; \ + /* if using DMA, we do not use our own IRQ (we use DMA-controller) */ \ + if (st->dma_st.dma_chan) \ + use_irq = false; \ + /* if the trigger is not ours, then it has its own IRQ */ \ + if (iio_trigger_validate_own_device(indio->trig, indio)) \ + use_irq = false; \ + } + +static int at91_adc_buffer_postenable(struct iio_dev *indio) { int ret; - struct at91_adc_state *st = iio_priv(indio_dev); + u8 bit; + bool use_irq; + struct at91_adc_state *st = iio_priv(indio); /* check if we are enabling triggered buffer or the touchscreen */ - if (bitmap_subset(indio_dev->active_scan_mask, + if (bitmap_subset(indio->active_scan_mask, &st->touch_st.channels_bitmask, AT91_SAMA5D2_MAX_CHAN_IDX + 1)) { /* touchscreen enabling */ return at91_adc_configure_touch(st, true); } /* if we are not in triggered mode, we cannot enable the buffer. */ - if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) + if (!(indio->currentmode & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; /* we continue with the triggered buffer */ - ret = at91_adc_dma_start(indio_dev); + ret = at91_adc_dma_start(indio); if (ret) { - dev_err(&indio_dev->dev, "buffer postenable failed\n"); + dev_err(&indio->dev, "buffer postenable failed\n"); + iio_triggered_buffer_predisable(indio); return ret; } - return iio_triggered_buffer_postenable(indio_dev); + AT91_ADC_BUFFER_CHECK_USE_IRQ(use_irq); + + for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { + struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); + + if (!chan) + continue; + /* these channel types cannot be handled by this trigger */ + if (chan->type == IIO_POSITIONRELATIVE || + chan->type == IIO_PRESSURE) + continue; + + at91_adc_writel(st, AT91_SAMA5D2_CHER, BIT(chan->channel)); + if (use_irq) { + at91_adc_writel(st, AT91_SAMA5D2_IER, + BIT(chan->channel)); + } + } + return iio_triggered_buffer_postenable(indio); } -static int at91_adc_buffer_predisable(struct iio_dev *indio_dev) +static int at91_adc_buffer_predisable(struct iio_dev *indio) { - struct at91_adc_state *st = iio_priv(indio_dev); + struct at91_adc_state *st = iio_priv(indio); int ret; u8 bit; + bool use_irq; /* check if we are disabling triggered buffer or the touchscreen */ - if (bitmap_subset(indio_dev->active_scan_mask, + if (bitmap_subset(indio->active_scan_mask, &st->touch_st.channels_bitmask, AT91_SAMA5D2_MAX_CHAN_IDX + 1)) { /* touchscreen disable */ return at91_adc_configure_touch(st, false); } /* if we are not in triggered mode, nothing to do here */ - if (!(indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES)) + if (!(indio->currentmode & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; - /* continue with the triggered buffer */ - ret = iio_triggered_buffer_predisable(indio_dev); - if (ret < 0) - dev_err(&indio_dev->dev, "buffer predisable failed\n"); - - if (!st->dma_st.dma_chan) - return ret; - - /* if we are using DMA we must clear registers and end DMA */ - dmaengine_terminate_sync(st->dma_st.dma_chan); - + AT91_ADC_BUFFER_CHECK_USE_IRQ(use_irq); /* - * For each enabled channel we must read the last converted value + * For each enable channel we must disable it in hardware. + * In the case of DMA, we must read the last converted value * to clear EOC status and not get a possible interrupt later. - * This value is being read by DMA from LCDR anyway + * This value is being read by DMA from LCDR anyway, so it's not lost. */ - for_each_set_bit(bit, indio_dev->active_scan_mask, - indio_dev->num_channels) { - struct iio_chan_spec const *chan = - at91_adc_chan_get(indio_dev, bit); + for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { + struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); if (!chan) continue; @@ -943,12 +935,29 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio_dev) if (chan->type == IIO_POSITIONRELATIVE || chan->type == IIO_PRESSURE) continue; + + if (use_irq) { + at91_adc_writel(st, AT91_SAMA5D2_IDR, + BIT(chan->channel)); + } + at91_adc_writel(st, AT91_SAMA5D2_CHDR, BIT(chan->channel)); + if (st->dma_st.dma_chan) at91_adc_readl(st, chan->address); } /* read overflow register to clear possible overflow status */ at91_adc_readl(st, AT91_SAMA5D2_OVER); + + /* continue with the triggered buffer */ + ret = iio_triggered_buffer_predisable(indio); + if (ret < 0) + dev_err(&indio->dev, "buffer predisable failed\n"); + + /* if we are using DMA we must clear registers and end DMA */ + if (st->dma_st.dma_chan) + dmaengine_terminate_sync(st->dma_st.dma_chan); + return ret; } @@ -993,8 +1002,8 @@ static int at91_adc_trigger_init(struct iio_dev *indio) return 0; } -static void at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev, - struct iio_poll_func *pf) +static void at91_adc_read_and_push_channels(struct iio_dev *indio_dev, + s64 timestamp) { struct at91_adc_state *st = iio_priv(indio_dev); int i = 0; @@ -1028,11 +1037,30 @@ static void at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev, } i++; } - iio_push_to_buffers_with_timestamp(indio_dev, st->buffer, - pf->timestamp); + iio_push_to_buffers_with_timestamp(indio_dev, st->buffer, timestamp); +} + +static int at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev, + struct iio_poll_func *pf) +{ + struct at91_adc_state *st = iio_priv(indio_dev); + + /* + * Check if the conversion is ready. If not, schedule a work to + * check again later. + */ + if (!(at91_adc_readl(st, AT91_SAMA5D2_ISR) & GENMASK(11, 0))) { + schedule_work(&st->workq); + return -EINPROGRESS; + } + + /* we have data, so let's extract and push it */ + at91_adc_read_and_push_channels(indio_dev, pf->timestamp); + + return 0; } -static void at91_adc_trigger_handler_dma(struct iio_dev *indio_dev) +static int at91_adc_trigger_handler_dma(struct iio_dev *indio_dev) { struct at91_adc_state *st = iio_priv(indio_dev); int transferred_len = at91_adc_dma_size_done(st); @@ -1079,6 +1107,8 @@ static void at91_adc_trigger_handler_dma(struct iio_dev *indio_dev) } /* adjust saved time for next transfer handling */ st->dma_st.dma_ts = iio_get_time_ns(indio_dev); + + return 0; } static irqreturn_t at91_adc_trigger_handler(int irq, void *p) @@ -1086,33 +1116,41 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; struct at91_adc_state *st = iio_priv(indio_dev); + int ret; + st->timestamp = pf->timestamp; if (st->dma_st.dma_chan) - at91_adc_trigger_handler_dma(indio_dev); + ret = at91_adc_trigger_handler_dma(indio_dev); else - at91_adc_trigger_handler_nodma(indio_dev, pf); + ret = at91_adc_trigger_handler_nodma(indio_dev, pf); - iio_trigger_notify_done(indio_dev->trig); + if (!ret) + iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } -static int at91_adc_buffer_init(struct iio_dev *indio) +irqreturn_t at91_adc_pollfunc(int irq, void *p) { - struct at91_adc_state *st = iio_priv(indio); + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct at91_adc_state *st = iio_priv(indio_dev); - if (st->selected_trig->hw_trig) { - return devm_iio_triggered_buffer_setup(&indio->dev, indio, - &iio_pollfunc_store_time, - &at91_adc_trigger_handler, &at91_buffer_setup_ops); - } /* - * we need to prepare the buffer ops in case we will get - * another buffer attached (like a callback buffer for the touchscreen) + * If it's not our trigger, start a conversion now, as we are + * actually polling the trigger now. */ - indio->setup_ops = &at91_buffer_setup_ops; + if (iio_trigger_validate_own_device(indio_dev->trig, indio_dev)) + at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_START); - return 0; + return iio_pollfunc_store_time(irq, p); +} + +static int at91_adc_buffer_init(struct iio_dev *indio) +{ + return devm_iio_triggered_buffer_setup(&indio->dev, indio, + &at91_adc_pollfunc, + &at91_adc_trigger_handler, &at91_buffer_setup_ops); } static unsigned at91_adc_startup_time(unsigned startup_time_min, @@ -1195,7 +1233,7 @@ static void at91_adc_touch_data_handler(struct iio_dev *indio_dev) * from our IRQ context. Which is something we better avoid. * Let's schedule it after our IRQ is completed. */ - schedule_work(&st->touch_st.workq); + schedule_work(&st->workq); } static void at91_adc_pen_detect_interrupt(struct at91_adc_state *st) @@ -1228,13 +1266,17 @@ static void at91_adc_no_pen_detect_interrupt(struct at91_adc_state *st) static void at91_adc_workq_handler(struct work_struct *workq) { - struct at91_adc_touch *touch_st = container_of(workq, - struct at91_adc_touch, workq); - struct at91_adc_state *st = container_of(touch_st, - struct at91_adc_state, touch_st); + struct at91_adc_state *st = container_of(workq, + struct at91_adc_state, workq); struct iio_dev *indio_dev = iio_priv_to_dev(st); - iio_push_to_buffers(indio_dev, st->buffer); + if ((indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES) && + iio_trigger_validate_own_device(indio_dev->trig, indio_dev)) { + at91_adc_read_and_push_channels(indio_dev, st->timestamp); + iio_trigger_notify_done(indio_dev->trig); + } else { + iio_push_to_buffers(indio_dev, st->buffer); + } } static irqreturn_t at91_adc_interrupt(int irq, void *private) @@ -1711,7 +1753,7 @@ static int at91_adc_probe(struct platform_device *pdev) init_waitqueue_head(&st->wq_data_available); mutex_init(&st->lock); - INIT_WORK(&st->touch_st.workq, at91_adc_workq_handler); + INIT_WORK(&st->workq, at91_adc_workq_handler); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) From patchwork Wed Dec 18 16:23:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301251 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 5A2E414E3 for ; Wed, 18 Dec 2019 16:24:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E3642467B for ; Wed, 18 Dec 2019 16:24:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="GXrfgLg0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727592AbfLRQYN (ORCPT ); Wed, 18 Dec 2019 11:24:13 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:45033 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbfLRQYM (ORCPT ); Wed, 18 Dec 2019 11:24:12 -0500 Received-SPF: Pass (esa4.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa4.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa4.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa4.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa4.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: f0jPY7UzWK3uy5i4vWafTzmhqFjDVAg+qGCmk2nIwBESFp1eggXGvSwKLmrgrJOAEGLSGwYn7P fs5MyDsXEab3q0xdtlUA6xhjC7KaWGFxHY4Zs0oxrwHPmovAsCNJenka4bVt995RodsZMagKDY isoEPncwl3Lf0pcA8HU01QE6s0ZofU2GfxsNhTqut/Jc50WCRdLEKE1VXeWfOVhXoCNiM/JWPL 4JcA92vRVN7K1K/Ca4vnPAIhB3T6ROy4/NRvs9VAvRYi7tlITuNNTiBWEOTr+0aDItWr8yiqsV xVE= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="58926955" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:02 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:02 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQsEXVYgkolQSY3/wudvrRNeDFuAFBhaQmPYECu1kn5bT7+2YIoDumjqfZ7lOI9VFiN5bzkGBVc00oBNC0F4i0HmdevbPQ66WoQY/1L9Aa9rNZ6pbpnm7cZzHdI3bp+HWRAt/uYL9ZndVC38zSx+rIiZfIVi/zakT0zyK1O/+5zUR+k192IqMteRvJBqPNPcRqh3S2Z6txQjEiq1qgLt3Es0VAzMeBGtsbc+grAknQ02F5RKvEuetf54zbY5MN/uoM6SRMJa67adBMiAnXKSnqJGKJBbsmBn6wbW3ib/JaHoXycVTderxfW4VOBYANC5x53f38nY6RsO0S5w83r9Yg== 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=WgF5MxWy+kD9TgHOvNEM2fPe3tHmRhpvGCMtxK1eJ7w=; b=ClVgXeyr3+J2b9hUmaPLwe4MSursG3r8RuGh/KQl/G6jc9Rnd5eJHVc5GpSYYOy+hZTXGouulhIcDBDCyuLNLEFxUh00as9QHRh7jrpBwigTmtnpwEPtlzGCDOqSsXLgb/mBL47x+8goxKl/NCNK8Ys3LoZ8M77bCf1lBjPmQ9SOD3XLaUZd9OsoQQ6KzNwQr7WIzzzMm49xtYX12KSlcaOnZZLnLMMah+R2jV3GKsy/bEWCyOSGDXDt5BGmFPyQq90ZTautGf51WdI6VnRqenD87ey5GIHgopO1yZbeSnygSRWQ4yfkApFP2EvIzy9vrpvMEk5EBMh3l6EER6YIkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WgF5MxWy+kD9TgHOvNEM2fPe3tHmRhpvGCMtxK1eJ7w=; b=GXrfgLg0McboRS8iBYwCZjV1LsFLekAon/oWtjBgWZ6G+3NB3/6Xw4ICpvK4WRoalmTZijxQmyDmjZhvVJAufj6dqgCe4XoUTUlxT53bwStcACQXhcYkxSCIFY/pfLCOjhXHjGI2u0axRvnfQkjfvsqQc3E1xxQzSpmI1XSp6e0= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:00 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:00 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 02/10] dt-bindings: iio: adc: at91-sama5d2: add rtc-trigger optional property Thread-Topic: [PATCH 02/10] dt-bindings: iio: adc: at91-sama5d2: add rtc-trigger optional property Thread-Index: AQHVtb+NqLUQmMTAWE2Je79GFXwa4Q== Date: Wed, 18 Dec 2019 16:23:58 +0000 Message-ID: <1576686157-11939-3-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6f44049a-f87d-4ce5-5e78-08d783d6b08b x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1DqkBM+wHpJ/qNxdyTgzawMlyo6knEOhhnqqxpEXL9MEo3b7IExrptCwMYK209tI8HNcUQP3RoV4GpzPujCvlEWHZTHE3rX/s81hmBXJe1gEI6OVUURS2G/TKiIwGxdzsQeuh8zdLBVPKA2OVM1nWHZ+gpEbQvjlNqsf1HXbKaZ0H8A3XDNQayd/vPJRy7QyhzvL4s9MNQy9IjfJV6TLxW8iSIr8AKVEKgHdvpYhdQsbBKCbZsf29LCbWlKPiPwkekBtgtLINIpjm9tNtLkqusljiFXdWGRiW8w2Xp0KG6yxETpDwFtSGdEY+QuV5F7eRIu1innfZVGDw5XbeNJZyNWGI9usDRaz3sUnADqYy5L6C3QlzgsLtfrJPvNAT8lQvHgap92RBQQVoc10Sja0Nf9djPLV0JfExydbhDzLoJtnXl0LKv4TC3tjsBa0srSm MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6f44049a-f87d-4ce5-5e78-08d783d6b08b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:23:59.0184 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4Kf/72/Y6MchjDbrn5657HoIcH9mfjPwQ2UGhezKqxfhGEGOJq8edTlmYA8yHq+4VElWDQewvQxwRdMwlBfX3c21ssdAQDojvrkeHrW+C7k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev Add property to connect RTC-type trigger to the ADC block. The ADC is connected internally with a line to the RTC block. The RTC can provide a trigger signal to the ADC to start conversions. Signed-off-by: Eugen Hristev --- Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt b/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt index 4a3c1d4..1980f0e 100644 --- a/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt +++ b/Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt @@ -23,6 +23,9 @@ Optional properties: See ../../dma/dma.txt for details. - #io-channel-cells: in case consumer drivers are attached, this must be 1. See for details. + - atmel,rtc-trigger: The ADC IP block can be triggered by the RTC block +inside the SoC. This property is a phandle to a node that provides a +trigger device, if the ADC block supports it. Properties for consumer drivers: - Consumer drivers can be connected to this producer device, as specified @@ -44,6 +47,7 @@ adc: adc@fc030000 { vddana-supply = <&vdd_3v3_lp_reg>; vref-supply = <&vdd_3v3_lp_reg>; atmel,trigger-edge-type = ; + atmel,rtc-trigger = <&rtc_adc_trigger>; dmas = <&dma0 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | AT91_XDMAC_DT_PERID(25))>; dma-names = "rx"; #io-channel-cells = <1>; From patchwork Wed Dec 18 16:23:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301331 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 C42B8138C for ; Wed, 18 Dec 2019 16:26:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 982D824676 for ; Wed, 18 Dec 2019 16:26:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="XQagWMFp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727492AbfLRQYG (ORCPT ); Wed, 18 Dec 2019 11:24:06 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:27743 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbfLRQYF (ORCPT ); Wed, 18 Dec 2019 11:24:05 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: fKogZKkZGN2LeBqOmQklDURmD7Nxas8Ukg8RhT5qU/m1hl5ZFOKV0Ne14RXtFjWhBA8VG9UMvy hFF3xvBf84db/EdmKkFDNw3R4lFrPWSBEn71/7npuBuQBl7QM4EzaYqvtSL8yZzP1IBNWgh9wQ /rs5tLXxYJuBXdoNCVG7xfSEFRmUIGM+3ykk7ITu4rjFosDFwp2e+ue8q1DAV3Y4mw0mFrunWu /zsmYYAgLmjY/2b2LvVkCnDxB5/T9cCdVpmL0ejjHs8lVlwqOfnwX3Cni3DwGPiCRcTeMtVw0c 1eg= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="58200035" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:02 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PyRe8T409vT+nswIuZTXL1AtevXCETMoSkMNIzAicpKLwF+lcpU9skLCAyc+Z53B9ZYQNbQ/6maDGf0Pph2xyPLh1ls60tHlBPkypS+dGa7kmVTZeKlYvxPp4Gqc27w5F8A2D7IrONvWwhAhoK0mq/RCrx6/6/cvoNKj03GuTYa1bftrqt743XgADzE6oOe8tkW4SPYUxsI7zvVvjVXp7ptK6/PEMKwiSoSBnVSU4bk6hJoPt6h1FBfcgW0pn9YfjDL18dB3bN5+tD8sw+nv22A0lzpCH2xfnCt31SP2mjw/RpiR5iF0hSKW5qW1hJIry5YXn9tmZmzHx2r2Kp9VpQ== 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=FVVpupUKHMcVEMlJDeBxmxYOFsVo4OQlonFFmWJl410=; b=GOYY9bTiq46CWWe+q5EQJlIHDUDqSr8y3WB9+mnfY62r1xRx/OR/iCSha9pv9gcEVGn5zRl5vwEsunSPLNwD28Ge9fEOknMhwLFZgP6WLNQAq6V4uTLqYy5x9G/wF1lnF3W0OL8lqwYhwbO8JUQ97abLBUhxlnFljOTMmLgp7XW3RcaqDBWjnS07vV2VfhKEmlDa8I1iC4Lpug/lLhPnyNhIFBrtJucadtUebks7lIZYCQk8A6QL4FBEt4lGs/qkN+jv+3/154H7qtnO1VzFYsF6aoo5fli9X+bdWEocJ94DjDBtdUpMvwdFowzoQxPa/Cnwn/QiSe6tNKFOlEqObA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FVVpupUKHMcVEMlJDeBxmxYOFsVo4OQlonFFmWJl410=; b=XQagWMFpAAihScx4mlA7IjN0qPPUVRHt3Mo15mJ2BsnBEOb8zWaOOkJjOsqopCt2G5f0gQ2h1ElzWp8QkP4garTR5MLs0WR04zsgwwwavJZ6hKp5lvgxLm3YQrY9pqQG2iYidOOKx8wCHWkVIWjMUQZYAS71srjaRx9YurItpd8= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:01 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:01 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 03/10] dt-bindings: iio: trigger: at91-rtc-trigger: add bindings Thread-Topic: [PATCH 03/10] dt-bindings: iio: trigger: at91-rtc-trigger: add bindings Thread-Index: AQHVtb+NaJqoAh7pvkOjOkr/UgCULg== Date: Wed, 18 Dec 2019 16:23:59 +0000 Message-ID: <1576686157-11939-4-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 05dbfc0d-742c-4a2c-3c75-08d783d6b0e1 x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(966005)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003)(562404015);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BrukAJWux2FigqaecMF4sE8v/wrwsDRO36zajMIItx/8QsifCNPsdU4UoeivuvIEAhjrrN9hR24p61pv+OIYG5Ke5UhAwHmS/j+fMKOFqynGsVAMqYSTeHVTluJjiNgDNNPhExlmlKCdOYbYFg9vL1UBCGtZAYwNnDVVnqp+Q50DMY7vlf1+rB6nLjzpi/bAZiObwMvJO9ibm/1fuEX2EB9tdVz5vFbM1NXPlr3w12Q3bL1B49+HsvW8HAyvNpN5Z14Q+gpvVEIAS0N8DrvqdgxMzspe9uTxDXku6iCnrRz5MPukhHNWVABtcw2KDZ2sWcUnbzv4UysFoHzKqF8juJQAz/4JTcBPpAKJ8CL5EvAtpmxgbNxrDFDvJsC5ZtLerzKp1PHHPvgI8c/uVQSnepUsfzIMDyOvRytvuPmu4Ce6PuOtHzRkCcjFlhbcaDIssvyM4ooTQ2Dwn2IQkF+YJuHj9/SsVIh61aNKgZkPAXswhlYKftG4Qx7lnaDLJLDSkMfI/xS2rTNTSnYOF0H8dQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 05dbfc0d-742c-4a2c-3c75-08d783d6b0e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:23:59.8381 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qGxd2A/B9HsdDBDrb864ZQOq8Jha3kmxqpwwy7e6qkth4N5Iel+ywdCai6BNXoeoJsIhjmx/kV9j37G6vG3tWB4wGyyvPJKxOMDicc6Dxik= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev Add bindings for AT91 RTC ADC Trigger hardware node. Signed-off-by: Eugen Hristev --- .../bindings/iio/trigger/at91-rtc-trigger.yaml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 040000 Documentation/devicetree/bindings/iio/trigger create mode 100644 Documentation/devicetree/bindings/iio/trigger/at91-rtc-trigger.yaml diff --git a/Documentation/devicetree/bindings/iio/trigger/at91-rtc-trigger.yaml b/Documentation/devicetree/bindings/iio/trigger/at91-rtc-trigger.yaml new file mode 100644 index 0000000..c8c5886 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/trigger/at91-rtc-trigger.yaml @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2019 Eugen Hristev +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/bindings/iio/trigger/microchip,rtc-adc-trigger.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Microchip AT91 RTC ADC Trigger (Real Time Clock to Analog to Digital Converter) + +maintainers: + - Eugen Hristev + +description: | + Bindings for the Microchip AT91 RTC ADC Trigger. + The Real Time Clock block inside AT91 SoCs can be connected with a direct + hardware line to the ADC. This line can be raised at a specific time + interval in order to trigger the ADC to perform conversions. + Datasheet can be found here: http://ww1.microchip.com/downloads/en/devicedoc/ds60001476b.pdf + +properties: + compatible: + enum: + - microchip,rtc-adc-trigger + + reg: + description: | + Register map address (start address, size). + maxItems: 2 + +required: + - compatible + - reg + +examples: + - | + { + #address_cells = <1>; + #size-cells = <1>; + + rtc_adc_trigger: rtc-adc-trigger { + reg = <0x0 0x10>; + compatible = "microchip,rtc-adc-trigger"; + }; + }; From patchwork Wed Dec 18 16:24:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301321 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 B6A2A138C for ; Wed, 18 Dec 2019 16:26:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BB7F24650 for ; Wed, 18 Dec 2019 16:26:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="DDm9mMDP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727529AbfLRQYH (ORCPT ); Wed, 18 Dec 2019 11:24:07 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:27743 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727482AbfLRQYG (ORCPT ); Wed, 18 Dec 2019 11:24:06 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: Y9GxzBKjwxMKk91CRCvooY4M6Ci4515qSPgr6P7Wmy1CHUjJJOsUT7pkEBLLb49AA8TZw+bZgz dST1xJ1qL2+djKS/PGmpo/knWFmjXYEedVfHJYfvQEv5NarzCm/WvPDjuPTrUmUi/ImEobyNk6 fNgqRXOsJ7QpufYzuXgzlzzmFxTKk6UPLskPaospsbVP7KYHLqKSFAZaJntceGkWKTbbZiL06/ LaqfC95hRqPRgrWRb6Cpbl+LqPjjzUq5vKs1JThUsK8VSfUXoJTBcw0T3amiA2oRsEQlfuAqOM IaI= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="58200036" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:03 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zb196qMDMsEd19zPkZURzdCDF4S2+aZaV8jery0q1pFsvjkF/cf0f+dbCGbhqF6mchwvp30lCyqZK9ve0KVQKBOdQtIGCqsSjK4CFOyv/CHQFa37N/6OzYWymtf9rAxMecOwIHaZ/cEGTIjENIeMig96GTdCXnHDxHmHA6ctJ+iZ3hV7EzLNDC1Ryl45VZXVJLqUSc6Xvsli5zBYXjGE+GuoGLQ8hx+rynkbVlK941WbkrOrJxzp3UDFfY2KzoI1Y60DhPADGIbV8qw7qx4hEQY9M6u++1+2mkItltg3GRcSpkzAkLcyETw6O6+fICi57RKn0pT37T/t8QJxqFPqLQ== 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=bXQ8udlvtPyUpfphdiMvqq84W70x+9q2C0IoOL59urs=; b=nXGOf0B/OX1Ub3qDfqIzoEpRyVip4J6HA1TzP0pzxpy1qgspLGogHoCNU/1qam0eIf7ESNC3v3BdLq+X34qoOjpJByrLTgDS8DM7K0NwEev6JBMjfzErbWqslK2pEFDTftJY/W4pvS0zqI8igvNTyCojREuD/cQGjA8zArX+rIElHd8KzjoCGpu3mMgQWUCl9LylTeZ8DI+KVvUdB+xZXID10pW7B7Oh/pIoWoO9C55Pg8VRTmJu3NXu4+12IK5kFtxMhWVsMb7BS7O6p2byKR4TjREhxSnY9Ta8OgOT4ZWaJARB9QpBmrg9my8UOMoB18TkVq41Iwu4A5Re1gzhWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bXQ8udlvtPyUpfphdiMvqq84W70x+9q2C0IoOL59urs=; b=DDm9mMDP2ewKYQp48JY2d7O1tiNijswLe8wAy5zNTTfSF0KRA/NITLZTM6Yvg4+6K2mW07ufVePX9pAakUMWuoB9OtcF27jJfjSptLsCTwbzbL062pD+xdZg/l610fDQMnbxHCOSVJyvf2+yNuzc7aNbNFgeivwwOfEGkAhEoww= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:01 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:01 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 04/10] rtc: at91rm9200: use of_platform_populate as return value Thread-Topic: [PATCH 04/10] rtc: at91rm9200: use of_platform_populate as return value Thread-Index: AQHVtb+OEQqavda3i02bVS64GBIv7Q== Date: Wed, 18 Dec 2019 16:24:00 +0000 Message-ID: <1576686157-11939-5-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2bbf8bd1-17d7-4956-04b1-08d783d6b138 x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1728; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4744005)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jlcrGL6nAuOZ5gZwwvVWGXr0FzA//wNGwJJ2RJ8yp0VbF8wtggpIE1O6w4DFZ9HCfVou4z5Nf5zSlCW7QlUUVBt+oHaVMTXhqJ4v5poNYTTzqSXlgLviZ5mfavHFLLjWG4p3orcfUOQ2t54FguYNfkhcyZQw3BhAoUg0IIOB7OxeXZ/OTJOJOP8+l5u4cxbvb9rzHsg9mjJUZdLmUNm4B5vtPzLfRy6dJJepBypshohnPQb9hxqNoDt0ywnq1h2koXwLsmHpwf70BEWVatC6mFF22iYYvS50gvt7+xvXskIAHYIAUukapaxQV/8IHnKkZHcVB7PVW7YlDvmcDZhFNAsOZNiD/uikfDqD5yYi/LbYHVW7vpnSFQVrIdxasFytHZCOnkAKqx2Ws8w61KkCnGtuhg7J5I5n20FOzSTNJMU/wacbxnryNk0+v0SNnDE2 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2bbf8bd1-17d7-4956-04b1-08d783d6b138 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:00.4408 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZRYxaDwzzllJZJ/0TgHIU60guO1+YiM9iWtk/CA4vQhFdpMdkSwnX/Sv8uzwnZUHxwMYeuE1rl+sIvgtuP3j9e6GbWYKuYpwEb6uybX8M/U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev This allows the RTC node to have child nodes in DT. This allows subnodes to be probed. Signed-off-by: Eugen Hristev --- drivers/rtc/rtc-at91rm9200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 3b833e0..f1b5b3d 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c @@ -421,7 +421,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) at91_rtc_write_ier(AT91_RTC_SECEV); dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n"); - return 0; + return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); err_clk: clk_disable_unprepare(sclk); From patchwork Wed Dec 18 16:24:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301329 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 6559F14F6 for ; Wed, 18 Dec 2019 16:26:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F84024650 for ; Wed, 18 Dec 2019 16:26:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="UwWYIs4N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfLRQYG (ORCPT ); Wed, 18 Dec 2019 11:24:06 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:12945 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfLRQYF (ORCPT ); Wed, 18 Dec 2019 11:24:05 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: jCu5830BU85l0txbOUKxGhxBNJ5v409VpwPrcLZMUmKL9ZGMbHpZtIlKFTbBLZ6arVgBOVQBYa rB/Hu+4i5s34uRq8Wr0VQlUB6lSaQqzi3Kxa0uTBnV5l7BVAOG/5tzgSiYzc/Q6mnYIX4pKjqz 6DB+7stPADCrjMSZwXbhk+6O29wgUiI6iJ6IyeaNYYCeuDuWekRt1Dkyy/rme463DBxChbtGcX N0Drc4FUpBGcnrI25QBplXcemwCOn0SQuEKyO//mnhGwdCraRnTlN5UAnmT9bJpop3fvPoHJkW e+Q= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="60223160" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:07 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGRG/YknDNBY6wd6eXAlyYPTWPAv2jvsWSX3idgET0OHhLYkC4qGezb87zYL1rNhE54g2h+ArHmOl314813tfWrww2XAo/K5pu7RARHzHaa6rp5X2qIs53pABAyUYJdC6Fs3I/CKODFMFXFsALcp7qh+QY64tDQI97JR0lKV7asEkrZR8syPD67JKyq9C96NH+jUK4TidaB794Ijc+EjYN/cPD8LMKj4e3FXKvNYJYN+nlUqdtSfUaF4lf8LT4pR36/r8kfvlmihHt9lJjvcd6t2RlNKWQH2tb984Cim33gw7ijLnMUS2zkN+g3gM5KZ+wjuYZgB5jWMsVk3+USPzw== 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=GT+kt38DogHrZxEsh9bAfRdM7ydty5Uf6V/qtCsHzhA=; b=T+TjhJJ2DTZSWPWYin0Fmz4wuVr2gisLHx6R8gTIqbwD62ncIrujiKnwwaOlDDglTaM5aRTNIEoGN2O46RBM5g9Wz/SEphMkBr1gp7i4HT93SrRBXhBD8GTLS1TjoJYdn3jQb7Gmk6k/sh5CJgbFVM9LGsfgo+clGdXj8dEOHF0is90kkb6rUlQ1RYZoaNVu5VNNGePxTYOFLYhNfIsp1M4CdidkEf+K5yVnOow4/U4JNdRzgf4B9+c8k55B//nT1/dbUrMB4DMr18UUNWqGSfusfftlFntncNUU8U7FpvZ5P9OUvrjIHrWnolhoHrJaw/zWTcc4OMWotFLtmgSlrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GT+kt38DogHrZxEsh9bAfRdM7ydty5Uf6V/qtCsHzhA=; b=UwWYIs4NwC2PboSJtdOgW4az5L87Cwv0KqMFMfRlms1hW0WgahfHQ/RQ3Ki4AjDhPm4HbwL4Du18O0j9AkmZQTjGRIC+iWxCSYw0btxI/hC3KWduMpIouws5dn2kq1t+jAhWMujEVE5rYVOIT6zXkHnH2Hyx4aVgwO9/asJYnWo= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:02 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:02 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 05/10] iio: trigger: at91-rtc-trigger: introduce at91 rtc adc trigger driver Thread-Topic: [PATCH 05/10] iio: trigger: at91-rtc-trigger: introduce at91 rtc adc trigger driver Thread-Index: AQHVtb+OYkdaymH01keAcIhHVKgeHg== Date: Wed, 18 Dec 2019 16:24:01 +0000 Message-ID: <1576686157-11939-6-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: da5b69d9-fa62-48e4-266c-08d783d6b1b6 x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1091; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gZ1G1LkCJGpuNnFsHW7ezN1lfihGNyoYJw32x80ojQ91MrmM3uRXzY5yxtb2ONDQZipi/BODCM488V7fwfJBgq+J6BPI+t9wgbvqud3xW/no9NF9AXxCOpwURqP+xipNxZfa+KfXu0QOhGOkCroo5fzxIc+tmRiA1GFGUdskA1He4SchDdX9N+sxFU/izfPmd2qW0MCJlJdZV/KBHBGlE5mPQ7HcfGysrxnvASDpRgQg1gCCn9ROpioH6GrrshZL7LclzDOjP2YcSlrJttbHTSzJvRZAYijdkFh5nU5a7SRa/kQCl2RkqOvZLdBn7A6HGA4r9ptcBwZmQXUFFJOfKWo+DqnrE2CwSUU9VhfXCCGCuCOWsAtA3TltwEqBLe8BcQPXKdM80XjmH8M1jlC2GgRAkmhYU6hAi5OXZfGFR01joe3TKY16GqmyFgusxKGg MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: da5b69d9-fa62-48e4-266c-08d783d6b1b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:01.0765 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WGHdOPoSlT6zVruqW1mA1Xi2pkee4tZY+MMHb2zCiVnn7px7XkHlDXlYhZXC6GoqtEejn2uiAqvgeaKN6ce0AoHTL8/oWZmwBzbgpwyBZBk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev The AT91 RTC ADC trigger driver registers a trigger into the iio subsystem, which can be associated with at91_sama5d2-adc compatible drivers. The SAMA5D2 SoC contains a hardware link between the RTC block and the ADC block that will allow the RTC to trigger the ADC to perform conversions. The at91-rtc-trigger will allow the customisation of the trigger frequency from sysfs: trigger_frequency_hz_available will display possible frequencies in Hz trigger_frequency_hz will allow configuring this frequency. Signed-off-by: Eugen Hristev --- drivers/iio/trigger/Kconfig | 10 ++ drivers/iio/trigger/Makefile | 1 + drivers/iio/trigger/at91-rtc-trigger.c | 213 +++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+) create mode 100644 drivers/iio/trigger/at91-rtc-trigger.c diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig index 8cef2f7..dc7e6f4 100644 --- a/drivers/iio/trigger/Kconfig +++ b/drivers/iio/trigger/Kconfig @@ -68,4 +68,14 @@ config IIO_SYSFS_TRIGGER To compile this driver as a module, choose M here: the module will be called iio-trig-sysfs. +config IIO_AT91_RTC_TRIGGER + tristate "AT91 RTC trigger" + help + Provides support for using AT91 RTC IP block to generate trigger + events for ADC devices. + If unsure, say N (but it's safe to say "Y"). + + To compile this driver as a module, choose M here: the + module will be called at91-rtc-trigger. + endmenu diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile index f3d11ac..6512436 100644 --- a/drivers/iio/trigger/Makefile +++ b/drivers/iio/trigger/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_IIO_STM32_LPTIMER_TRIGGER) += stm32-lptimer-trigger.o obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o +obj-$(CONFIG_IIO_AT91_RTC_TRIGGER) += at91-rtc-trigger.o diff --git a/drivers/iio/trigger/at91-rtc-trigger.c b/drivers/iio/trigger/at91-rtc-trigger.c new file mode 100644 index 0000000..8cdcfeb --- /dev/null +++ b/drivers/iio/trigger/at91-rtc-trigger.c @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2019 Microchip Technology, Inc. and its subsidiaries + * + * Author: Eugen Hristev + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define at91_adc_readl(t, reg) readl_relaxed((t)->base + (reg)) +#define at91_adc_writel(t, reg, val) writel_relaxed(val, (t)->base + (reg)) + +#define AT91_RTC_MR 0x4 +#define AT91_RTC_OUT0_MASK GENMASK(18, 16) +#define AT91_RTC_OUT0_NO_WAVE (0x0 << 16) +#define AT91_RTC_OUT0_1HZ (0x1 << 16) +#define AT91_RTC_OUT0_32HZ (0x2 << 16) +#define AT91_RTC_OUT0_64HZ (0x3 << 16) +#define AT91_RTC_OUT0_512HZ (0x4 << 16) + +/* attribute pack list */ +#define AT91_RTC_1HZ 1 +#define AT91_RTC_32HZ 32 +#define AT91_RTC_64HZ 64 +#define AT91_RTC_512HZ 512 + +struct at91_rtc_adc_trig { + struct iio_trigger *trig; + void __iomem *base; + unsigned int hz_config; +}; + +static int at91_hz_config_sysfs_to_reg(unsigned int hz_config) +{ + switch (hz_config) { + case AT91_RTC_1HZ: + return AT91_RTC_OUT0_1HZ; + case AT91_RTC_32HZ: + return AT91_RTC_OUT0_32HZ; + case AT91_RTC_64HZ: + return AT91_RTC_OUT0_64HZ; + case AT91_RTC_512HZ: + return AT91_RTC_OUT0_512HZ; + } + return AT91_RTC_OUT0_1HZ; +} + +static int at91_configure_trigger(struct iio_trigger *trig, bool state) +{ + struct at91_rtc_adc_trig *t = iio_trigger_get_drvdata(trig); + u32 mr = at91_adc_readl(t, AT91_RTC_MR); + + mr &= ~AT91_RTC_OUT0_MASK; + + if (state) + mr |= at91_hz_config_sysfs_to_reg(t->hz_config); + + at91_adc_writel(t, AT91_RTC_MR, mr); + + return 0; +} + +static const struct iio_trigger_ops at91_rtc_adc_trigger_ops = { + .set_trigger_state = &at91_configure_trigger, +}; + +static ssize_t at91_rtc_trigger_frequency_get(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_trigger *trig = to_iio_trigger(dev); + struct at91_rtc_adc_trig *t = iio_trigger_get_drvdata(trig); + + return scnprintf(buf, PAGE_SIZE, "%u\n", t->hz_config); +} + +static ssize_t at91_rtc_trigger_frequency_set(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct iio_trigger *trig = to_iio_trigger(dev); + struct at91_rtc_adc_trig *t = iio_trigger_get_drvdata(trig); + int ret; + unsigned int val; + + ret = kstrtou32(buf, 10, &val); + + if (ret) + return ret; + + if (val != AT91_RTC_1HZ && val != AT91_RTC_32HZ && + val != AT91_RTC_64HZ && val != AT91_RTC_512HZ) + return -EINVAL; + + t->hz_config = val; + + return count; +} + +static IIO_DEVICE_ATTR(trigger_frequency_hz, 0644, + at91_rtc_trigger_frequency_get, + at91_rtc_trigger_frequency_set, 0); + +static IIO_CONST_ATTR(trigger_frequency_hz_available, + __stringify(AT91_RTC_1HZ) " " + __stringify(AT91_RTC_32HZ) " " + __stringify(AT91_RTC_64HZ) " " + __stringify(AT91_RTC_512HZ)); + +static struct attribute *at91_rtc_adc_trigger_attributes[] = { + &iio_const_attr_trigger_frequency_hz_available.dev_attr.attr, + &iio_dev_attr_trigger_frequency_hz.dev_attr.attr, + NULL, +}; + +static const struct attribute_group at91_rtc_adc_trigger_attribute_group = { + .attrs = at91_rtc_adc_trigger_attributes, +}; + +static const struct attribute_group *at91_rtc_adc_trigger_attr_groups[] = { + &at91_rtc_adc_trigger_attribute_group, + NULL +}; + +static void at91_rtc_adc_trigger_remove(void *priv) +{ + struct at91_rtc_adc_trig *t = priv; + + iio_trigger_unregister(t->trig); + iio_trigger_free(t->trig); +} + +static int at91_rtc_adc_trigger_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct at91_rtc_adc_trig *t; + int ret = 0; + + t = devm_kzalloc(dev, sizeof(*t), GFP_KERNEL); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + + t->base = devm_ioremap_resource(dev, res); + if (IS_ERR(t->base)) + return PTR_ERR(t->base); + + t->trig = iio_trigger_alloc("%x.at91_rtc_adc", res->start); + if (!t->trig) { + ret = -ENOMEM; + return ret; + } + + t->hz_config = AT91_RTC_1HZ; + + t->trig->ops = &at91_rtc_adc_trigger_ops; + t->trig->dev.parent = dev; + t->trig->dev.groups = at91_rtc_adc_trigger_attr_groups; + + iio_trigger_set_drvdata(t->trig, t); + + ret = iio_trigger_register(t->trig); + if (ret) { + dev_err(dev, "failed to register trigger.\n"); + goto at91_rtc_adc_trigger_probe_fail_register; + } + + ret = devm_add_action_or_reset(dev, at91_rtc_adc_trigger_remove, t); + if (ret) { + dev_err(dev, "failed to add disable action.\n"); + goto at91_rtc_adc_trigger_probe_fail_add_action; + } + + return 0; + +at91_rtc_adc_trigger_probe_fail_add_action: + iio_trigger_unregister(t->trig); +at91_rtc_adc_trigger_probe_fail_register: + iio_trigger_free(t->trig); + return ret; +} + +static const struct of_device_id at91_rtc_adc_trigger_of_match[] = { + { + .compatible = "microchip,rtc-adc-trigger", + }, + { /* end node */ }, +}; +MODULE_DEVICE_TABLE(of, at91_rtc_adc_trigger_of_match); + +static struct platform_driver at91_rtc_adc_trigger_driver = { + .probe = at91_rtc_adc_trigger_probe, + .driver = { + .name = "at91-rtc-adc-trigger", + .of_match_table = at91_rtc_adc_trigger_of_match, + }, +}; +module_platform_driver(at91_rtc_adc_trigger_driver); + +MODULE_AUTHOR("Eugen Hristev "); +MODULE_DESCRIPTION("AT91 RTC ADC trigger driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:iio-at91-rtc-trigger"); From patchwork Wed Dec 18 16:24:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301325 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 9159917EF for ; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6ECEA24650 for ; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="m9/aRdV0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727523AbfLRQYH (ORCPT ); Wed, 18 Dec 2019 11:24:07 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:12945 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727480AbfLRQYG (ORCPT ); Wed, 18 Dec 2019 11:24:06 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: +u6qDxuasyG/sLATr7gig3NVxLPi5Hf/BVBghNr4+0+SUl1GbAiPn/vkFlNFhUV5HhBWTulXpn PAmzGhKBOaHVP2UyYx7KmqFZ/szL5AVpZ5kJ9w7t9Kp3GFAwMqtaVgMWjLIL/R3+HPjJ+HCfxb TLnKoBT3PNCsGTn/RMAZCOZDHvKu7HCSOxYXhGuZ68jddUtqRVvP+uXwapxHKusI23cxemdVoi RQx0iS3gzYCNZexkXs8DXBW6wPOf67nSrt97fsBFciUlTaJxD9RZTJTwdxXcn7YZtD+kJi1wb1 B5U= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="60223162" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:04 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:07 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VkI4qiqttvtQssF35t0VHmSJhY7V2wEyaziUDoBV5o6fe9e+P/i0eZQTyNywbqR5DS7zmD5wAS0odc3q7slQXrjIUy3SWnJ5ftbPPmUaaDJYDIPZ7Whm45Zn7tJEADvblRlPVXs1uYE3mhHEiErNSLcOHUHQVP/jEnC0fMazyGunXoBrYSnsWzemrLgUjU4E/bt/nZHuK9RDuQpNU+81k1yWkGvReTEEsYFXtaSQy5JbQbSBtHv93ZqsfehtZfH/BylExneRBHSi1MBshS7WI/O0MrVWY+6645beT/bfQwdX47U/LzF1j3MeGlZ2f11Usp65v8/haCVA9s8l7o3DLA== 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=8BEv13w7JRiLck9fEGIRPyRUHMQ43WA1ktVlgQhqN48=; b=FpBVWupKVskPUkFs8kIyGio3CQ+b1ajWjUnRBVSETpUjfifa8qUKsLvweU9HE4rghku9Alxw/fm1bUs2Eg1VkcisVFQ0XTSO8NadGc65nE8kOy7JAGgG/KdgdN93nWcwQQmSoLOgKHicZ9SXR8gpUptSU12bdZo+kjp9VGpDPUeN463KOwqNJ2vIde0o0+EzwmzValTAFjregZndhu8HzaLAmrumlVsCEJdJeVBvga+q+6WQaRrGllHu4JEf2Ypn6S3FzFGKs9MrNgBAdlNDaCAVG4tGFz6G8wYkAObsAk1O6JunOFERg9lQVeWWp27OgxQT7ueW12wrHO6d6MSruw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8BEv13w7JRiLck9fEGIRPyRUHMQ43WA1ktVlgQhqN48=; b=m9/aRdV0CgmjZ69rCjOgPnd8U3u67yA1rwseMOiflmDtm+WJ2sP7qaziXZCbvKJDDQ25kbq7yb2M7QQq9QvGgjr/ODW21PXfbL70kd7An0rXo9dRmP1dHUc0Q6f9MyRzqCmQwbtnTX+g78Cxoag05OqbX3SX7NPDw8F2tzCpgH8= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:03 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:03 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 06/10] iio: adc: at91-sama5d2_adc: handle unfinished conversions Thread-Topic: [PATCH 06/10] iio: adc: at91-sama5d2_adc: handle unfinished conversions Thread-Index: AQHVtb+OsZRnT6XyDEmDjlFvS26mBg== Date: Wed, 18 Dec 2019 16:24:01 +0000 Message-ID: <1576686157-11939-7-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dc5c8436-1abf-4358-d823-08d783d6b21f x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bCkJtutP0xy68E4acZfq30j4VmYN2Nq+46TvoZU20ewDRoXLjMQgT8LrMOluBNkOyN8L5EYI3QRMyzuGLBss6pYdvjK9JjAUvlkBCRpTs/viIX8FgbFHmpzDEty4ZtadG1sGI2ABtsjCIHstb0YrtI+oYwT+p15SZ5wsitlYXJ6dOCyv+O6V1CFWbWNEUA1GJoKDkl9boHmf9IgnNtOds6KxRn+FwFS/kR3nUCV5R1kEwPLJAe0VbnP7+t5SgO3RLPmbYuIukLn/OVdaAIEa7on/qqpb4DtD/9t3WSUhqAWoxYextHhtUbizjzWyy6K55k+wfHFwpuM6h6bEafPoROCFMtShVgvYXZGb2eG8gI9wH42LNOkhLoaxLkXdS3ZkE0v4wso5a/Acr4bdMaiFblXypcd9H9o7qcD9N16gJTVw+nFI8UcNTwnpzDZ3UhMU MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: dc5c8436-1abf-4358-d823-08d783d6b21f X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:01.5143 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: G660RjdCDbWxNRYwl49ps7IP40kT02FrxHff87XVFsM/VCHlTE3pYI9B3JGcmNuBnbaPfexSBvi7bmQ2CcgFsUqpoxdXSeAHHM1QvUAgSy8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev It can happen that on IRQ trigger, not all conversions are done if we are enabling multiple channels. The IRQ is triggered on first EOC (end of channel), but it can happen that not all channels are done. This leads into erroneous reports to userspace (zero values or previous values). To solve this, in trigger handler, check if the mask of done channels is the same as the mask of active scan channels. If it's the same, proceed and push to buffers. Otherwise, to avoid sleeping in trigger handler, start a workq that will wait until all channels are ready. Normally, it should happen that in a short time fashion, all channels are ready, since the first IRQ triggered. The workq can stall in a loop if a hardware fault happens (for example the clock suddently dissappears), but if it's a hardware fault then even exiting the workq won't fix the hardware. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index c575970..a6b4dff 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -487,6 +488,21 @@ static inline int at91_adc_of_xlate(struct iio_dev *indio_dev, return at91_adc_chan_xlate(indio_dev, iiospec->args[0]); } +static unsigned int at91_adc_active_scan_mask_to_reg(struct iio_dev *indio_dev) +{ + u32 mask = 0; + u8 bit; + + for_each_set_bit(bit, indio_dev->active_scan_mask, + indio_dev->num_channels) { + struct iio_chan_spec const *chan = + at91_adc_chan_get(indio_dev, bit); + mask |= BIT(chan->channel); + } + + return mask & GENMASK(11, 0); +} + static void at91_adc_config_emr(struct at91_adc_state *st) { /* configure the extended mode register */ @@ -1044,12 +1060,13 @@ static int at91_adc_trigger_handler_nodma(struct iio_dev *indio_dev, struct iio_poll_func *pf) { struct at91_adc_state *st = iio_priv(indio_dev); + u32 mask = at91_adc_active_scan_mask_to_reg(indio_dev); /* * Check if the conversion is ready. If not, schedule a work to * check again later. */ - if (!(at91_adc_readl(st, AT91_SAMA5D2_ISR) & GENMASK(11, 0))) { + if ((at91_adc_readl(st, AT91_SAMA5D2_ISR) & mask) != mask) { schedule_work(&st->workq); return -EINPROGRESS; } @@ -1269,9 +1286,13 @@ static void at91_adc_workq_handler(struct work_struct *workq) struct at91_adc_state *st = container_of(workq, struct at91_adc_state, workq); struct iio_dev *indio_dev = iio_priv_to_dev(st); + u32 mask = at91_adc_active_scan_mask_to_reg(indio_dev); if ((indio_dev->currentmode & INDIO_ALL_TRIGGERED_MODES) && iio_trigger_validate_own_device(indio_dev->trig, indio_dev)) { + while ((at91_adc_readl(st, AT91_SAMA5D2_ISR) & mask) != mask) + udelay(1); + at91_adc_read_and_push_channels(indio_dev, st->timestamp); iio_trigger_notify_done(indio_dev->trig); } else { From patchwork Wed Dec 18 16:24:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301323 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 65D6614F6 for ; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A12124682 for ; Wed, 18 Dec 2019 16:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="WfbfkTHo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfLRQYH (ORCPT ); Wed, 18 Dec 2019 11:24:07 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:32906 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfLRQYG (ORCPT ); Wed, 18 Dec 2019 11:24:06 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: 54t8XRM829Q2q/CWuqD/LrgHY2/4F1miElyj+WbnYMSQTkqDteWZLdC9VsgsmdD2lLDoS/bfq/ wkUbM4GZeXTvdFW0YGmCnaRee/JgoBx7dhDJ8qjEBYHihfpi+XwMcp9nvpCpILn0T8RTf/wOfT ZgBFRhHOwBaGPi5MT0pGBo+kecAeIbrrGsLiwNQDKJ9MggGGSinoqDVOEifgOilWn682xgucjj HuXy6K6pTB+unqVg/QdGYUz7fbcf4uyS2N6VrPwUj+QW2moX0b78IdPI7V3h2YqXQp7WqdQPiF STM= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="59426831" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:06 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:03 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ofKReA+c+mO8H6rxGzY9S5ANOykX+6h5qyZgQnatylGxsv/1lvOHtQuyGcOTJTQMwQfzsnymTlAGn5+6E+BZGWOcxjIHSKzRRkBSeTd5eSnuIXiUOWSQfVYR3LjM4WRao3WLNMxn+npxIzsnYzGa91jwkAfaAnh7FmLDb1SaUS7QBLWgNktpZj0XZeUDsPkK+ERpmQT4ZaMnaVbNsJ6i/5o3U0okAcwFL94EnqHsI+cUNcIA9b2R/JmJTyCjA7xYCCMtLqsaKgpcXh3Gj8kau0NanlCpwVTe27EJ7LAk+V1nBBymx/ImF6Z1ixza2xBKmd+aEid+hEFEtSC1qM0/bQ== 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=McsuxWfwAiDTwpWDkwexX3EQK7P5A7czExPwE95bd/k=; b=hdozcbTDDTTaDss4rCRZVgVtblJnQiWSqdO026MOGQZr5PUHqTnRZgOU2WsDLKjauGYFkbg3h1RzGacTW8ciPnUaLySk7jwoV8N/VwSnRVT7zrFZJtJyPUKY5hr+Bsn8SD4vTTHDBqtGp/KfPMGGb+D9zXiYFCD9CG4N2JUdW1TAEqsdYTblMFSACaZxYGTvaGfvUIFVSitHA2HJfG9yRHbXM+Rnv1d5I1ZTL1jIB9fi8RmuIa/5W9qUrum/DHP17oIjM28rW5Bawp5H60vIhglu+zoeOWnjdJNi47uIjjh45oQCStrmhOSWkYij1H0OxT1y8PEiLnp95OCna29HEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=McsuxWfwAiDTwpWDkwexX3EQK7P5A7czExPwE95bd/k=; b=WfbfkTHosP+S2fneiaHS/bZtoa/uOtBS08IxzmLCrUoJy6efVg9b/7xCVFw05j78IBmZIOXcNI6cDeFmLtL87/Zh7CsFs8XaaT257Yeihl+nDJrYvZIbcd1fRBcXM+gqIW2jjAKzkBQjoAjvJ2FyGyopKXljLcI/h/elmMPDfZI= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:03 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:03 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 07/10] iio: adc: at91-sama5d2_adc: fix differential channels in triggered mode Thread-Topic: [PATCH 07/10] iio: adc: at91-sama5d2_adc: fix differential channels in triggered mode Thread-Index: AQHVtb+PmhwCEX7J1UOzKiW28GxaNQ== Date: Wed, 18 Dec 2019 16:24:02 +0000 Message-ID: <1576686157-11939-8-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 52e8501c-9637-4c66-d7fd-08d783d6b289 x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Udr616FaIBeDmaSkpQNCsm7NPPt9RRG+WunS1+bI5x6eTtAsAyBQMqBEXxEFz7Un6h55ouGvPRwxdl9MYyE3+/i3V3Dd7WnZSzLjkaxyfgJh5Aey68AOJV/N4f8delzWXm5FYahECd1+y4hV17fM/vp71D5w9+FSBWfjHWAJ117D/xEeMm+/juP0hevnZPbkVQDxYN8jiiHKaKF8UwxA7BhISrxmtZwfRgxNwasAj2ZCRu8K58A3n2tDfv2EhqtD9NKlPu4QdrKzlHm5y2MTKb/Sd/9YwewL7pt9iW+E4qND4nPWhgxVAOtyU8T3QYIFmH0F7OBD1k7cbeC0hT8Kwv8kTnlpJCcJDNyXyX1n09fUtlc3WDAiQfdPxQ36wsc3XHvopIudjw2Y+0JhuPL9Fenwz72oQaQWC5pbk9ZUyASp5Y1VUjeUl316fz3lY5zT MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 52e8501c-9637-4c66-d7fd-08d783d6b289 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:02.1770 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: VL92VuJQSbOkmkVR5Or1deDyjvDpthl4dMu0WUQS9Oj0hk5/px4q1mAORgPOxHQ6lBYPrBUDuMicr8wO6IwHsJ29vJ+jPlFiyugDCsJBqfg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev The differential channels require writing the channel offset register (COR). Otherwise they do not work in differential mode. The configuration of COR is missing in triggered mode. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index a6b4dff..ccffa48 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -900,6 +900,7 @@ static int at91_adc_buffer_postenable(struct iio_dev *indio) for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); + u32 cor; if (!chan) continue; @@ -908,6 +909,17 @@ static int at91_adc_buffer_postenable(struct iio_dev *indio) chan->type == IIO_PRESSURE) continue; + cor = at91_adc_readl(st, AT91_SAMA5D2_COR); + + if (chan->differential) + cor |= (BIT(chan->channel) | BIT(chan->channel2)) << + AT91_SAMA5D2_COR_DIFF_OFFSET; + else + cor &= ~(BIT(chan->channel) << + AT91_SAMA5D2_COR_DIFF_OFFSET); + + at91_adc_writel(st, AT91_SAMA5D2_COR, cor); + at91_adc_writel(st, AT91_SAMA5D2_CHER, BIT(chan->channel)); if (use_irq) { at91_adc_writel(st, AT91_SAMA5D2_IER, From patchwork Wed Dec 18 16:24:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301319 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 AB5B2138C for ; Wed, 18 Dec 2019 16:26:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74B5324650 for ; Wed, 18 Dec 2019 16:26:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="T8Qio/2x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727458AbfLRQ0O (ORCPT ); Wed, 18 Dec 2019 11:26:14 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:12945 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbfLRQYH (ORCPT ); Wed, 18 Dec 2019 11:24:07 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: PcQEKEfSyTfD+XhAm0uOOD5LGVV+SiqiT71XH9TdgR2Wrbugw2KE4w/ElpY92XDKLUIrcdF92F pjJdO31HdRg7qYhH3DYyl0d89WKtElFybZDjJpVODXqdKn07moBj31wPEqmJxFT1HRbtU/gGbj 5r7So9UyBeGE4t+Vt7QSPiDn0WfYrko2R8jWowINaH5ufIhndHAVV2vx2ZPvhHpOHM6gP8ly26 wAOcoWA3Zb8lJ9a6rsDfiz/RbPigIi6HBBKE4FSp9nqu6+gMujL9pHpqgatGNMRg3XfQF2Sp4E W6A= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="60223176" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:06 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:08 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OOeP6BA/qVSPQqBZv6UjNPM5Fehxc4fhb247rnTjDVC+BDuas9ex33HMKfPE9AkRMsUlmqKXgvrcnlfhbaxz1bCNOhZ9Ab/CY7ErlBOKkeQePtvG6a5WC1azSQDmbt7qcaXaOHM4EowA322BwsR69nEBs48n3f3Ua4m0FNqcoDBoOQPOiKnYhtqi/52Qv1YlgNrLjWdWrv7aC404z7x+3NIiekMmUNzzRpBO+z/0IJbBuoU28oiAJ/sURPIXk0edeJg2+q5xm/qwJetQ1iIIpNxBrp3WU8Ve0oRINJnis1hW0JcOERI3icugk6KyUOvemdLIUEfpR52UEutyW+K5jg== 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=EJqTrSHZ7TbZm2JF06kDVV71UCjwadk6kmq23nwf1Xo=; b=ZAiUHH4SuBp6Grw+HcBWX8IO+D6BRwEKKM9bGSKseKcR3ZI91yZdCbLjnaFnFzK6k/xu5AaXgbMKmO0UWUyhHiJ3G2dUqr3jjsY94RnN1MFK8Qj/n07h+333d7H/5fF1ggXjxUlXj9ESqmM5MuxXYXHQms/OXFtJ/iFQjzHBjevwq2R9WBH/0ax5wQ1lZ/+VfxcQnaBxuyWSJfio+lcizSQm5R1BLlw6xeBqjF/LzwlOchBqQIaPY8gb73R5k0O1V0Y4KbWM/S/zDFCr0lnbznFGt/LocMveUIahAJ3dboJx/5qzZnuNyMSORoKrNYC6FqbkXVLcHlj57/YT8x0MsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EJqTrSHZ7TbZm2JF06kDVV71UCjwadk6kmq23nwf1Xo=; b=T8Qio/2xqykdAtJHWqn4JfGEPXTWG1WEIgswCK83wnYw+3Jb2ytX+/p/mAz1VS0i7KvTmY/ANlIvOQ8tgr0KHeiEabjILa3dZysrXryuTr7o2U0VXLAQIiHDVSgSu4AhY0GMdE47K31oq84VndO9HCMMpJUScxw5/jT5olHI6Bg= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1769.namprd11.prod.outlook.com (10.175.87.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.19; Wed, 18 Dec 2019 16:24:04 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:04 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 08/10] iio: adc: at91-sama5d2_adc: implement RTC triggering Thread-Topic: [PATCH 08/10] iio: adc: at91-sama5d2_adc: implement RTC triggering Thread-Index: AQHVtb+PY+2GOhnEgUmPI9B1JjcPqQ== Date: Wed, 18 Dec 2019 16:24:02 +0000 Message-ID: <1576686157-11939-9-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: de9518a9-816d-4edd-7cd3-08d783d6b2f0 x-ms-traffictypediagnostic: DM5PR11MB1769: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1247; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39860400002)(136003)(346002)(376002)(199004)(189003)(66476007)(66946007)(66446008)(76116006)(91956017)(2616005)(64756008)(66556008)(86362001)(186003)(316002)(110136005)(8676002)(54906003)(8936002)(71200400001)(81166006)(478600001)(2906002)(6512007)(26005)(81156014)(36756003)(4326008)(6506007)(5660300002)(6486002)(107886003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1769;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: auXWNrOB7IiMQ6Qv3HJfkGHrvtg5CcOwKG8HCoUvXhr9C12luOXCnO7eI8j1+mdwSYrtAnPn1mQVIcE/v7xXLucIO9exLfhqJxliJMUMNhSR1qTnzAskSTFyZy3/n/ZuagUEVK3akN2iTOy6XSk/2WEaQnjcZzUMhXz/Yo/6Q+VzzOSHwietMXNvvHqQLvp8nTS10qac4u3d4q3wzegOfVSNvfNGD1fHs8TjxiATD2akOiKM1d6KDtVKMXTJo0cObipjUyJ3YsUtnmqmuvjmdQxapWelXUssF4IPIvJ/LKg6r4z3TTdHH7d2oem71AoJZCcGEcuoFm73aztMIQmDxm7RPBa1TxRl8VnzUEPp/o6GpfOkICqgnh0HnJ9REUmUwpJqeasi4xJXYTi8Kq3/cn/53Fhs0LraKYD/7m/6h0ToQJ7wfuj9OMPi8jWLABmm MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: de9518a9-816d-4edd-7cd3-08d783d6b2f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:02.8277 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: A0M66B1eUg1QrnZYRG2LpBybtxzJc7NO2O2LkE5DN0XBta2ZvbT4BLM2sN8WlJQJ1eA7DG/Iot0Z6One3E3gTVVUUCTvd1WWXvRjbSbyQJU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1769 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev Implement the property atmel,rtc-trigger which provides a phandle to a RTC trigger. To make it work, one has to check at buffer_postenable if the trigger the device is using is the one we provide using the phandle link. The trigger mode must be selected accordingly in the trigger mode selection register. The RTC trigger will use our IRQ. Dedicated hardware line inside the SoC will actually trigger the ADC to make the conversion, and EOC irqs are fired when conversion is done. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 109 +++++++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ccffa48..ac97f4a 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -58,6 +58,8 @@ #define AT91_SAMA5D2_MR_TRGSEL_TRIG6 6 /* RTCOUT0 */ #define AT91_SAMA5D2_MR_TRGSEL_TRIG7 7 +/* TRGSEL mask */ +#define AT91_SAMA5D2_MR_TRGSEL_MASK GENMASK(3, 1) /* Sleep Mode */ #define AT91_SAMA5D2_MR_SLEEP BIT(5) /* Fast Wake Up */ @@ -195,6 +197,8 @@ #define AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_FALL 2 /* Trigger Mode external trigger any edge */ #define AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_ANY 3 +/* Trigger Mode RTC - must be any of the above 3 values */ +#define AT91_SAMA5D2_TRGR_TRGMOD_RTC AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_RISE /* Trigger Mode internal periodic */ #define AT91_SAMA5D2_TRGR_TRGMOD_PERIODIC 5 /* Trigger Mode - trigger period mask */ @@ -407,6 +411,8 @@ struct at91_adc_state { struct mutex lock; struct work_struct workq; s64 timestamp; + struct device *rtc_trig_dev; + bool rtc_triggered; }; static const struct at91_adc_trigger at91_adc_trigger_list[] = { @@ -737,6 +743,42 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) /* set/unset hw trigger */ at91_adc_writel(st, AT91_SAMA5D2_TRGR, status); + status = at91_adc_readl(st, AT91_SAMA5D2_MR); + + status &= ~AT91_SAMA5D2_MR_TRGSEL_MASK; + + /* set/unset TRGSEL to ADTRG */ + if (state) + status |= AT91_SAMA5D2_MR_TRGSEL(AT91_SAMA5D2_MR_TRGSEL_TRIG0); + + at91_adc_writel(st, AT91_SAMA5D2_MR, status); + + return 0; +} + +static int at91_adc_rtc_configure_trigger(struct at91_adc_state *st, bool state) +{ + u32 status = at91_adc_readl(st, AT91_SAMA5D2_TRGR); + + /* clear TRGMOD */ + status &= ~AT91_SAMA5D2_TRGR_TRGMOD_MASK; + + if (state) + status |= AT91_SAMA5D2_TRGR_TRGMOD_RTC; + + /* set/unset hw trigger */ + at91_adc_writel(st, AT91_SAMA5D2_TRGR, status); + + status = at91_adc_readl(st, AT91_SAMA5D2_MR); + + status &= ~AT91_SAMA5D2_MR_TRGSEL_MASK; + + /* set/unset TRGSEL to RTCOUT0 */ + if (state) + status |= AT91_SAMA5D2_MR_TRGSEL(AT91_SAMA5D2_MR_TRGSEL_TRIG7); + + at91_adc_writel(st, AT91_SAMA5D2_MR, status); + return 0; } @@ -866,7 +908,8 @@ static int at91_adc_dma_start(struct iio_dev *indio_dev) if (st->dma_st.dma_chan) \ use_irq = false; \ /* if the trigger is not ours, then it has its own IRQ */ \ - if (iio_trigger_validate_own_device(indio->trig, indio)) \ + if (iio_trigger_validate_own_device(indio->trig, indio) && \ + !st->rtc_triggered) \ use_irq = false; \ } @@ -884,6 +927,18 @@ static int at91_adc_buffer_postenable(struct iio_dev *indio) /* touchscreen enabling */ return at91_adc_configure_touch(st, true); } + + /* + * If our rtc trigger link is identical to the current trigger, + * then we are rtc-triggered. + * Configure accordingly. + */ + if (!IS_ERR_OR_NULL(st->rtc_trig_dev) && + st->rtc_trig_dev == indio->trig->dev.parent) { + at91_adc_rtc_configure_trigger(st, true); + st->rtc_triggered = true; + } + /* if we are not in triggered mode, we cannot enable the buffer. */ if (!(indio->currentmode & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; @@ -947,6 +1002,17 @@ static int at91_adc_buffer_predisable(struct iio_dev *indio) if (!(indio->currentmode & INDIO_ALL_TRIGGERED_MODES)) return -EINVAL; + /* + * If our rtc trigger link is identical to the current trigger, + * then we are rtc-triggered. + * Unconfigure accordingly. + */ + if (!IS_ERR_OR_NULL(st->rtc_trig_dev) && + st->rtc_trig_dev == indio->trig->dev.parent) { + at91_adc_rtc_configure_trigger(st, false); + st->rtc_triggered = false; + } + AT91_ADC_BUFFER_CHECK_USE_IRQ(use_irq); /* * For each enable channel we must disable it in hardware. @@ -1153,8 +1219,15 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) else ret = at91_adc_trigger_handler_nodma(indio_dev, pf); - if (!ret) + if (!ret) { iio_trigger_notify_done(indio_dev->trig); + /* + * RTC trigger does not know how to reenable our IRQ. + * So, we must do it. + */ + if (st->rtc_triggered) + enable_irq(st->irq); + } return IRQ_HANDLED; } @@ -1166,10 +1239,13 @@ irqreturn_t at91_adc_pollfunc(int irq, void *p) struct at91_adc_state *st = iio_priv(indio_dev); /* - * If it's not our trigger, start a conversion now, as we are - * actually polling the trigger now. + * We need to start a software trigger if we are not using a trigger + * that uses our own IRQ. + * External trigger and RTC trigger do not not need software start + * However the other triggers do. */ - if (iio_trigger_validate_own_device(indio_dev->trig, indio_dev)) + if (iio_trigger_validate_own_device(indio_dev->trig, indio_dev) && + !st->rtc_triggered) at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_START); return iio_pollfunc_store_time(irq, p); @@ -1307,6 +1383,12 @@ static void at91_adc_workq_handler(struct work_struct *workq) at91_adc_read_and_push_channels(indio_dev, st->timestamp); iio_trigger_notify_done(indio_dev->trig); + /* + * RTC trigger does not know how to reenable our IRQ. + * So, we must do it. + */ + if (st->rtc_triggered) + enable_irq(st->irq); } else { iio_push_to_buffers(indio_dev, st->buffer); } @@ -1712,6 +1794,7 @@ static int at91_adc_probe(struct platform_device *pdev) struct iio_dev *indio_dev; struct at91_adc_state *st; struct resource *res; + struct device_node *rtc_trig_np; int ret, i; u32 edge_type = IRQ_TYPE_NONE; @@ -1737,6 +1820,8 @@ static int at91_adc_probe(struct platform_device *pdev) st->oversampling_ratio = AT91_OSR_1SAMPLES; + st->rtc_trig_dev = ERR_PTR(-EINVAL); + ret = of_property_read_u32(pdev->dev.of_node, "atmel,min-sample-rate-hz", &st->soc_info.min_sample_rate); @@ -1784,6 +1869,20 @@ static int at91_adc_probe(struct platform_device *pdev) return -EINVAL; } + rtc_trig_np = of_parse_phandle(pdev->dev.of_node, "atmel,rtc-trigger", + 0); + if (rtc_trig_np) { + struct platform_device *rtc_trig_plat_dev; + + rtc_trig_plat_dev = of_find_device_by_node(rtc_trig_np); + if (rtc_trig_plat_dev) { + st->rtc_trig_dev = &rtc_trig_plat_dev->dev; + dev_info(&pdev->dev, + "RTC trigger link set-up with %s\n", + dev_name(st->rtc_trig_dev)); + } + } + init_waitqueue_head(&st->wq_data_available); mutex_init(&st->lock); INIT_WORK(&st->workq, at91_adc_workq_handler); From patchwork Wed Dec 18 16:24:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301315 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 66FA0138C for ; Wed, 18 Dec 2019 16:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AE4724650 for ; Wed, 18 Dec 2019 16:26:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="F3Dq4g4l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbfLRQ0B (ORCPT ); Wed, 18 Dec 2019 11:26:01 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:12945 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727563AbfLRQYK (ORCPT ); Wed, 18 Dec 2019 11:24:10 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: M7dHZ7vzpwx+AmVyyYJZAp5nH0LSNkR7LCqqju9Gfj5Q9ca8n/TAIyJpguxdUghERhb6HS7JOZ up9fyUYSDATd7csIAvcSWLtYBOfrKjk/GzRpHllTCa0Z1guJiwBtNq23SiTa/E9EDn4ssAfQwh ttg8wXmE8dz7T7dwwt3BVNXi6z+XVSrwv9HW5fIyU7RP1yoC3KsFJ/FbkjVQpPamqURWs3D6GM Mc1qjD335C2WLVaPXuund1t7oilta4WEhpZMP+UMN1eIaeXLeawO6QWbYpJ+1SZW3k1VCSoZHS joI= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="60223195" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:09 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:11 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J3Ip8FAIcdXDLaylShXTGGIpCcdbftp2ydBGE2WX94sHwZsmTh0raOuVYqqH14wFEDEo3j+wb3Jnw9J9lSig3Xp99YAGBEE+L4gdYMmc1o00YmLkXFkDX9YEVNHBMi6Zrsu8dcU72AyXpvHjx3m9UVooIbFakEjWY2ZtGRQHT+LEthyIHCc8DQlMa6B4iuAYhcRFssIFatDP02QEc7S+HGuQG79jv7v4IE3fh7PXFl1jcDl8qt4wE90V/OdNHm0eEegOU0O7lgu5zwh58TL6k+jG8wqX3tRoALPovQ1nH78FXiIAO8+NLzivXeJd8txZ2cjHQFDt5yiqerHoIxTVCw== 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=MbaJagXmIYCqxQfjE3h38mvB/9lRN1J5e1UgEO7VEfQ=; b=UipG6lZAQeq781ZpQg9WiB2pu1x8/6tVQT/4zK0zAUgi8WygUB7IEBg9fwjnW9X7XaQIsvQEKyTkl39/43r56qbm+8az575Z5X3hP4BTMl2WQaxBxiOnrFmV2n9QbftYezT44vLDtIljT1Dw8GmhS2ymXb7jJlIeBkJzLNNnGqpfOGgVlNVSgKsEhbjljMG5jO3uBENvjF2MuFJvJf/oNBUjozMcJdkx18dg60gsOALFE5Y/c4OuwvYGAxlPjGgObxK6X5Y6wqHhw5moIfxaW3mLoI8B5ZFeV+C5C4/3j68EuLDXUseMxT5k9BkO/lSHV/MIzNdRksw61FC/Mgjn2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MbaJagXmIYCqxQfjE3h38mvB/9lRN1J5e1UgEO7VEfQ=; b=F3Dq4g4loMO+E7TfbIUHAqubZOSPIQlX9znExFzwR7ZR0GvrALg6lvoY3AY9BldqYuhH9WcMUTpzJrr2oTc8D5/qEfaad+HiH0alTTXaigoq+TvB0gzXyeKgZ33xElLVHTiDJ7rEg9Q7QDb4qDBHX79s7KEj57Prp49JRMCrDxs= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1913.namprd11.prod.outlook.com (10.175.87.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Wed, 18 Dec 2019 16:24:05 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:05 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 09/10] ARM: dts: at91: sama5d2: add rtc_adc_trigger node Thread-Topic: [PATCH 09/10] ARM: dts: at91: sama5d2: add rtc_adc_trigger node Thread-Index: AQHVtb+PyD1+Bcfc7EmGzl4Waea2mg== Date: Wed, 18 Dec 2019 16:24:03 +0000 Message-ID: <1576686157-11939-10-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b54f1599-1f60-4706-5ee3-08d783d6b34d x-ms-traffictypediagnostic: DM5PR11MB1913: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(346002)(376002)(136003)(396003)(199004)(189003)(2616005)(66556008)(316002)(107886003)(8676002)(71200400001)(8936002)(66476007)(26005)(6506007)(2906002)(64756008)(66446008)(66946007)(81156014)(76116006)(81166006)(5660300002)(478600001)(36756003)(54906003)(186003)(4326008)(86362001)(6512007)(110136005)(91956017)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1913;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aXQoCz8ms76O+8qQfZ8cGE6AlQWMaA7QQGQH/IwnmotL4hcUIWXcBFe/wtJNTOPQA9eXysoE2ZMgjyixLB2U43ZZa6B5ATEbFC1Sg+eiac+9020AT1Pb8ji7SXYTHM4FH2xOWhr2Cu1SzP+XTOM7XCRqLVOo8oFt3B3mhL5+VZ6ZNIBwBgMLc4cxP2uzrAujDT0ERR+vuQ+xtPBFBvJNmM//auQy7W9P+xhdfEMiCifQS3/31BflvjMoWhYBUv7csMOmzgPTaN31xru1zonB4+7ysCVwAfSOHRwzhi5n/QSCi6KaMkEJ1XD8W+JO8qBEc0fgYJWK7RNOC1eATtLhtkHUrHmkq5HfEOUfq6qAD+v8Pr/RbYxQpwKlJXKqu1kIBBHZqHDcLbRiCkHqSLUIaGtFHUAweNWzheJ43CXNQTe3QYDGjrhdS/4/oshCCS39 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b54f1599-1f60-4706-5ee3-08d783d6b34d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:03.4254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /GO+1YVsRzx55QHoZyEFyE9DBKFLUlMEUlSzO/4MmJzv7fBdmkDy2qnO46EC3zp28aqvF5xd4yAiwulWvf8weDL+OGabpqQ7Ylx9/Wit0xI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1913 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev Add node for the AT91 RTC ADC Trigger. This is a child node of the RTC and uses the same register map. Add a link in the ADC node to this new node. This represents the internal hardware line that is connected from the ADC to the RTC device. Signed-off-by: Eugen Hristev --- arch/arm/boot/dts/sama5d2.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 5652048..c2df369 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -694,6 +694,16 @@ reg = <0xf80480b0 0x30>; interrupts = <74 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&clk32k>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0xf80480b0 0x10>; + + rtc_adc_trigger: rtc-adc-trigger { + reg = <0x0 0x10>; + compatible = "microchip,rtc-adc-trigger"; + status = "disabled"; + }; + }; i2s0: i2s@f8050000 { @@ -856,6 +866,7 @@ atmel,max-sample-rate-hz = <20000000>; atmel,startup-time-ms = <4>; atmel,trigger-edge-type = ; + atmel,rtc-trigger = <&rtc_adc_trigger>; #io-channel-cells = <1>; status = "disabled"; }; From patchwork Wed Dec 18 16:24:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 11301313 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 5751C138C for ; Wed, 18 Dec 2019 16:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B331227BF for ; Wed, 18 Dec 2019 16:26:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="uzc0bar1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727393AbfLRQYW (ORCPT ); Wed, 18 Dec 2019 11:24:22 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:27760 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbfLRQYM (ORCPT ); Wed, 18 Dec 2019 11:24:12 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: bf1H/xFMqKgXahp31c/tqJTXlbFQMSYHPhVaCTR8lMFEVk6ZzRD/DmfN0ALSD08X96EUJ94J3D 6coHAHi46/HczHjSark5kIa60a+lySkeoNcP0JaZDJQFXYnVNOx29Ev4THBrQGdZjapDjTdIS9 3Ey64sXJDJDHNUwFtPZ17rduDRM/FJXNiWX8j6F2w3OTuv03S+a77kBLOFgEN9gfB0INqTSKcv XuOp/leJJlHgnvWW3tNJ6l0BgDAFHr5SjeEGKK0sMmeR4sDPV81CHVyo17p5gugO/62Vvogy+M IO4= X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="58200070" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 18 Dec 2019 09:24:11 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 09:24:08 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 09:24:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjqbQJ5bhPrCZgsKks3OTmO2HmMqJLnJ7XHMcORDAb971Nfn1bbF/jI0qtODIDSUfThKotWuHAHyJrNDLfmGSTLimgUDMqTUWpavEoyneVBvRVUkffPf+moeBrGY4CwVs1KP0gu+XWj5rmV8oJCbOdZ7FHcu2g1cw3sMQ5K8eDcRCXzDAIz3Xr0QZLr4Ua00yPTT8U8W6ZFXfE6yDxQBgyAPyNgMtdPDLEfhJD81xV7s3uDIaBfT2U4pmTykRfLSGMCqklW1JrOUT7mBIPyU+4GItSFG8K4AwiqdhgwCVklW1Kl6wlB1Nn5bDkmYmhe3UzlR8CD7ihCqhmHBxY1T8Q== 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=tP5UvQD1MTEBjelpPd3B3IN7q5WR77UDFIA46K2YJt4=; b=W5+QYH4iwdK1I5EnevLpMSBh0oq3h+hlnKXwfF5S+93SnVUeZON/OjW19sXXjPyFc3xq5+GzK0ipKtEhKdHo65CBKk5Jxpl7Wq1dwtAo7xaf++kjBoYdXAYIplx76dffuBxXPV+kzCXcR8NuH0FF//UAUngo9Wpu2LLwec/bXia1OnUICPrV9XTjbT0qPPRFtiTEhIDgGTFE45Fsx9xcUYIGutgFxV05hOMFlwnsqRmqc1o4lKq8zMLYD4DJKJ5awOWDOnEaoYREutD1TrDTwTAM2lbJ+qlhZpkyItvjiRwv9nChQ21bdazhUz/Qr2hpcimD/PDD73BsfUO+aqA+FA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tP5UvQD1MTEBjelpPd3B3IN7q5WR77UDFIA46K2YJt4=; b=uzc0bar1kIiZZ4sfbl85qzHvShLhNWvFGvnJ5BuZQ+kGkm0oqu/V7hfqi6yrlfzsoH/fDqZQrChi35sdTTkIpE75UrW7y/xIjnAvCLiQ2KuK9j8aM6swj8vkEuitHyu6VQxpeUGcpGGcdZxgarpvkHmgkdo/PxC7t41FTyYPdbM= Received: from DM5PR11MB1242.namprd11.prod.outlook.com (10.168.108.8) by DM5PR11MB1913.namprd11.prod.outlook.com (10.175.87.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Wed, 18 Dec 2019 16:24:05 +0000 Received: from DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1]) by DM5PR11MB1242.namprd11.prod.outlook.com ([fe80::9039:e0e8:9032:20c1%12]) with mapi id 15.20.2559.012; Wed, 18 Dec 2019 16:24:05 +0000 From: To: , , CC: , , , , , , , , Subject: [PATCH 10/10] ARM: dts: at91: sama5d2_xplained: enable rtc_adc_trigger Thread-Topic: [PATCH 10/10] ARM: dts: at91: sama5d2_xplained: enable rtc_adc_trigger Thread-Index: AQHVtb+QPhJ2pL0iFUaSi+H+uVoRXA== Date: Wed, 18 Dec 2019 16:24:03 +0000 Message-ID: <1576686157-11939-11-git-send-email-eugen.hristev@microchip.com> References: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> In-Reply-To: <1576686157-11939-1-git-send-email-eugen.hristev@microchip.com> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d24aa346-f9db-44dd-63eb-08d783d6b3a3 x-ms-traffictypediagnostic: DM5PR11MB1913: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:626; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(346002)(376002)(136003)(396003)(199004)(189003)(4744005)(2616005)(66556008)(316002)(107886003)(8676002)(71200400001)(8936002)(66476007)(26005)(6506007)(2906002)(64756008)(66446008)(66946007)(81156014)(76116006)(81166006)(5660300002)(478600001)(36756003)(54906003)(186003)(4326008)(86362001)(6512007)(110136005)(91956017)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1913;H:DM5PR11MB1242.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eVp+s0zvuU3EAgjepAKGnY5P/yQvUVPIRH3MGIwKVEo0kP9qbLQRsgEaMuBV3FmqIJ+k25QPLKSqXFvRqe/GE7WSidN4Kq2X7CWSpQqwrx+8/n5MM59u5Rp3Djb0RiF+TbhaqTOXtY80qvveSFx3ErgqDyxL2zhC8eFCQtQ68adVvfQafW49AFHCQ3r0T0o4gsWhfQlqRNuCH8nJCTONYIx0vp7tvP2jdHpODHlTKkTVs0p/SvXbQk2ni7X1LSUeeHQXV3iMgGnGwI6RgyQBT+BB+tfo4wxqH3qpmc9fbQtLciNzTfwB6/RQdVXivsEFsAkc2aA5KCUfZKd6uQkUo2Jl1yZ5eRmbtOlGqFXjC3CO/RxlhbRulc5jx14keDpeqpcWhqXd4tTCkvbgIhCFtqJtPGkvVBKRMGblqbAs7BEQhDdiraZDPZi1gwlIlHgY MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d24aa346-f9db-44dd-63eb-08d783d6b3a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 16:24:03.8902 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Hot+cqMGsu1fuiD/NY2uOYGx8Rf1m9uh9Sx5vHJFeC/mLsYvg2+HiEy2wAKpeWtU/+tyoBkj06FKxXvp95pJISFCnRFlH7HDws8gFY2318k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1913 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Eugen Hristev Enable the rtc_adc_trigger node. Signed-off-by: Eugen Hristev --- arch/arm/boot/dts/at91-sama5d2_xplained.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts index 9d0a7fb..606ca70 100644 --- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts +++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts @@ -645,3 +645,7 @@ }; }; }; + +&rtc_adc_trigger { + status = "okay"; +};