Received: by 10.213.65.68 with SMTP id h4csp3734510imn; Tue, 3 Apr 2018 09:49:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vSyjZfgIyGfAlOD+xa1u/D2v1yVWp1rT2JAHpPsyO5Jav2pfcPn1D5NVwCSGbglfkSWM1 X-Received: by 10.101.98.193 with SMTP id m1mr9900714pgv.248.1522774145198; Tue, 03 Apr 2018 09:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522774145; cv=none; d=google.com; s=arc-20160816; b=xPCSdmpJ/78XslLMFSpvY9M0zv4lIZPRWJZogZCTONHRHwmg6CNVEaAl8s3cL0CVri lGr8doNpOBdnlraYNlE8NyGTnRM715HhvufYnA2DJwT4rCXscMZs+Hih6N4nmMTqJxKv JesotKn2yqqFuERDTaASL/gJ5eoJjAFUdyOl4oFdw+yOOFcsXmxIuOrP+0rZ8gR2oOt0 qYMOx1h09I5BzxiW7HrTM0I6HHEualRqe2562TkU99y3ZJpAFQWGrIxkPSfngHHocanp 5quLzFyIDi2dpgpaWo2y8dg1KNNhOo3gs+I45EiSJiNd3tNKhxqHvn9xR6ocIv6BbVx1 Zo0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=8qCL6tCcDDBhYwnmch6h1vxP8/KdLlLO5+2YseeqabE=; b=omAzHXo4bUqwfDQY+4e+UPXWrFQrlR1aQjP6WZAmKTFnx6qnLtXA/QsuVgczIjrEif OokDOwFGiatz27SvW916n8gVP1AW7Gwawca0L+eUUXV9ZUieAtAZLIOIfuKs4nC0W5FO ZM9TlteQW1jMyK1UWpYzgeJ2jYp/0rRRtie4JF7blNa+KNCvZdwTWIxbI/7ilaDjztPe mVe1qnqUT0NnGqEGhwIQ7YL041PlPiVYaPIeEBl3cFd3yUgBHnhx92ibxgd5ki3Cuh9N FuLJzRX2JbwY7oxqejzecPmwndkFjz3p4q2KalQL3geD+gy4IS/wv0xGAcB4Ke+GNxVU TfhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=xiK30+B7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si2416876pfe.248.2018.04.03.09.48.50; Tue, 03 Apr 2018 09:49:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=xiK30+B7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751904AbeDCQrn (ORCPT + 99 others); Tue, 3 Apr 2018 12:47:43 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:50263 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbeDCQrl (ORCPT ); Tue, 3 Apr 2018 12:47:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=8qCL6tCcDDBhYwnmch6h1vxP8/KdLlLO5+2YseeqabE=; b=xiK30+B7qcsHD3hZZKYZwuaBOkNhLT3AgLK/fMg2aISCfC6w4014RJ+CRzUZUqPzWuU08XFEJd76elrqO8VfZN6XDl2hW7+SSpDM1I47fDqoT0HPlFvyimLcBwKR8dw/bi+k1scoYS9YB+a6cgjR7qJsZYBoFnFSAF+Sp9+QSzs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1f3P5X-0001Z6-M7; Tue, 03 Apr 2018 18:47:15 +0200 Date: Tue, 3 Apr 2018 18:47:15 +0200 From: Andrew Lunn To: Tim Harvey Cc: Lee Jones , Rob Herring , Mark Rutland , Mark Brown , Dmitry Torokhov , Wim Van Sebroeck , Guenter Roeck , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, Randy Dunlap , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 2/4] mfd: add Gateworks System Controller core driver Message-ID: <20180403164715.GA5676@lunn.ch> References: <1522250043-8065-1-git-send-email-tharvey@gateworks.com> <1522250043-8065-3-git-send-email-tharvey@gateworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 03, 2018 at 08:48:27AM -0700, Tim Harvey wrote: > On Wed, Mar 28, 2018 at 8:14 AM, Tim Harvey wrote: > > The Gateworks System Controller (GSC) is an I2C slave controller > > implemented with an MSP430 micro-controller whose firmware embeds the > > following features: > > - I/O expander (16 GPIO's) using PCA955x protocol > > - Real Time Clock using DS1672 protocol > > - User EEPROM using AT24 protocol > > - HWMON using custom protocol > > - Interrupt controller with tamper detect, user pushbotton > > - Watchdog controller capable of full board power-cycle > > - Power Control capable of full board power-cycle > > > > see http://trac.gateworks.com/wiki/gsc for more details > > > > > + > > +/* > > + * gsc_powerdown - API to use GSC to power down board for a specific time > > + * > > + * secs - number of seconds to remain powered off > > + */ > > +static int gsc_powerdown(struct gsc_dev *gsc, unsigned long secs) > > +{ > > + int ret; > > + unsigned char regs[4]; > > + > > + dev_info(&gsc->i2c->dev, "GSC powerdown for %ld seconds\n", > > + secs); > > + regs[0] = secs & 0xff; > > + regs[1] = (secs >> 8) & 0xff; > > + regs[2] = (secs >> 16) & 0xff; > > + regs[3] = (secs >> 24) & 0xff; > > + ret = regmap_bulk_write(gsc->regmap, GSC_TIME_ADD, regs, 4); > > + > > + return ret; > > +} > > Any feedback on the 'powerdown' sysfs attribute that hooks to this > function? This allows the GSC to disable the board primary power > supply for 2^32 seconds and is often used to 'reset' the board > although it could also be used to put the board in a power down state > longer. I'm wondering if there is a more appropriate API for this in > the kernel that I don't know about. Hi Tim RTC can cause wakeup when an alarm is set. It looks like the DS1672 does not have this. But you are emulating the DS1672 right? You could add a second emulated RTC which does support an alarm? DS3232? > I would also like to register a restart handler using this but I > believe that ARM restart handlers currently can not use I2C - is that > correct? There are plenty which use GPIOs, or UARTs. Not seen any which use i2c. What do you think does not work at this point? Andrew