From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-bn8nam12on2092.outbound.protection.outlook.com ([40.107.237.92] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLxNG-0007gP-6c for barebox@lists.infradead.org; Fri, 25 Sep 2020 23:43:35 +0000 From: Trent Piepho Date: Fri, 25 Sep 2020 16:43:13 -0700 Message-Id: <20200925234315.453448-2-trent.piepho@synapse.com> In-Reply-To: <20200925234315.453448-1-trent.piepho@synapse.com> References: <20200925234315.453448-1-trent.piepho@synapse.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v2 2/4] aiodev: am335x_adc: Driver for ADC on TI AM335x SoCs To: barebox@lists.infradead.org Cc: Trent Piepho VGhpcyBpcyBhIHNpbXBsZSBkcml2ZXIgZm9yIHRoZSBBREMuICBJdCdzIGRlc2lnbmVkIHRvIGdl dCBzaW5nbGUKcmVhZGluZ3MuICBQb3NzaWJsZSB1c2VzIHdvdWxkIGJlIHRlbXBlcmF0dXJlIHNl bnNpbmcgYSB0aGVybWlzdG9yLAptZWFzdXJpbmcgYSBwb3dlciByYWlsLCBvciBhIGRldGVjdGlu ZyBtdWx0aS1sZXZlbCBib2FyZCBJRCBwaW4Kc3RyYXBwaW5nLgoKSXQncyBub3QgZGVzaWduZWQg dG8gY28tZXhpc3Qgd2l0aCBhIHRvdWNoIHNjcmVlbiBjb250cm9sbGVyIGRyaXZlciwKd2hpY2gg dXNlcyB0aGUgc2FtZSBoYXJkd2FyZSBvbiB0aGUgQU0zMzV4LCBhcyB0aGVyZSBpcyBubyBiYXJl Ym94CnRvdWNoc2NyZWVuIGRyaXZlci4KClRoZSBkZXZpY2UgdHJlZSBiaW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