#ifndef _IOI2CMaxim1631_H
#define _IOI2CMaxim1631_H
#include <IOKit/IOLib.h>
#include <IOKit/IOService.h>
#include <IOKit/IODeviceTreeSupport.h>
#include <IOKit/IOPlatformExpert.h>
#include <IOKit/pwr_mgt/RootDomain.h>
#include "IOPlatformFunction.h"
#include <IOI2C/IOI2CDevice.h>
#ifdef DLOG
#undef DLOG
#endif
#ifdef MAX1631_DEBUG
#define DLOG(fmt, args...) kprintf(fmt, ## args)
#else
#define DLOG(fmt, args...)
#endif
#define kNumRetries 10
#define kDTSensorParamsVersionKey "hwsensor-params-version"
#define kDTSensorIDKey "hwsensor-id"
#define kDTSensorZoneKey "hwsensor-zone"
#define kDTSensorTypeKey "hwsensor-type"
#define kDTSensorLocationKey "hwsensor-location"
#define kDTSensorPollingPeriodKey "hwsensor-polling-period"
#define kHWSensorNubName "temp-sensor"
#define kHWSensorParamsVersionKey "version"
#define kHWSensorIDKey "sensor-id"
#define kHWSensorZoneKey "zone"
#define kHWSensorTypeKey "type"
#define kHWSensorLocationKey "location"
#define kHWSensorPollingPeriodKey "polling-period"
enum {
kHWSensorPollingPeriodNULL = 0xFFFFFFFF
};
class IOI2CMaxim1631 : public IOI2CDevice
{
OSDeclareDefaultStructors(IOI2CMaxim1631)
private:
enum {
kReadCurrentTemp = 0xAA,
kReadLocalHighLimit = 0xA1,
kReadLocalLowLimit = 0xA2,
kAccessConfigurationByte = 0xAC,
kStartConvertT = 0x51,
kStopConvertT = 0x52,
kSoftwareReset = 0x54
};
const OSSymbol * fGetSensorValueSym;
IOReturn publishChildren(IOService *);
IOReturn getTemp( UInt32 Reg, SInt32 * temp );
public:
virtual bool start( IOService * nub );
virtual void stop( IOService * nub );
virtual bool init( OSDictionary * dict );
virtual void free( void );
using IOService::callPlatformFunction;
virtual IOReturn callPlatformFunction(const OSSymbol *functionName,
bool waitForFunction,
void *param1, void *param2,
void *param3, void *param4);
};
#endif // _IOI2CMaxim1631_H