/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This is the Beep driver for SMBUS based beep mechanism.
* The driver exports the interfaces to set frequency,
* turn on beeper and turn off beeper to the generic beep
* module. If a beep is in progress, the driver discards a
* second beep. This driver uses the 8254 timer to program
* the beeper ports.
*/
#include <sys/ddi_impldefs.h>
/* Pointer to the state structure */
static void *grbeep_statep;
/*
* Debug stuff
*/
#ifdef DEBUG
int grbeep_debug = 0;
#else
#endif
/*
* Prototypes
*/
void **result);
static void grbeep_off(void *arg);
static void grbeep_cleanup(grbeep_state_t *);
nulldev, /* open */
nulldev, /* close */
nulldev, /* strategy */
nulldev, /* print */
nulldev, /* dump */
nulldev, /* read */
nulldev, /* write */
nulldev, /* ioctl */
nulldev, /* devmap */
nulldev, /* mmap */
nulldev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
NULL, /* streamtab */
};
DEVO_REV, /* Devo_rev */
0, /* Refcnt */
grbeep_info, /* Info */
nulldev, /* Identify */
nulldev, /* Probe */
grbeep_attach, /* Attach */
grbeep_detach, /* Detach */
nodev, /* Reset */
&grbeep_cb_ops, /* Driver operations */
0, /* Bus operations */
NULL, /* Power */
ddi_quiesce_not_supported, /* devo_quiesce */
};
&mod_driverops, /* This one is a driver */
"SMBUS Beep Driver", /* Name of the module. */
&grbeep_ops, /* Driver ops */
};
};
int
_init(void)
{
int error;
/* Initialize the soft state structures */
sizeof (grbeep_state_t), 1)) != 0) {
return (error);
}
/* Install the loadable module */
}
return (error);
}
int
{
}
int
_fini(void)
{
int error;
if (error == 0) {
/* Release per module resources */
}
return (error);
}
/*
* Beep entry points
*/
/*
* grbeep_attach:
*/
static int
{
int instance;
/* Pointer to soft state */
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
/* Get the instance and create soft state */
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
/* Save the dip */
/* Initialize beeper mode */
/* Map the Beep Control and Beep counter Registers */
"grbeep_attach: Mapping of beep registers failed."));
return (DDI_FAILURE);
}
/* Display information in the banner */
(void *)dip));
return (DDI_SUCCESS);
}
/*
* grbeep_detach:
*/
static int
{
/* Pointer to soft state */
switch (cmd) {
case DDI_SUSPEND:
return (DDI_FAILURE);
}
/*
* If a beep is in progress; fail suspend
*/
return (DDI_SUCCESS);
} else {
return (DDI_FAILURE);
}
default:
return (DDI_FAILURE);
}
}
/*
* grbeep_info:
*/
/* ARGSUSED */
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
return (DDI_FAILURE);
}
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
error = DDI_SUCCESS;
break;
default:
error = DDI_FAILURE;
}
return (error);
}
/*
* grbeep_freq() :
* Set beep frequency
*/
static void
{
int divisor = 0;
if (divisor > GRBEEP_DIVISOR_MAX) {
} else if (divisor < GRBEEP_DIVISOR_MIN) {
}
}
/*
* grbeep_on() :
* Turn the beeper on
*/
static void
{
}
}
/*
* grbeep_off() :
* Turn the beeper off
*/
static void
{
}
}
/*
* grbeep_map_regs() :
*
* The write beep port register and spkr control register
* should be mapped into a non-cacheable portion of the system
* addressable space.
*/
static int
{
/* The host controller will be little endian */
/* Map in operational registers */
0,
sizeof (grbeep_freq_regs_t),
&attr,
!= DDI_SUCCESS) {
return (DDI_FAILURE);
}
/* Map in operational registers */
0,
1,
&attr,
!= DDI_SUCCESS) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* grbeep_obtain_state:
*/
static grbeep_state_t *
{
return (state);
}
/*
* grbeep_cleanup :
* Cleanup soft state
*/
static void
{
}