Thread (25 messages) 25 messages, 6 authors, 2018-04-09

Re: [PATCH v3 2/4] mfd: add Gateworks System Controller core driver

From: Tim Harvey <tharvey@gateworks.com>
Date: 2018-04-03 15:48:31
Also in: linux-arm-kernel, linux-devicetree, linux-hwmon, linux-watchdog, lkml

On Wed, Mar 28, 2018 at 8:14 AM, Tim Harvey [off-list ref] 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
<snip>
+
+/*
+ * 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.

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?

Regards,

Tim
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help