98N/A/*
98N/A * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
98N/A *
98N/A * Permission is hereby granted, free of charge, to any person obtaining a
1379N/A * copy of this software and associated documentation files (the "Software"),
98N/A * to deal in the Software without restriction, including without limitation
98N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A * and/or sell copies of the Software, and to permit persons to whom the
919N/A * Software is furnished to do so, subject to the following conditions:
919N/A *
919N/A * The above copyright notice and this permission notice (including the next
919N/A * paragraph) shall be included in all copies or substantial portions of the
919N/A * Software.
919N/A *
919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A * DEALINGS IN THE SOFTWARE.
919N/A */
919N/A
919N/A/*
98N/A * Copyright (c) 2012 Intel Corporation. All rights reserved.
98N/A */
98N/A
98N/A#ifndef __DRM_I2C_H__
98N/A#define __DRM_I2C_H__
98N/A
1339N/A#include <sys/ksynch.h>
1339N/A#include <sys/types.h>
1339N/A#include <sys/errno.h>
1265N/A#include <sys/cmn_err.h>
493N/A#include "drm.h"
98N/A
911N/Astruct i2c_adapter;
1379N/Astruct i2c_msg;
1379N/A
1379N/Astruct i2c_algorithm {
911N/A int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
98N/A u32 (*functionality) (struct i2c_adapter *);
235N/A};
493N/A
98N/Aextern struct i2c_algorithm i2c_bit_algo;
916N/A
916N/Astruct i2c_adapter {
1422N/A struct i2c_algorithm *algo;
1422N/A kmutex_t bus_lock;
916N/A clock_t timeout;
970N/A int retries;
970N/A char name[64];
970N/A void *data;
970N/A void (*setsda) (void *data, int state);
970N/A void (*setscl) (void *data, int state);
970N/A int (*getsda) (void *data);
970N/A int (*getscl) (void *data);
970N/A void *algo_data;
970N/A clock_t udelay;
970N/A};
970N/A
970N/A#define I2C_M_RD 0x01
970N/A#define I2C_M_NOSTART 0x02
970N/A
970N/Astruct i2c_msg {
970N/A u16 addr;
970N/A u16 flags;
970N/A u16 len;
970N/A u8 *buf;
970N/A};
970N/A
970N/Aextern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
970N/Aextern int i2c_bit_add_bus(struct i2c_adapter *adap);
970N/A
970N/A#endif /* __DRM_I2C_H__ */
1029N/A