From 2489007e7d740ccbc3e0a202914e243ad5178787 Mon Sep 17 00:00:00 2001 From: codeworkx Date: Sat, 22 Sep 2012 09:48:20 +0200 Subject: merge opensource jb u5 Change-Id: I1aaec157aa196f3448eff8636134fce89a814cf2 --- include/linux/wimax/samsung/max8893.h | 72 ++++++++++++++++++++++++++ include/linux/wimax/samsung/wimax732.h | 94 ++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 include/linux/wimax/samsung/max8893.h create mode 100644 include/linux/wimax/samsung/wimax732.h (limited to 'include/linux/wimax') diff --git a/include/linux/wimax/samsung/max8893.h b/include/linux/wimax/samsung/max8893.h new file mode 100644 index 0000000..9c7a4ec --- /dev/null +++ b/include/linux/wimax/samsung/max8893.h @@ -0,0 +1,72 @@ +/* +* +* MAX8893 PMIC driver for WiMAX with CMC732. +* This is not a regulator driver. +*/ + +#ifndef MAX8893_H +#define MAX8993_H __FILE__ +/* +* +* +* Default/Reset values of MAX8893C registers +* +* +* +*/ +/* +#define DEF_VAL_MAX8893_REG_ONOFF 0x01 +#define DEF_VAL_MAX8893_REG_DISCHARGE 0xff +#define DEF_VAL_MAX8893_REG_LSTIME 0x08 +#define DEF_VAL_MAX8893_REG_DVSRAMP 0x09 +#define DEF_VAL_MAX8893_REG_BUCK 0x02 +#define DEF_VAL_MAX8893_REG_LDO1 0x02 +#define DEF_VAL_MAX8893_REG_LDO2 0x0e +#define DEF_VAL_MAX8893_REG_LDO3 0x11 +#define DEF_VAL_MAX8893_REG_LDO4 0x19 +#define DEF_VAL_MAX8893_REG_LDO5 0x16 +*/ +/* +* +* Register address of MAX8893 A/B/C +* BUCK is marked as LDO "-1" +*/ + +#define BUCK (-1) +#define LDO1 1 +#define LDO2 2 +#define LDO3 3 +#define LDO4 4 +#define LDO5 5 +#define DISABLE_USB 6 +#define MAX8893_REG_ONOFF 0x00 +#define MAX8893_REG_DISCHARGE 0x01 +#define MAX8893_REG_LSTIME 0x02 +#define MAX8893_REG_DVSRAMP 0x03 +#define MAX8893_REG_LDO(x) ((x+1) ? (4+x) : 4) +#define ON 1 +#define OFF 0 + +/* +* The maximum and minimum voltage an LDO can provide +* Buck, x = -1 +*/ + +#define MAX_VOLTAGE(x) ((x+1) ? 3300 : 2400) +#define MIN_VOLTAGE(x) ((0x04&x) ? 800 : ((0x01&x) ? 1600 : 1200)) +/* +* +* +*ENABLE_LDO(x) generates a mask which needs +*to be ORed with the contents of onoff reg +* +*DISABLE_LDO(x) generates a mask which needs +*to be ANDed with contents of the off reg +* +*For BUCK, x=-1 +*/ +#define ENABLE_LDO(x) (0x80>>(x+1)) +#define DISABLE_LDO(x) (~(0x80>>(x+1))) + +int wimax_pmic_set_voltage(void); +#endif diff --git a/include/linux/wimax/samsung/wimax732.h b/include/linux/wimax/samsung/wimax732.h new file mode 100644 index 0000000..d7d395a --- /dev/null +++ b/include/linux/wimax/samsung/wimax732.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2008 Samsung Electronics, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include + +#ifndef __WIMAX_CMC732_H +#define __WIMAX_CMC732_H + +#ifdef __KERNEL__ + +#define WIMAX_POWER_SUCCESS 0 +#define WIMAX_ALREADY_POWER_ON -1 +#define WIMAX_POWER_FAIL -2 +#define WIMAX_ALREADY_POWER_OFF -3 + +/* wimax mode */ +enum { + SDIO_MODE = 0, + WTM_MODE, + MAC_IMEI_WRITE_MODE, + USIM_RELAY_MODE, + DM_MODE, + USB_MODE, + AUTH_MODE +}; + +/* wimax power state */ +enum { + CMC_POWER_OFF = 0, + CMC_POWER_ON, + CMC_POWERING_OFF, + CMC_POWERING_ON +}; + +/* wimax state */ +enum { + WIMAX_STATE_NOT_READY, + WIMAX_STATE_READY, + WIMAX_STATE_VIRTUAL_IDLE, + WIMAX_STATE_NORMAL, + WIMAX_STATE_IDLE, + WIMAX_STATE_RESET_REQUESTED, + WIMAX_STATE_RESET_ACKED, + WIMAX_STATE_AWAKE_REQUESTED, +}; + +struct wimax_cfg { + struct wake_lock wimax_driver_lock; /* resume wake lock */ + struct mutex power_mutex; /*serialize power on/off*/ + struct mutex suspend_mutex; + struct work_struct shutdown; + struct wimax732_platform_data *pdata; + struct notifier_block pm_notifier; + u8 power_state; + /* wimax mode (SDIO, USB, etc..) */ + u8 wimax_mode; +}; + +struct wimax732_platform_data { + int (*power) (int); + void (*detect) (int); + void (*set_mode) (void); + void (*signal_ap_active) (int); + int (*get_sleep_mode) (void); + int (*is_modem_awake) (void); + void (*wakeup_assert) (int); + struct wimax_cfg *g_cfg; + struct miscdevice swmxctl_dev; + int wimax_int; + void *adapter_data; + void (*restore_uart_path) (void); + int uart_sel; + int uart_sel1; +}; + +void s3c_bat_use_wimax(int onoff); + +#endif + +#endif -- cgit v1.1