KIYOHARA Takashi | 23 Sep 2007 18:42
Picon

once more psh3pwr(4)

Hi! uwe

I will commit the psh3pwr.  Moreover, it supports sysmon_envsys(9).

Thanks,
--
kiyohara

/*	$NetBSD$	*/
/*
 * Copyright (c) 2005, 2007 KIYOHARA Takashi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
(Continue reading)

Valeriy E. Ushakov | 23 Sep 2007 20:08
Picon

Re: once more psh3pwr(4)

On Mon, Sep 24, 2007 at 01:42:53 +0900, KIYOHARA Takashi wrote:

> I will commit the psh3pwr.  Moreover, it supports sysmon_envsys(9).

Thanks.  Some comments below.

> #include <machine/config_hook.h>

I don't see any config_hook calls.

> 	/* regsiter sleep function to APM */
> 	__sleep_func = psh3pwr_sleep;
> 	__sleep_ctx = self;

Also arrange necessary config_hooks to get hpcapm connected to this
driver?

> 		printf("%s: plug status: out\n",
> 		    sc->sc_dev.dv_xname);

device_xname(&sc->sc_dev) is preferred way to do it (I know, j6x0pwr.c
hasn't been converted yet :)

> 	sc->sc_data.sensor = 0;
> 	sc->sc_data.units = ENVSYS_INDICATOR;
> 	sc->sc_data.state = ENVSYS_SVALID;
> 	sc->sc_data.value_cur = sc->sc_plug;
> 	snprintf(sc->sc_data.desc, sizeof(sc->sc_data.desc),
> 	    "%s %s", sc->sc_dev.dv_xname, "plug");

(Continue reading)

KIYOHARA Takashi | 24 Sep 2007 17:32
Picon

Re: once more psh3pwr(4)

Hi! uwe,

From: "Valeriy E. Ushakov" <uwe <at> stderr.spb.ru>
Date: Sun, 23 Sep 2007 22:08:56 +0400

> On Mon, Sep 24, 2007 at 01:42:53 +0900, KIYOHARA Takashi wrote:

> > 	/* regsiter sleep function to APM */
> > 	__sleep_func = psh3pwr_sleep;
> > 	__sleep_ctx = self;
> 
> Also arrange necessary config_hooks to get hpcapm connected to this
> driver?

hmm.. I can't know your meaning.  X-<

> > 	sc->sc_data.sensor = 0;
> > 	sc->sc_data.units = ENVSYS_INDICATOR;
> > 	sc->sc_data.state = ENVSYS_SVALID;
> > 	sc->sc_data.value_cur = sc->sc_plug;
> > 	snprintf(sc->sc_data.desc, sizeof(sc->sc_data.desc),
> > 	    "%s %s", sc->sc_dev.dv_xname, "plug");
> 
> I wonder if it makes sense to convert hpcapm to use sysmon instead of
> doing that in each driver (just thinking out loud here).

In a word, should we treat sysmon_envsys with hpcapm layer?

> > 	/* splhigh on entry */
> > 	extern void pfckbd_poll_hitachi_power(void);
(Continue reading)

Valeriy E. Ushakov | 24 Sep 2007 17:59
Picon

Re: once more psh3pwr(4)

On Tue, Sep 25, 2007 at 00:32:21 +0900, KIYOHARA Takashi wrote:

> From: "Valeriy E. Ushakov" <uwe <at> stderr.spb.ru>
> Date: Sun, 23 Sep 2007 22:08:56 +0400
> 
> > On Mon, Sep 24, 2007 at 01:42:53 +0900, KIYOHARA Takashi wrote:
> 
> > > 	/* regsiter sleep function to APM */
> > > 	__sleep_func = psh3pwr_sleep;
> > > 	__sleep_ctx = self;
> > 
> > Also arrange necessary config_hooks to get hpcapm connected to this
> > driver?
> 
> hmm.. I can't know your meaning.  X-<

This is to make apm(8) work.  apm(8) queries apm device and that ends
un in hpcapm(4).  hpcapm uses config hooks to ask real "power" device
about things like A/C adapter plugged/unplugged, battery state, etc.
Check how it's done in j6x0pwr(4).

E.g. on my jornada with the battery not inserted (the deice is always
on external power):

    # apm
    Battery charge state: absent
    Battery remaining: 0 percent (0 minutes)
    A/C adapter state: connected
    Power management enabled

(Continue reading)


Gmane