Cyril Plisko wrote:
> On Fri, Feb 27, 2009 at 8:31 PM, Kerry Shu <Kerry.Shu at sun.com> wrote:
>> Hi Cyril,
>>
>> yes, acpi_toshiba is closed-source per Toshiba's request since we
>> referred to their confidential docs.
>>
>> You can refer to acpi_video.c(acpi_drv) which supports video switch
>> and brightness control hotkey method of ACPI video extensions.
>>
>> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/i86pc/io/acpi_drv/acpi_video.c
> 
> Kerry,
> 
> thanks for your reply.
> Yes, I looked at the source, but it is not really clear to me what is
> the API between the acpi_drv and the extension module. (Yeah, I

I think I'd post an article to OpenSolaris to describe it in details
Stay tuned.

Here I just give you a quick guide. Hope it's helpful to you.
1. acpi_drv is responsible to load/unload the vendor specific hotkey
    module. so you need to add your new module name in:
      vendor_hotkey_drv_list[] array in acpi_video.c.
    And a DDI_SUCCESS return form your _init() means you've found your
    specific ACPI method and you module will handle the hotkey ACPI
    events instead of acpi_drv.
    You can provide module clean up code in your _fini().

2. struct hotkey_drv (hotkey_drv.h)defines the interface between
    acpi_drv and the specific module.
       struct hotkey_drv acpi_hotkey; /* acpi_drv.c */

   72 /*
   73  * hotkey driver soft-state structure
   74  */
   75 typedef struct hotkey_drv {
   76         struct acpi_drv_dev     dev;
   77         dev_info_t              *dip;
==> acpi_drv initializes them.

   78         void                    *private;       /* Vendor specific 
structure */
==> used by specific module only if it needs it.

   79         kmutex_t                *hotkey_lock;
==> initialized by acpi_drv. specific module can use it in its
     xxx_ioctl() and ACPI event handler.

   80         int                     hotkey_method;
==> specific module need to OR it with HOTKEY_METHOD_VENDOR.

   81         int                     modid;
   82         int                     (*vendor_ioctl)(struct hotkey_drv *,
   83                                     int cmd, intptr_t arg, int mode,
   84                                     cred_t *cr, int *rval);
==> need to provide this xxx_ioctl(). Currently we have brightness
     hotkey ioctl handling. You can refer to acpi_video_ioctl() for
     reference.

   85         int                     (*vendor_fini)(struct hotkey_drv *);
==> this is optional. Only for modules that would like to provide one
     more fini function to acpi_drv() before their _fini() being called.

   86         boolean_t               check_acpi_video;
==> From my previous investigation, I found some vendors' hotkey mothed
     also depends on ACPI video extension method. In such case, acpi_drv
     will go ahead to initialize the acpi video support in acpi_video.c
     if it's B_TRUE.

   87         void                    *acpi_video;
==> ACPI video support pointer.
   88 } hotkey_drv_t;

3. acpi_drv extern functions that you can use in your module :
   (see hotkey_drv.h)
    114 int acpi_drv_set_int(ACPI_HANDLE dev, char *method, uint32_t aint);
  115 void acpi_drv_gen_sysevent(struct acpi_drv_dev *devp, char *ev, 
uint32_t val);
  116 int acpi_drv_dev_init(struct acpi_drv_dev *p);
  117
  118 int hotkey_init(hotkey_drv_t *htkp);
  119 int hotkey_fini(hotkey_drv_t *htkp);
  120 int acpi_drv_hotkey_ioctl(int cmd, intptr_t arg, int mode, cred_t *cr,
  121     int *rval);
  122 int acpi_video_ioctl(void *vidp, int cmd, intptr_t arg, int mode, 
cred_t *cr,
  123     int *rval);
  124 int hotkey_brightness_inc(hotkey_drv_t *htkp);
  125 int hotkey_brightness_dec(hotkey_drv_t *htkp);
  126 void hotkey_drv_gen_sysevent(dev_info_t *, char *);

Regards,
Kerry

> realize it is nobody's fault, but mine). PSARC case materials do not
> elaborate on it as well. I guess I'll keep looking at the code...
> 
>> Regards,
>> Kerry
>>
>> Cyril Plisko wrote:
>>> Hello !
>>>
>>> Laptop Hotkey Support project [1] has been integrated into ON recently.
>>> It seems that the only driver this project delivers (acpi_toshiba) is
>>> closed-source and cannot be used as an example.
>>> If I want to add support for another brand/model, where would I start ?
>>>
>>> [1] http://opensolaris.org/os/community/arc/caselog/2009/016
>>>
> 
> 
> 

Reply via email to