#ifndef _IOI2CMaxim6690_H
#define _IOI2CMaxim6690_H
#include <IOKit/IOLib.h>
#include <IOKit/IOService.h>
#include <IOKit/IODeviceTreeSupport.h>
#include <IOKit/IOPlatformExpert.h>
#include <IOKit/pwr_mgt/RootDomain.h>
#include <IOI2C/IOI2CDevice.h>
#include "IOPlatformFunction.h"
#ifdef DLOG
#undef DLOG
#endif
#define MAX6690_DEBUG 1
#ifdef MAX6690_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 IOI2CMaxim6690 : public IOI2CDevice
{
OSDeclareDefaultStructors(IOI2CMaxim6690)
private:
enum {
kReadInternalTemp = 0x00,
kReadExternalTemp = 0x01,
kReadStatusByte = 0x02,
kReadConfigurationByte = 0x03,
kReadConversionRateByte = 0x04,
kReadInternalHighLimit = 0x05,
kReadInternalLowLimit = 0x06,
kReadExternalHighLimit = 0x07,
kReadExternalLowLimit = 0x08,
kWriteConfigurationByte = 0x09,
kWriteConversionRateByte = 0x0A,
kWriteInternalHighLimit = 0x0B,
kWriteInternalLowLimit = 0x0C,
kWriteExternalHighLimit = 0x0D,
kWriteExternalLowLimit = 0x0E,
kOneShot = 0x0F,
kReadExternalExtTemp = 0x10,
kReadInternalExtTemp = 0x11,
kReadDeviceID = 0xFE,
kReadDeviceRevision = 0xFF
};
UInt32 fHWSensorIDMap[2];
OSArray * parseSensorParamsAndCreateNubs(IOService *nub);
const OSSymbol * fGetSensorValueSym;
IOReturn getInternalTemp( SInt32 * temp );
IOReturn getExternalTemp( 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 // _IOI2CMaxim6690_H