diff options
Diffstat (limited to 'include')
121 files changed, 9413 insertions, 452 deletions
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h new file mode 100644 index 0000000..ed860bb --- /dev/null +++ b/include/asm-generic/dma-contiguous.h @@ -0,0 +1,28 @@ +#ifndef ASM_DMA_CONTIGUOUS_H +#define ASM_DMA_CONTIGUOUS_H + +#ifdef __KERNEL__ +#ifdef CONFIG_DMA_CMA + +#include <linux/device.h> +#include <linux/dma-contiguous.h> + +static inline struct cma *dev_get_cma_area(struct device *dev) +{ + if (dev && dev->cma_area) + return dev->cma_area; + return dma_contiguous_default_area; +} + +static inline void dev_set_cma_area(struct device *dev, struct cma *cma) +{ + if (dev) + dev->cma_area = cma; + if (!dev || !dma_contiguous_default_area) + dma_contiguous_default_area = cma; +} + +#endif +#endif + +#endif diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index db22d13..edb4004 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -627,6 +627,8 @@ *(.initcall2s.init) \ *(.initcall3.init) \ *(.initcall3s.init) \ + *(.initcallbresume.init) \ + *(.initcallresume.init) \ *(.initcall4.init) \ *(.initcall4s.init) \ *(.initcall5.init) \ diff --git a/include/compat/linux/nl80211.h b/include/compat/linux/nl80211.h index c1ba388..3ebdc10 100755 --- a/include/compat/linux/nl80211.h +++ b/include/compat/linux/nl80211.h @@ -720,6 +720,8 @@ enum nl80211_commands { NL80211_CMD_PRIV, + NL80211_CMD_PRIV_EVENT, + NL80211_CMD_P2P_FLUSH, NL80211_CMD_BTCOEX_INQ, @@ -1519,6 +1521,8 @@ enum nl80211_attrs { NL80211_ATTR_PRIV_CMD, + NL80211_ATTR_PRIV_EVENT, + NL80211_ATTR_BTCOEX_INQ_STATUS, NL80211_ATTR_BTCOEX_SCO_STATUS, NL80211_ATTR_BTCOEX_TYPE_ESCO, diff --git a/include/compat/net/cfg80211.h b/include/compat/net/cfg80211.h index 881a0d9..a5ac8ff 100755 --- a/include/compat/net/cfg80211.h +++ b/include/compat/net/cfg80211.h @@ -3358,6 +3358,16 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, const u8 *frame, size_t len, int freq, gfp_t gfp); +/** + * cfg80211_priv_event - notify userspace about priv event + * @dev: the device the priv event was sent on + * @priv_event: event string + * @gfp: allocation flags + */ +void cfg80211_priv_event(struct net_device *dev, const char *priv_event, + gfp_t gfp); + + /* Logging, debugging and troubleshooting/diagnostic helpers. */ /* wiphy_printk helpers, similar to dev_printk */ diff --git a/include/drm/drm.h b/include/drm/drm.h index 64ff02d..5b831df 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -730,6 +730,8 @@ struct drm_prime_handle { #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) +#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) +#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) /** * Device specific ioctls should only be in their respective headers diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e250eda..0592714 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -36,6 +36,7 @@ struct drm_device; struct drm_mode_set; struct drm_framebuffer; +struct drm_object_properties; #define DRM_MODE_OBJECT_CRTC 0xcccccccc @@ -50,6 +51,14 @@ struct drm_framebuffer; struct drm_mode_object { uint32_t id; uint32_t type; + struct drm_object_properties *properties; +}; + +#define DRM_OBJECT_MAX_PROPERTY 16 +struct drm_object_properties { + int count; + uint32_t ids[DRM_OBJECT_MAX_PROPERTY]; + uint64_t values[DRM_OBJECT_MAX_PROPERTY]; }; /* @@ -297,7 +306,8 @@ struct drm_plane; * @mode_fixup: fixup proposed mode * @mode_set: set the desired mode on the CRTC * @gamma_set: specify color ramp for CRTC - * @destroy: deinit and free object. + * @destroy: deinit and free object + * @set_property: called when a property is changed * * The drm_crtc_funcs structure is the central CRTC management structure * in the DRM. Each CRTC controls one or more connectors (note that the name @@ -341,6 +351,9 @@ struct drm_crtc_funcs { int (*page_flip)(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event); + + int (*set_property)(struct drm_crtc *crtc, + struct drm_property *property, uint64_t val); }; /** @@ -360,6 +373,7 @@ struct drm_crtc_funcs { * @framedur_ns: precise line timing * @pixeldur_ns: precise pixel timing * @helper_private: mid-layer private data + * @properties: property tracking for this CRTC * * Each CRTC may have one or more connectors associated with it. This structure * allows the CRTC to be controlled. @@ -395,6 +409,8 @@ struct drm_crtc { /* if you are using the helper */ void *helper_private; + + struct drm_object_properties properties; }; @@ -451,7 +467,6 @@ struct drm_encoder_funcs { }; #define DRM_CONNECTOR_MAX_UMODES 16 -#define DRM_CONNECTOR_MAX_PROPERTY 16 #define DRM_CONNECTOR_LEN 32 #define DRM_CONNECTOR_MAX_ENCODER 3 @@ -520,8 +535,7 @@ enum drm_connector_force { * @funcs: connector control functions * @user_modes: user added mode list * @edid_blob_ptr: DRM property containing EDID if present - * @property_ids: property tracking for this connector - * @property_values: value pointers or data for properties + * @properties: property tracking for this connector * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling * @dpms: current dpms state * @helper_private: mid-layer private data @@ -565,8 +579,7 @@ struct drm_connector { struct list_head user_modes; struct drm_property_blob *edid_blob_ptr; - u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; - uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; + struct drm_object_properties properties; uint8_t polled; /* DRM_CONNECTOR_POLL_* */ @@ -595,6 +608,7 @@ struct drm_connector { * @update_plane: update the plane configuration * @disable_plane: shut down the plane * @destroy: clean up plane resources + * @set_property: called when a property is changed */ struct drm_plane_funcs { int (*update_plane)(struct drm_plane *plane, @@ -605,6 +619,9 @@ struct drm_plane_funcs { uint32_t src_w, uint32_t src_h); int (*disable_plane)(struct drm_plane *plane); void (*destroy)(struct drm_plane *plane); + + int (*set_property)(struct drm_plane *plane, + struct drm_property *property, uint64_t val); }; /** @@ -622,6 +639,7 @@ struct drm_plane_funcs { * @enabled: enabled flag * @funcs: helper functions * @helper_private: storage for drver layer + * @properties: property tracking for this plane */ struct drm_plane { struct drm_device *dev; @@ -644,6 +662,8 @@ struct drm_plane { const struct drm_plane_funcs *funcs; void *helper_private; + + struct drm_object_properties properties; }; /** @@ -898,6 +918,12 @@ extern int drm_connector_property_set_value(struct drm_connector *connector, extern int drm_connector_property_get_value(struct drm_connector *connector, struct drm_property *property, uint64_t *value); +extern int drm_object_property_set_value(struct drm_mode_object *obj, + struct drm_property *property, + uint64_t val); +extern int drm_object_property_get_value(struct drm_mode_object *obj, + struct drm_property *property, + uint64_t *value); extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); extern void drm_framebuffer_set_object(struct drm_device *dev, unsigned long handle); @@ -910,14 +936,21 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); extern bool drm_crtc_in_use(struct drm_crtc *crtc); -extern int drm_connector_attach_property(struct drm_connector *connector, - struct drm_property *property, uint64_t init_val); +extern void drm_connector_attach_property(struct drm_connector *connector, + struct drm_property *property, uint64_t init_val); +extern void drm_object_attach_property(struct drm_mode_object *obj, + struct drm_property *property, + uint64_t init_val); extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, const char *name, int num_values); extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, const char *name, const struct drm_prop_enum_list *props, int num_values); +struct drm_property *drm_property_create_bitmask(struct drm_device *dev, + int flags, const char *name, + const struct drm_prop_enum_list *props, + int num_values); struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, const char *name, uint64_t min, uint64_t max); @@ -1023,6 +1056,10 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); +extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp); diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 2a2acda..3190dfe 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -228,6 +228,7 @@ struct drm_mode_get_connector { #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ #define DRM_MODE_PROP_BLOB (1<<4) +#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ struct drm_mode_property_enum { __u64 value; @@ -252,6 +253,21 @@ struct drm_mode_connector_set_property { __u32 connector_id; }; +struct drm_mode_obj_get_properties { + __u64 props_ptr; + __u64 prop_values_ptr; + __u32 count_props; + __u32 obj_id; + __u32 obj_type; +}; + +struct drm_mode_obj_set_property { + __u64 value; + __u32 prop_id; + __u32 obj_id; + __u32 obj_type; +}; + struct drm_mode_get_blob { __u32 blob_id; __u32 length; diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index f5d8a38..e8aa254 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h @@ -111,6 +111,19 @@ struct drm_exynos_gem_info { }; /** + * A structure to userptr limited information. + * + * @userptr_limit: maximum size to userptr buffer. + * the buffer could be allocated by unprivileged user using malloc() + * and the size of the buffer would be limited as userptr_limit value. + * @pad: just padding to be 64-bit aligned. + */ +struct drm_exynos_user_limit { + unsigned int userptr_limit; + unsigned int pad; +}; + +/** * A structure for user connection request of virtual display. * * @connection: indicate whether doing connetion or not by user. @@ -211,16 +224,14 @@ enum e_drm_exynos_gem_mem_type { * P.S. it SHOULD BE user space. * @size: buffer size for cache operation. * @flags: select cache unit and cache operation. + * @gem_handle: a handle to a gem object. + * this gem handle is needed for cache range operation to L2 cache. */ struct drm_exynos_gem_cache_op { uint64_t usr_addr; unsigned int size; unsigned int flags; -}; - -struct drm_exynos_plane_set_zpos { - __u32 plane_id; - __s32 zpos; + unsigned int gem_handle; }; struct drm_exynos_g2d_get_ver { @@ -256,99 +267,129 @@ struct drm_exynos_g2d_exec { __u32 reserved; }; -enum drm_exynos_rot_flip { - ROT_FLIP_NONE, - ROT_FLIP_VERTICAL, - ROT_FLIP_HORIZONTAL, +/* definition of operations types */ +enum drm_exynos_ops_id { + EXYNOS_DRM_OPS_SRC, + EXYNOS_DRM_OPS_DST, + EXYNOS_DRM_OPS_MAX, +}; + +/* definition of size */ +struct drm_exynos_sz { + __u32 hsize; + __u32 vsize; +}; + +/* definition of position */ +struct drm_exynos_pos { + __u32 x; + __u32 y; + __u32 w; + __u32 h; }; -enum drm_exynos_rot_degree { - ROT_DEGREE_0, - ROT_DEGREE_90, - ROT_DEGREE_180, - ROT_DEGREE_270, +/* definition of flip */ +enum drm_exynos_flip { + EXYNOS_DRM_FLIP_NONE = (0 << 0), + EXYNOS_DRM_FLIP_VERTICAL = (1 << 0), + EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1), }; -#define DRM_EXYNOS_ROT_MAX_BUF 3 +/* definition of rotation degree */ +enum drm_exynos_degree { + EXYNOS_DRM_DEGREE_0, + EXYNOS_DRM_DEGREE_90, + EXYNOS_DRM_DEGREE_180, + EXYNOS_DRM_DEGREE_270, +}; + +/* definition of planar */ +enum drm_exynos_planer { + EXYNOS_DRM_PLANAR_Y, + EXYNOS_DRM_PLANAR_CB, + EXYNOS_DRM_PLANAR_CR, + EXYNOS_DRM_PLANAR_MAX, +}; /** - * A structure for rotator buffer + * A structure for ipp config. * - * @src_handle: Source GEM handles. - * @dst_handle: Destination GEM handles. - * - *_handle[0] : For RGB or Y buffer. - * - *_handle[1] : For CbCr or Cb buffer. - * - *_handle[2] : For Cr buffer. - * @src_cnt: Number of source GEM handles. - * @dst_cnt: Number of destination GEM handles. - * @src_w: Source Buffer width. - * @src_h: Source Buffer height. - * @dst_w: Destination Buffer width. - * @dst_h: Destination Buffer height. + * @ops_id: property of operation directions. + * @flip: property of mirror, flip. + * @degree: property of rotation degree. + * @fmt: property of image format. + * @sz: property of image size. + * @pos: property of image position(src-cropped,dst-scaler). */ -struct drm_exynos_rot_buffer { - __u32 src_handle[DRM_EXYNOS_ROT_MAX_BUF]; - __u32 dst_handle[DRM_EXYNOS_ROT_MAX_BUF]; - __u32 src_cnt; - __u32 dst_cnt; - __u32 src_w; - __u32 src_h; - __u32 dst_w; - __u32 dst_h; +struct drm_exynos_ipp_config { + enum drm_exynos_ops_id ops_id; + enum drm_exynos_flip flip; + enum drm_exynos_degree degree; + __u32 fmt; + struct drm_exynos_sz sz; + struct drm_exynos_pos pos; +}; + +/* command of ipp operations */ +enum drm_exynos_ipp_cmd { + IPP_CMD_NONE, + IPP_CMD_M2M, + IPP_CMD_WB, + IPP_CMD_OUTPUT, + IPP_CMD_MAX, }; /** - * A structure for rotator control. + * A structure for ipp property. * - * @img_fmt: Source / destination buffer (image)format. - * - fourcc code from drm_fourcc.h - * - DRM_FORMAT_RGB888 - * - DRM_FORMAT_RGB565 - * - DRM_FORMAT_YUYV : YUV 4:2:2 packed, YCbYCr - * - DRM_FORMAT_NV12M : YUV 4:2:0 non-contiguous 2-plane, Y/CbCr - * - DRM_FORMAT_YUV420M : YUV 4:2:0 non-contiguous 3-plane, Y/Cb/Cr - * @flip: Flip operation value. - * @degree: Rotation operation degree value. + * @config: source, destination config. + * @cmd: command type. + * @ipp_id: id of ipp driver. + * @prop_id: id of property. */ -struct drm_exynos_rot_control { - __u32 img_fmt; - enum drm_exynos_rot_flip flip; - enum drm_exynos_rot_degree degree; - __u32 reserved; +struct drm_exynos_ipp_property { + struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX]; + enum drm_exynos_ipp_cmd cmd; + __u32 ipp_id; + __u32 prop_id; + __u32 reserved; +}; + +/* definition of buffer control */ +enum drm_exynos_ipp_buf_ctrl { + IPP_BUF_CTRL_QUEUE, + IPP_BUF_CTRL_DEQUEUE, }; /** - * A structure for rotator crop. + * A structure for ipp buffer operations. * - * @src_x: Cropped image position x in source buffer[FROM]. - * @src_y: Cropped image position y in source buffer[FROM]. - * @src_w: Cropped image width in source buffer. - * @src_h: Cropped image height in source buffer. - * @dst_x: Cropped image position x in destination buffer[TO]. - * @dst_y: Cropped image position y in destination buffer[TO]. + * @ops_id: operation directions. + * @ctrl: buffer control. + * @prop_id: id of property. + * @buf_id: id of buffer. + * @handle: Y, Cb, Cr each planar handle. + * @user_data: user data. */ -struct drm_exynos_rot_crop { - __u32 src_x; - __u32 src_y; - __u32 src_w; - __u32 src_h; - __u32 dst_x; - __u32 dst_y; +struct drm_exynos_ipp_buf { + enum drm_exynos_ops_id ops_id; + enum drm_exynos_ipp_buf_ctrl buf_ctrl; + __u32 prop_id; + __u32 buf_id; + __u32 handle[EXYNOS_DRM_PLANAR_MAX]; + __u32 reserved; + __u64 user_data; }; /** - * A structure for rotator operation. + * A structure for ipp start/stop operations. * - * @buf: (Image)Buffer data. - * @control: Control data. - * @crop: Cropped image data. - * @user_data: Not used yet. + * @prop_id: id of property. + * @use: use ipp device. */ -struct drm_exynos_rot_exec_data { - struct drm_exynos_rot_buffer buf; - struct drm_exynos_rot_control control; - struct drm_exynos_rot_crop crop; - __u64 user_data; +struct drm_exynos_ipp_ctrl { + __u32 prop_id; + __u32 use; }; #define DRM_EXYNOS_GEM_CREATE 0x00 @@ -356,8 +397,7 @@ struct drm_exynos_rot_exec_data { #define DRM_EXYNOS_GEM_MMAP 0x02 #define DRM_EXYNOS_GEM_USERPTR 0x03 #define DRM_EXYNOS_GEM_GET 0x04 -/* Reserved 0x04 ~ 0x05 for exynos specific gem ioctl */ -#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 +#define DRM_EXYNOS_USER_LIMIT 0x05 #define DRM_EXYNOS_VIDI_CONNECTION 0x07 /* temporary ioctl command. */ @@ -372,8 +412,11 @@ struct drm_exynos_rot_exec_data { #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21 #define DRM_EXYNOS_G2D_EXEC 0x22 -/* Rotator */ -#define DRM_EXYNOS_ROTATOR_EXEC 0x30 +/* IPP - Image Post Processing */ +#define DRM_EXYNOS_IPP_GET_PROPERTY 0x30 +#define DRM_EXYNOS_IPP_SET_PROPERTY 0x31 +#define DRM_EXYNOS_IPP_BUF 0x32 +#define DRM_EXYNOS_IPP_CTRL 0x33 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) @@ -390,6 +433,9 @@ struct drm_exynos_rot_exec_data { #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) +#define DRM_IOCTL_EXYNOS_USER_LIMIT DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_USER_LIMIT, struct drm_exynos_user_limit) + #define DRM_IOCTL_EXYNOS_GEM_EXPORT_UMP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_EXPORT_UMP, struct drm_exynos_gem_ump) @@ -402,9 +448,6 @@ struct drm_exynos_rot_exec_data { #define DRM_IOCTL_EXYNOS_GEM_PHY_IMP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_PHY_IMP, struct drm_exynos_gem_phy_imp) -#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ - DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) - #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) @@ -415,11 +458,18 @@ struct drm_exynos_rot_exec_data { #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec) -#define DRM_IOCTL_EXYNOS_ROTATOR_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ - DRM_EXYNOS_ROTATOR_EXEC, struct drm_exynos_rot_exec_data) +#define DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_IPP_GET_PROPERTY, struct drm_exynos_ipp_property) +#define DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_IPP_SET_PROPERTY, struct drm_exynos_ipp_property) +#define DRM_IOCTL_EXYNOS_IPP_BUF DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_IPP_BUF, struct drm_exynos_ipp_buf) +#define DRM_IOCTL_EXYNOS_IPP_CTRL DRM_IOWR(DRM_COMMAND_BASE + \ + DRM_EXYNOS_IPP_CTRL, struct drm_exynos_ipp_ctrl) /* EXYNOS specific events */ #define DRM_EXYNOS_G2D_EVENT 0x80000000 +#define DRM_EXYNOS_IPP_EVENT 0x80000001 struct drm_exynos_g2d_event { struct drm_event base; @@ -430,6 +480,16 @@ struct drm_exynos_g2d_event { __u32 reserved; }; +struct drm_exynos_ipp_event { + struct drm_event base; + __u64 user_data; + __u32 tv_sec; + __u32 tv_usec; + __u32 prop_id; + __u32 reserved; + __u32 buf_id[EXYNOS_DRM_OPS_MAX]; +}; + /** * A structure for lcd panel information. * @@ -490,4 +550,38 @@ struct exynos_drm_hdmi_pdata { int (*get_hpd)(void); }; +/** + * Platform Specific Structure for DRM based FIMC. + * + * @inv_pclk: if set 1. invert pixel clock + * @inv_vsync: if set 1. invert vsync signal for wb + * @inv_href: if set 1. invert href signal + * @inv_hsync: if set 1. invert hsync signal for wb + */ +struct exynos_drm_fimc_pol { + unsigned int inv_pclk; + unsigned int inv_vsync; + unsigned int inv_href; + unsigned int inv_hsync; +}; + +/* definition of chipset version */ +enum exynos_drm_fimc_ver { + FIMC_EXYNOS_4210, + FIMC_EXYNOS_4212, + FIMC_EXYNOS_4412, +}; + +/** + * Platform Specific Structure for DRM based FIMC. + * + * @pol: current hardware block polarity settings. + * @ver: current hardware block version. + */ +struct exynos_drm_fimc_pdata { + struct exynos_drm_fimc_pol pol; + enum exynos_drm_fimc_ver ver; +}; + #endif + diff --git a/include/linux/android_alarm.h b/include/linux/android_alarm.h index 68c9b0f..4c93791 100644 --- a/include/linux/android_alarm.h +++ b/include/linux/android_alarm.h @@ -76,6 +76,8 @@ ktime_t alarm_get_elapsed_realtime(void); int alarm_set_rtc(const struct timespec ts); #if defined(CONFIG_RTC_ALARM_BOOT) int alarm_set_alarm_boot(char *alarm_data); +#elif defined(CONFIG_RTC_POWER_OFF) +int alarm_set_alarm_poweroff(char *alarm_data); #endif #endif @@ -102,9 +104,11 @@ enum android_alarm_return_flags { #define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec) #define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec) #define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec) -#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) +#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) #if defined(CONFIG_RTC_ALARM_BOOT) -#define ANDROID_ALARM_SET_ALARM_BOOT _IOW('a', 7, struct timespec) +#define ANDROID_ALARM_SET_ALARM_BOOT _IOW('a', 7, struct timespec) +#elif defined(CONFIG_RTC_POWER_OFF) +#define ANDROID_ALARM_SET_ALARM_POWEROFF _IOW('a', 8, struct timespec) #endif #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0))) #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4) diff --git a/include/linux/battery/samsung_battery.h b/include/linux/battery/samsung_battery.h index ea6d515..f58c839 100644 --- a/include/linux/battery/samsung_battery.h +++ b/include/linux/battery/samsung_battery.h @@ -19,11 +19,21 @@ #include <linux/delay.h> #include <linux/power_supply.h> #include <linux/android_alarm.h> +#if defined(CONFIG_S3C_ADC) +#include <plat/adc.h> +#endif +#if defined(CONFIG_STMPE811_ADC) +#include <linux/stmpe811-adc.h> +#endif + /* macro */ #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define ABS(x) ((x) < 0 ? (-1 * (x)) : (x)) +#define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \ + ((y <= val) && (val <= x)) ? 1 : 0) + /* common */ enum { @@ -79,6 +89,7 @@ struct battery_info { unsigned int charge_virt_state; unsigned int charge_type; unsigned int charge_current; + int charge_current_avg; unsigned int input_current; /* battery state */ @@ -91,6 +102,7 @@ struct battery_info { unsigned int battery_raw_soc; int battery_r_s_delta; int battery_full_soc; + int battery_vf_adc; /* temperature */ int battery_temper; @@ -101,6 +113,8 @@ struct battery_info { /* cable type */ unsigned int cable_type; + unsigned int cable_sub_type; + unsigned int cable_pwr_type; /* For SAMSUNG charge spec */ unsigned int vf_state; @@ -109,24 +123,44 @@ struct battery_info { unsigned int freezed_state; unsigned int full_charged_state; unsigned int abstimer_state; + unsigned int abstimer_active; unsigned int recharge_phase; unsigned int recharge_start; unsigned int health_state; - unsigned int lpm_state; + /* SIOP */ unsigned int siop_state; unsigned int siop_charge_current; + unsigned int siop_lv; + + /* etc... */ + unsigned int lpm_state; unsigned int led_state; + unsigned int slate_mode; /* ambiguous state */ unsigned int ambiguous_state; + /* event sceanario */ + unsigned int event_state; + unsigned int event_type; + /* time management */ unsigned int charge_start_time; - struct alarm alarm; + struct timespec current_time; + struct alarm monitor_alarm; + struct alarm event_alarm; bool slow_poll; ktime_t last_poll; + /* irq */ + int batdet_gpio; + int batdet_irq; + bool batdet_irq_st; + + /* adc power */ + bool adc_pwr_st; + struct proc_dir_entry *entry; /* For debugging */ @@ -136,6 +170,11 @@ struct battery_info { /* factory mode */ bool factory_mode; +#if defined(CONFIG_TARGET_LOCALE_KOR) + /* error test charging off mode */ + bool errortest_stopcharging; +#endif + #if defined(CONFIG_TARGET_LOCALE_KOR) || defined(CONFIG_MACH_M0_CTC) bool is_unspec_phase; bool is_unspec_recovery; @@ -150,6 +189,29 @@ struct battery_info { /* jig state */ extern bool is_jig_attached; +/* charger detect source */ +#if defined(CONFIG_MACH_C1_KOR_SKT) || \ + defined(CONFIG_MACH_C1_KOR_KT) || defined(CONFIG_MACH_C1_KOR_LGT) || \ + defined(CONFIG_MACH_BAFFIN) +#undef USE_CHGIN_INTR +#else +#define USE_CHGIN_INTR +#endif + +/* extended online type */ +#if defined(CONFIG_MACH_T0) +#define EXTENDED_ONLINE_TYPE +#else +#undef EXTENDED_ONLINE_TYPE +#endif + +/* use 2step charge termination */ +#if defined(CONFIG_MACH_T0) +#define USE_2STEP_TERM +#else +#undef USE_2STEP_TERM +#endif + /* * Use for charger */ @@ -180,6 +242,13 @@ enum soc_type { /* * Use for battery */ + +enum status_full_type { + STATUS_NOT_FULL = 0, + STATUS_1ST_FULL, + STATUS_2ND_FULL, +}; + #define OFF_CURR 0 /* charger off current */ #define KEEP_CURR -1 /* keep previous current */ @@ -198,14 +267,24 @@ enum soc_type { #define ADC_ERR_CNT 5 #define ADC_ERR_DELAY 200 +/* WORKAROUND: define audio dock current */ +#define DOCK_TYPE_AUDIO_CURR 1000 +#define DOCK_TYPE_SMART_NOTG_CURR 1700 +#define DOCK_TYPE_SMART_OTG_CURR 1000 +#define DOCK_TYPE_LOW_CURR 475 + /* voltage diff for recharge voltage calculation */ -#if defined(CONFIG_TARGET_LOCALE_KOR) +#if defined(CONFIG_TARGET_LOCALE_KOR) || defined(CONFIG_MACH_M0_CTC) /* KOR model spec : max-voltage minus 60mV */ #define RECHG_DROP_VALUE 60000 #else #define RECHG_DROP_VALUE 50000 /* 4300mV */ #endif +/* power off condition, low %duV than VOLTAGE_MIN_DESIGN & SOC 0% */ +#define PWROFF_MARGIN 100000 +#define PWROFF_SOC 0 + enum { CHARGE_DISABLE = 0, CHARGE_ENABLE, @@ -235,12 +314,29 @@ enum { TEMPER_UNKNOWN, }; +/* vf detect source */ +enum { + VF_DET_ADC = 0, + VF_DET_CHARGER, + VF_DET_GPIO, + + VF_DET_UNKNOWN, +}; + + /* siop state */ enum { SIOP_DEACTIVE = 0, SIOP_ACTIVE, }; +enum siop_level { + SIOP_LV0 = 0, + SIOP_LV1, + SIOP_LV2, + SIOP_LV3, +}; + /* monitoring mode */ enum { MONITOR_CHNG = 0, @@ -278,6 +374,31 @@ enum led_pattern { BATT_LED_PATT_NOT_CHG, }; +/* event case */ +enum event_type { + EVENT_TYPE_WCDMA_CALL = 0, + EVENT_TYPE_GSM_CALL, + EVENT_TYPE_CALL, + EVENT_TYPE_VIDEO, + EVENT_TYPE_MUSIC, + EVENT_TYPE_BROWSER, + EVENT_TYPE_HOTSPOT, + EVENT_TYPE_CAMERA, + EVENT_TYPE_DATA_CALL, + EVENT_TYPE_GPS, + EVENT_TYPE_LTE, + EVENT_TYPE_WIFI, + EVENT_TYPE_USE, + + EVENT_TYPE_MAX, +}; + +enum event_state { + EVENT_STATE_CLEAR = 0, + EVENT_STATE_IN_TIMER, + EVENT_STATE_SET, +}; + /** * struct sec_bat_plaform_data - init data for sec batter driver * @fuel_gauge_name: power supply name of fuel gauge @@ -301,6 +422,9 @@ struct samsung_battery_platform_data { unsigned int chg_curr_wpc; unsigned int chg_curr_dock; unsigned int chg_curr_etc; + unsigned int chg_curr_siop_lv1; + unsigned int chg_curr_siop_lv2; + unsigned int chg_curr_siop_lv3; /* variable monitoring interval */ unsigned int chng_interval; @@ -327,13 +451,36 @@ struct samsung_battery_platform_data { int freeze_stop_temp; int freeze_recovery_temp; - /* Temperature source 0: fuelgauge, 1: ap adc, 2: ex. adc */ + /* CTIA spec */ + bool ctia_spec; + + /* event sceanario */ + unsigned int event_time; + + /* CTIA temperature */ + int event_overheat_stop_temp; + int event_overheat_recovery_temp; + int event_freeze_stop_temp; + int event_freeze_recovery_temp; + int lpm_overheat_stop_temp; + int lpm_overheat_recovery_temp; + int lpm_freeze_stop_temp; + int lpm_freeze_recovery_temp; + + /* temperature source 0: fuelgauge, 1: ap adc, 2: ex. adc */ int temper_src; int temper_ch; #ifdef CONFIG_S3C_ADC int (*covert_adc) (int, int); #endif + /* battery vf source 0: adc(polling), 1: charger(interrupt) */ + int vf_det_src; + int vf_det_ch; + int vf_det_th_l; + int vf_det_th_h; + int batt_present_gpio; + /* suspend in charging */ bool suspend_chging; diff --git a/include/linux/compaction.h b/include/linux/compaction.h index cc9f7a4..10cd674 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -24,8 +24,10 @@ extern unsigned long try_to_compact_pages(struct zonelist *zonelist, int order, gfp_t gfp_mask, nodemask_t *mask, bool sync); extern unsigned long compaction_suitable(struct zone *zone, int order); +#ifndef CONFIG_DMA_CMA extern unsigned long compact_zone_order(struct zone *zone, int order, gfp_t gfp_mask, bool sync); +#endif /* Do not skip compaction more than 64 times */ #define COMPACT_MAX_DEFER_SHIFT 6 diff --git a/include/linux/cpufreq_pegasusq.h b/include/linux/cpufreq_pegasusq.h index ed48127..6c2d82b 100644 --- a/include/linux/cpufreq_pegasusq.h +++ b/include/linux/cpufreq_pegasusq.h @@ -19,4 +19,7 @@ int cpufreq_pegasusq_cpu_lock(int num_core); int cpufreq_pegasusq_cpu_unlock(int num_core); +void cpufreq_pegasusq_min_cpu_lock(unsigned int num_core); +void cpufreq_pegasusq_min_cpu_unlock(void); + #endif diff --git a/include/linux/devfreq/exynos4_display.h b/include/linux/devfreq/exynos4_display.h deleted file mode 100644 index 8a4b957..0000000 --- a/include/linux/devfreq/exynos4_display.h +++ /dev/null @@ -1,28 +0,0 @@ -/* include/linux/devfreq/exynos4_display.h - * - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * Chanwoo Choi <cw00.choi@samsung.com> - * Myungjoo Ham <myungjoo.ham@samsung.com> - * Kyungmin Park <kyungmin.park@samsung.com> - * - * EXYNOS4 - Dynamic LCD refresh rate support - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -*/ - -#ifndef __ASM_ARCH_EXYNOS4_DISPLAY_H -#define __ASM_ARCH_EXYNOS4_DISPLAY_H __FILE__ - -#define EXYNOS4_DISPLAY_LV_HF 60 -#define EXYNOS4_DISPLAY_LV_LF 40 -#define EXYNOS4_DISPLAY_LV_DEFAULT EXYNOS4_DISPLAY_LV_HF - -/* Register/unregister display client to exynos4_display */ -extern int exynos4_display_register_client(struct notifier_block *nb); -extern int exynos4_display_unregister_client(struct notifier_block *nb); - -#endif /* __ASM_ARCH_EXYNOS4_DISPLAY_H */ diff --git a/include/linux/device.h b/include/linux/device.h index 69b6a9d..2db1abf 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -588,6 +588,10 @@ struct device { struct dma_coherent_mem *dma_mem; /* internal for coherent mem override */ +#ifdef CONFIG_DMA_CMA + struct cma *cma_area; /* contiguous memory area for dma + allocation */ +#endif /* arch specific additions */ struct dev_archdata archdata; diff --git a/include/linux/diagchar.h b/include/linux/diagchar.h new file mode 100644 index 0000000..026290b --- /dev/null +++ b/include/linux/diagchar.h @@ -0,0 +1,700 @@ +/* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * 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. + */ + +#ifndef DIAGCHAR_SHARED +#define DIAGCHAR_SHARED + +#define MSG_MASKS_TYPE 1 +#define LOG_MASKS_TYPE 2 +#define EVENT_MASKS_TYPE 4 +#define PKT_TYPE 8 +#define DEINIT_TYPE 16 +#define USER_SPACE_LOG_TYPE 32 +#define USB_MODE 1 +#define MEMORY_DEVICE_MODE 2 +#define NO_LOGGING_MODE 3 +#define UART_MODE 4 + +/* different values that go in for diag_data_type */ +#define DATA_TYPE_EVENT 0 +#define DATA_TYPE_F3 1 +#define DATA_TYPE_LOG 2 +#define DATA_TYPE_RESPONSE 3 + +/* Different IOCTL values */ +#define DIAG_IOCTL_COMMAND_REG 0 +#define DIAG_IOCTL_SWITCH_LOGGING 7 +#define DIAG_IOCTL_GET_DELAYED_RSP_ID 8 +#define DIAG_IOCTL_LSM_DEINIT 9 + +/* PC Tools IDs */ +#define APQ8060_TOOLS_ID 4062 +#define AO8960_TOOLS_ID 4064 +#define APQ8064_TOOLS_ID 4072 +#define MSM8625_TOOLS_ID 4075 +#define MSM8930_TOOLS_ID 4076 +#define MSM8630_TOOLS_ID 4077 +#define MSM8230_TOOLS_ID 4078 +#define APQ8030_TOOLS_ID 4079 +#define MSM8627_TOOLS_ID 4080 +#define MSM8227_TOOLS_ID 4081 +#define MSM8974_TOOLS_ID 4072 + +#define MSG_MASK_0 (0x00000001) +#define MSG_MASK_1 (0x00000002) +#define MSG_MASK_2 (0x00000004) +#define MSG_MASK_3 (0x00000008) +#define MSG_MASK_4 (0x00000010) +#define MSG_MASK_5 (0x00000020) +#define MSG_MASK_6 (0x00000040) +#define MSG_MASK_7 (0x00000080) +#define MSG_MASK_8 (0x00000100) +#define MSG_MASK_9 (0x00000200) +#define MSG_MASK_10 (0x00000400) +#define MSG_MASK_11 (0x00000800) +#define MSG_MASK_12 (0x00001000) +#define MSG_MASK_13 (0x00002000) +#define MSG_MASK_14 (0x00004000) +#define MSG_MASK_15 (0x00008000) +#define MSG_MASK_16 (0x00010000) +#define MSG_MASK_17 (0x00020000) +#define MSG_MASK_18 (0x00040000) +#define MSG_MASK_19 (0x00080000) +#define MSG_MASK_20 (0x00100000) +#define MSG_MASK_21 (0x00200000) +#define MSG_MASK_22 (0x00400000) +#define MSG_MASK_23 (0x00800000) +#define MSG_MASK_24 (0x01000000) +#define MSG_MASK_25 (0x02000000) +#define MSG_MASK_26 (0x04000000) +#define MSG_MASK_27 (0x08000000) +#define MSG_MASK_28 (0x10000000) +#define MSG_MASK_29 (0x20000000) +#define MSG_MASK_30 (0x40000000) +#define MSG_MASK_31 (0x80000000) + +/* These masks are to be used for support of all legacy messages in the sw. +The user does not need to remember the names as they will be embedded in +the appropriate macros. */ +#define MSG_LEGACY_LOW MSG_MASK_0 +#define MSG_LEGACY_MED MSG_MASK_1 +#define MSG_LEGACY_HIGH MSG_MASK_2 +#define MSG_LEGACY_ERROR MSG_MASK_3 +#define MSG_LEGACY_FATAL MSG_MASK_4 + +/* Legacy Message Priorities */ +#define MSG_LVL_FATAL (MSG_LEGACY_FATAL) +#define MSG_LVL_ERROR (MSG_LEGACY_ERROR | MSG_LVL_FATAL) +#define MSG_LVL_HIGH (MSG_LEGACY_HIGH | MSG_LVL_ERROR) +#define MSG_LVL_MED (MSG_LEGACY_MED | MSG_LVL_HIGH) +#define MSG_LVL_LOW (MSG_LEGACY_LOW | MSG_LVL_MED) + +#define MSG_LVL_NONE 0 + +/* This needs to be modified manually now, when we add + a new RANGE of SSIDs to the msg_mask_tbl */ +#define MSG_MASK_TBL_CNT 23 +#define EVENT_LAST_ID 0x083F + +#define MSG_SSID_0 0 +#define MSG_SSID_0_LAST 90 +#define MSG_SSID_1 500 +#define MSG_SSID_1_LAST 506 +#define MSG_SSID_2 1000 +#define MSG_SSID_2_LAST 1007 +#define MSG_SSID_3 2000 +#define MSG_SSID_3_LAST 2008 +#define MSG_SSID_4 3000 +#define MSG_SSID_4_LAST 3014 +#define MSG_SSID_5 4000 +#define MSG_SSID_5_LAST 4010 +#define MSG_SSID_6 4500 +#define MSG_SSID_6_LAST 4526 +#define MSG_SSID_7 4600 +#define MSG_SSID_7_LAST 4612 +#define MSG_SSID_8 5000 +#define MSG_SSID_8_LAST 5029 +#define MSG_SSID_9 5500 +#define MSG_SSID_9_LAST 5516 +#define MSG_SSID_10 6000 +#define MSG_SSID_10_LAST 6072 +#define MSG_SSID_11 6500 +#define MSG_SSID_11_LAST 6521 +#define MSG_SSID_12 7000 +#define MSG_SSID_12_LAST 7003 +#define MSG_SSID_13 7100 +#define MSG_SSID_13_LAST 7111 +#define MSG_SSID_14 7200 +#define MSG_SSID_14_LAST 7201 +#define MSG_SSID_15 8000 +#define MSG_SSID_15_LAST 8000 +#define MSG_SSID_16 8500 +#define MSG_SSID_16_LAST 8523 +#define MSG_SSID_17 9000 +#define MSG_SSID_17_LAST 9008 +#define MSG_SSID_18 9500 +#define MSG_SSID_18_LAST 9509 +#define MSG_SSID_19 10200 +#define MSG_SSID_19_LAST 10210 +#define MSG_SSID_20 10251 +#define MSG_SSID_20_LAST 10255 +#define MSG_SSID_21 10300 +#define MSG_SSID_21_LAST 10300 +#define MSG_SSID_22 10350 +#define MSG_SSID_22_LAST 10361 + +struct diagpkt_delay_params { + void *rsp_ptr; + int size; + int *num_bytes_ptr; +}; + +static const uint32_t msg_bld_masks_0[] = { + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_ERROR, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_ERROR, + MSG_LVL_LOW, + MSG_LVL_ERROR, + MSG_LVL_ERROR, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_ERROR, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED|MSG_MASK_7 | \ + MSG_MASK_8|MSG_MASK_9|MSG_MASK_10|MSG_MASK_11|MSG_MASK_12 | \ + MSG_MASK_13|MSG_MASK_14|MSG_MASK_15|MSG_MASK_16 | \ + MSG_MASK_17|MSG_MASK_18|MSG_MASK_19|MSG_MASK_20|MSG_MASK_21, + MSG_LVL_MED|MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8|MSG_MASK_9|MSG_MASK_10| \ + MSG_MASK_11|MSG_MASK_12|MSG_MASK_13|MSG_MASK_14| \ + MSG_MASK_15|MSG_MASK_16|MSG_MASK_17, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED|MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_MED, + MSG_LVL_MED|MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8|MSG_MASK_9|MSG_MASK_10| \ + MSG_MASK_11|MSG_MASK_12|MSG_MASK_13|MSG_MASK_14|MSG_MASK_15| \ + MSG_MASK_16|MSG_MASK_17|MSG_MASK_18|MSG_MASK_19|MSG_MASK_20| \ + MSG_MASK_21|MSG_MASK_22|MSG_MASK_23|MSG_MASK_24|MSG_MASK_25, + MSG_LVL_MED|MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8|MSG_MASK_9|MSG_MASK_10, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW | MSG_MASK_5 | \ + MSG_MASK_6 | MSG_MASK_7 | MSG_MASK_8, + MSG_LVL_LOW | MSG_MASK_5 | \ + MSG_MASK_6, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_MED | MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8|MSG_MASK_9|MSG_MASK_10| \ + MSG_MASK_11|MSG_MASK_12|MSG_MASK_13|MSG_MASK_14|MSG_MASK_15 | \ + MSG_MASK_16|MSG_MASK_17|MSG_MASK_18|MSG_MASK_19|MSG_MASK_20, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW|MSG_LVL_MED|MSG_LVL_HIGH|MSG_LVL_ERROR|MSG_LVL_FATAL, + MSG_LVL_MED, + MSG_LVL_LOW|MSG_LVL_MED|MSG_LVL_HIGH|MSG_LVL_ERROR|MSG_LVL_FATAL, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_1[] = { + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH +}; + +static const uint32_t msg_bld_masks_2[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED, + MSG_LVL_MED +}; + +static const uint32_t msg_bld_masks_3[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED +}; + +static const uint32_t msg_bld_masks_4[] = { + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_5[] = { + MSG_LVL_HIGH, + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED|MSG_LVL_MED|MSG_MASK_5|MSG_MASK_6|MSG_MASK_7| \ + MSG_MASK_8|MSG_MASK_9, + MSG_LVL_MED +}; + +static const uint32_t msg_bld_masks_6[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_7[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_8[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED +}; + +static const uint32_t msg_bld_masks_9[] = { + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5, + MSG_LVL_MED|MSG_MASK_5 +}; + +static const uint32_t msg_bld_masks_10[] = { + MSG_LVL_MED, + MSG_LVL_ERROR, + MSG_LVL_LOW, + MSG_LVL_LOW|MSG_MASK_5 | \ + MSG_MASK_6|MSG_MASK_7|MSG_MASK_8|MSG_MASK_9|MSG_MASK_10| \ + MSG_MASK_11|MSG_MASK_12|MSG_MASK_13|MSG_MASK_14|MSG_MASK_15| \ + MSG_MASK_16|MSG_MASK_17|MSG_MASK_18|MSG_MASK_19|MSG_MASK_20| \ + MSG_MASK_21|MSG_MASK_22, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW|MSG_MASK_5, + MSG_LVL_LOW|MSG_MASK_0 | MSG_MASK_1 | MSG_MASK_2 | \ + MSG_MASK_3 | MSG_MASK_4 | MSG_MASK_5 | MSG_MASK_6, + MSG_LVL_HIGH, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_11[] = { + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, +}; + +static const uint32_t msg_bld_masks_12[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, +}; + +static const uint32_t msg_bld_masks_13[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, +}; + +static const uint32_t msg_bld_masks_14[] = { + MSG_LVL_MED, + MSG_LVL_MED, +}; + +static const uint32_t msg_bld_masks_15[] = { + MSG_LVL_MED +}; + +static const uint32_t msg_bld_masks_16[] = { + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, +}; + +static const uint32_t msg_bld_masks_17[] = { + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED, + MSG_LVL_MED | MSG_MASK_6 | \ + MSG_MASK_7 | MSG_MASK_8 | MSG_MASK_9, + MSG_LVL_MED | MSG_MASK_5 | \ + MSG_MASK_6 | MSG_MASK_7 | MSG_MASK_8 | MSG_MASK_9 | \ + MSG_MASK_10 | MSG_MASK_11 | MSG_MASK_12 | MSG_MASK_13 | \ + MSG_MASK_14 | MSG_MASK_15 | MSG_MASK_16 | MSG_MASK_17, + MSG_LVL_MED, + MSG_LVL_MED | MSG_MASK_5 | \ + MSG_MASK_6 | MSG_MASK_7 | MSG_MASK_8 | MSG_MASK_9 | \ + MSG_MASK_10 | MSG_MASK_11 | MSG_MASK_12 | MSG_MASK_13 | \ + MSG_MASK_14 | MSG_MASK_15 | MSG_MASK_16 | MSG_MASK_17 | \ + MSG_MASK_18 | MSG_MASK_19 | MSG_MASK_20 | MSG_MASK_21 | \ + MSG_MASK_22, + MSG_LVL_MED, + MSG_LVL_MED, +}; + +static const uint32_t msg_bld_masks_18[] = { + MSG_LVL_LOW, + MSG_LVL_LOW | MSG_MASK_8 | MSG_MASK_9 | MSG_MASK_10 | \ + MSG_MASK_11|MSG_MASK_12|MSG_MASK_13|MSG_MASK_14|MSG_MASK_15 | \ + MSG_MASK_16|MSG_MASK_17|MSG_MASK_18|MSG_MASK_19|MSG_MASK_20, + MSG_LVL_LOW | MSG_MASK_5 | MSG_MASK_6, + MSG_LVL_LOW | MSG_MASK_5, + MSG_LVL_LOW | MSG_MASK_5 | MSG_MASK_6, + MSG_LVL_LOW, + MSG_LVL_LOW | MSG_MASK_5 | \ + MSG_MASK_6 | MSG_MASK_7 | MSG_MASK_8 | MSG_MASK_9, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_19[] = { + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_20[] = { + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW, + MSG_LVL_LOW +}; + +static const uint32_t msg_bld_masks_21[] = { + MSG_LVL_HIGH +}; + +static const uint32_t msg_bld_masks_22[] = { + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH, + MSG_LVL_HIGH +}; + +/* LOG CODES */ + +#define LOG_0 0x0 +#define LOG_1 0x15A7 +#define LOG_2 0x0 +#define LOG_3 0x0 +#define LOG_4 0x4910 +#define LOG_5 0x5420 +#define LOG_6 0x0 +#define LOG_7 0x74FF +#define LOG_8 0x0 +#define LOG_9 0x0 +#define LOG_10 0xA38A +#define LOG_11 0xB201 +#define LOG_12 0x0 +#define LOG_13 0x0 +#define LOG_14 0x0 +#define LOG_15 0x0 + +#define LOG_GET_ITEM_NUM(xx_code) (xx_code & 0x0FFF) + +#endif diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h new file mode 100644 index 0000000..0cc6b4f --- /dev/null +++ b/include/linux/dma-contiguous.h @@ -0,0 +1,119 @@ +#ifndef __LINUX_DMA_CONTIGUOUS_H +#define __LINUX_DMA_CONTIGUOUS_H + +/* + * Contiguous Memory Allocator for DMA mapping framework + * Copyright (c) 2010-2011 by Samsung Electronics. + * Written by: + * Marek Szyprowski <m.szyprowski@samsung.com> + * Michal Nazarewicz <mina86@mina86.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License or (at your optional) any later version of the license. + */ + +/* + * Contiguous Memory Allocator + * + * The Contiguous Memory Allocator (CMA) makes it possible to + * allocate big contiguous chunks of memory after the system has + * booted. + * + * Why is it needed? + * + * Various devices on embedded systems have no scatter-getter and/or + * IO map support and require contiguous blocks of memory to + * operate. They include devices such as cameras, hardware video + * coders, etc. + * + * Such devices often require big memory buffers (a full HD frame + * is, for instance, more then 2 mega pixels large, i.e. more than 6 + * MB of memory), which makes mechanisms such as kmalloc() or + * alloc_page() ineffective. + * + * At the same time, a solution where a big memory region is + * reserved for a device is suboptimal since often more memory is + * reserved then strictly required and, moreover, the memory is + * inaccessible to page system even if device drivers don't use it. + * + * CMA tries to solve this issue by operating on memory regions + * where only movable pages can be allocated from. This way, kernel + * can use the memory for pagecache and when device driver requests + * it, allocated pages can be migrated. + * + * Driver usage + * + * CMA should not be used by the device drivers directly. It is + * only a helper framework for dma-mapping subsystem. + * + * For more information, see kernel-docs in drivers/base/dma-contiguous.c + */ + +#ifdef __KERNEL__ + +struct cma; +struct page; +struct device; + +#ifdef CONFIG_DMA_CMA + +/* + * There is always at least global CMA area and a few optional device + * private areas configured in kernel .config. + */ +#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS) + +extern struct cma *dma_contiguous_default_area; + +void dma_contiguous_reserve(phys_addr_t addr_limit); +int dma_declare_contiguous(struct device *dev, unsigned long size, + phys_addr_t base, phys_addr_t limit); + +int dma_prepare_alloc_from_contiguous(struct device *dev, int count, + unsigned int order); +struct page *dma_alloc_from_contiguous(struct device *dev, int count, + unsigned int order); +bool dma_release_from_contiguous(struct device *dev, struct page *pages, + int count); + +#else + +#define MAX_CMA_AREAS (0) + +static inline void dma_contiguous_reserve(phys_addr_t limit) { } + +static inline +int dma_declare_contiguous(struct device *dev, unsigned long size, + phys_addr_t base, phys_addr_t limit) +{ + return -ENOSYS; +} + +static inline +int dma_prepare_alloc_from_contiguous(struct device *dev, int count, + unsigned int order) +{ + return -ENOSYS; +} + +static inline +struct page *dma_alloc_from_contiguous(struct device *dev, int count, + unsigned int order) +{ + return NULL; +} + +static inline +bool dma_release_from_contiguous(struct device *dev, struct page *pages, + int count) +{ + return false; +} + +#endif + +#endif + +#endif diff --git a/include/linux/earlysuspend.h b/include/linux/earlysuspend.h index 336a07b..336a07b 100755..100644 --- a/include/linux/earlysuspend.h +++ b/include/linux/earlysuspend.h diff --git a/include/linux/extcon.h b/include/linux/extcon.h index f912294..71b2b2e 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -72,6 +72,7 @@ enum extcon_cable_name { EXTCON_SPDIF_OUT, EXTCON_VIDEO_IN, EXTCON_VIDEO_OUT, + EXTCON_MECHANICAL, }; extern const char *extcon_cable_name[]; diff --git a/include/linux/exynos_audio.h b/include/linux/exynos_audio.h new file mode 100644 index 0000000..b510119 --- /dev/null +++ b/include/linux/exynos_audio.h @@ -0,0 +1,55 @@ +/* + * exynos_sound.h - audio platform data for exynos + * + * Copyright (C) 2012 Samsung Electrnoics + * Uk Kim <w0806.kim@samsung.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _LINUX_EXYNOS_T0_SOUND_H +#define _LINUX_EXYNOS_T0_SOUND_H + +struct exynos_sound_platform_data { + void (*set_lineout_switch) (int on); + void (*set_ext_main_mic) (int on); + void (*set_ext_sub_mic) (int on); + int (*get_ground_det_value) (void); + int (*get_ground_det_irq_num) (void); +#if defined(CONFIG_SND_DUOS_MODEM_SWITCH) + void (*set_modem_switch) (int on); +#endif + int dcs_offset_l; + int dcs_offset_r; +}; + +#ifdef CONFIG_EXYNOS_SOUND_PLATFORM_DATA + +int exynos_sound_set_platform_data( + const struct exynos_sound_platform_data *data); + +#else + +static inline +int exynos_sound_set_platform_data( + const struct exynos_sound_platform_data *data) +{ + return -ENOSYS; +} + +#endif + +const struct exynos_sound_platform_data *exynos_sound_get_platform_data(void); +#endif diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index f0c0e8a..9da5dad 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -351,8 +351,12 @@ static inline void __ftrace_enabled_restore(int enabled) extern void trace_preempt_on(unsigned long a0, unsigned long a1); extern void trace_preempt_off(unsigned long a0, unsigned long a1); #else - static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { } - static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { } +/* + * Use defines instead of static inlines because some arches will make code out + * of the CALLER_ADDR, when we really want these to be a real nop. + */ +# define trace_preempt_on(a0, a1) do { } while (0) +# define trace_preempt_off(a0, a1) do { } while (0) #endif #ifdef CONFIG_FTRACE_MCOUNT_RECORD diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 15c2623..7b37966 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -23,6 +23,9 @@ struct vm_area_struct; #define ___GFP_REPEAT 0x400u #define ___GFP_NOFAIL 0x800u #define ___GFP_NORETRY 0x1000u +#ifdef CONFIG_DMA_CMA +#define ___GFP_CMA 0x2000u +#endif #define ___GFP_COMP 0x4000u #define ___GFP_ZERO 0x8000u #define ___GFP_NOMEMALLOC 0x10000u @@ -50,7 +53,13 @@ struct vm_area_struct; #define __GFP_HIGHMEM ((__force gfp_t)___GFP_HIGHMEM) #define __GFP_DMA32 ((__force gfp_t)___GFP_DMA32) #define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* Page is movable */ +#ifndef CONFIG_DMA_CMA #define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE) +#else +#define __GFP_CMA ((__force gfp_t)___GFP_CMA) +#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE| \ + __GFP_CMA) +#endif /* * Action modifiers - doesn't change the zoning * @@ -122,7 +131,11 @@ struct vm_area_struct; #endif /* This mask makes up all the page movable related flags */ +#ifndef CONFIG_DMA_CMA #define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) +#else +#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE|__GFP_CMA) +#endif /* Control page allocator reclaim behavior */ #define GFP_RECLAIM_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\ @@ -155,8 +168,14 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags) return MIGRATE_UNMOVABLE; /* Group based on mobility */ +#ifndef CONFIG_DMA_CMA return (((gfp_flags & __GFP_MOVABLE) != 0) << 1) | ((gfp_flags & __GFP_RECLAIMABLE) != 0); +#else + return (((gfp_flags & __GFP_MOVABLE) != 0) << 1) | + (((gfp_flags & __GFP_CMA) != 0) << 1) | + ((gfp_flags & __GFP_RECLAIMABLE) != 0); +#endif } #ifdef CONFIG_HIGHMEM @@ -374,4 +393,13 @@ extern gfp_t gfp_allowed_mask; extern void pm_restrict_gfp_mask(void); extern void pm_restore_gfp_mask(void); +#ifdef CONFIG_DMA_CMA +/* The below functions must be run on a range from a single zone. */ +extern int alloc_contig_range(unsigned long start, unsigned long end, + unsigned migratetype); +extern void free_contig_range(unsigned long pfn, unsigned nr_pages); +/* CMA stuff */ +extern void init_cma_reserved_pageblock(struct page *page); +#endif + #endif /* __LINUX_GFP_H */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 3a93f73..d6a3a55 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -175,9 +175,24 @@ static inline struct page * alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma, unsigned long vaddr) { +#ifndef CONFIG_DMA_CMA return __alloc_zeroed_user_highpage(__GFP_MOVABLE, vma, vaddr); +#else + return __alloc_zeroed_user_highpage(__GFP_MOVABLE|__GFP_CMA, vma, + vaddr); +#endif } +#ifdef CONFIG_DMA_CMA +static inline struct page * +alloc_zeroed_user_highpage_movable_cma(struct vm_area_struct *vma, + unsigned long vaddr) +{ + return __alloc_zeroed_user_highpage(__GFP_MOVABLE|__GFP_CMA, vma, + vaddr); +} +#endif + static inline void clear_highpage(struct page *page) { void *kaddr = kmap_atomic(page, KM_USER0); diff --git a/include/linux/i2c/fm34_we395.h b/include/linux/i2c/fm34_we395.h index 718209d..25de511 100644 --- a/include/linux/i2c/fm34_we395.h +++ b/include/linux/i2c/fm34_we395.h @@ -22,7 +22,7 @@ #ifndef __FEM34_WE395_PDATA_H__ #define __FM34_WE395_PDATA_H__ -#if defined(CONFIG_MACH_C1_KOR_LGT) || defined(CONFIG_MACH_C1VZW) +#if defined(CONFIG_MACH_C1_KOR_LGT) int fm34_set_mode(int mode); #endif diff --git a/include/linux/i2c/mxt1664s.h b/include/linux/i2c/mxt1664s.h index e8795af..4211787 100644 --- a/include/linux/i2c/mxt1664s.h +++ b/include/linux/i2c/mxt1664s.h @@ -88,6 +88,10 @@ enum { RESERVED_T0 = 0, RESERVED_T255 = 255, }; +struct mxt_callbacks { + void (*inform_charger)(struct mxt_callbacks *, bool); +}; + struct mxt_platform_data { int max_finger_touches; int gpio_read_done; @@ -102,7 +106,10 @@ struct mxt_platform_data { int max_w; int (*power_on) (void); int (*power_off) (void); + int (*power_reset) (void); + u8 *(*register_cb)(struct mxt_callbacks *); u8 boot_address; + const char *config_version; }; #endif /* */ diff --git a/include/linux/i2c/mxt224_grande.h b/include/linux/i2c/mxt224_grande.h new file mode 100644 index 0000000..ffea3f1 --- /dev/null +++ b/include/linux/i2c/mxt224_grande.h @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + */ + +#ifndef __MXT224_H__ +#define __MXT224_H__ + +//#define MXT224_DEV_NAME "Atmel MXT224" + +#define MXT224_DEV_NAME "qt602240_ts" + + +#define MXT224_THRESHOLD 40 +#define MXT224E_THRESHOLD 50 +#define MXT224_MAX_MT_FINGERS 10 + +#define MXT_OREINT 10 +#define MXT224_ORIENT_SWAP_NN 1 +#define MXT224_ORIENT_SWAP_XY 7 + + + +#ifdef CONFIG_TOUCHSCREEN_MXT768E +enum { + RESERVED_T0 = 0, + RESERVED_T1, + DEBUG_DELTAS_T2, + DEBUG_REFERENCES_T3, + DEBUG_SIGNALS_T4, + GEN_MESSAGEPROCESSOR_T5, + GEN_COMMANDPROCESSOR_T6, + GEN_POWERCONFIG_T7, + GEN_ACQUISITIONCONFIG_T8, + TOUCH_MULTITOUCHSCREEN_T9, + TOUCH_SINGLETOUCHSCREEN_T10, + TOUCH_XSLIDER_T11, + TOUCH_YSLIDER_T12, + TOUCH_XWHEEL_T13, + TOUCH_YWHEEL_T14, + TOUCH_KEYARRAY_T15, + PROCG_SIGNALFILTER_T16, + PROCI_LINEARIZATIONTABLE_T17, + SPT_COMCONFIG_T18, + RESERVED_T19, + RESERVED_T20, + RESERVED_T21, + RESERVED_T22, + RESERVED_T23, + PROCI_ONETOUCHGESTUREPROCESSOR_T24, + SPT_SELFTEST_T25, + DEBUG_CTERANGE_T26, + PROCI_TWOTOUCHGESTUREPROCESSOR_T27, + RESERVED_T28, + SPT_GPI_T29, + SPT_GATE_T30, + TOUCH_KEYSET_T31, + TOUCH_XSLIDERSET_T32, + RESERVED_T33, + GEN_MESSAGEBLOCK_T34, + SPT_GENERICDATA_T35, + RESERVED_T36, + DEBUG_DIAGNOSTIC_T37, + SPARE_T38, + SPARE_T39, + PROCI_GRIPSUPPRESSION_T40, + SPARE_T41, + PROCI_TOUCHSUPPRESSION_T42, + SPT_DIGITIZER_T43, + SPARE_T44, + SPARE_T45, + SPT_CTECONFIG_T46, + SPARE_T47, + PROCG_NOISESUPPRESSION_T48, + SPARE_T49, + SPARE_T50, + RESERVED_T255 = 255, +}; +#else +enum { + RESERVED_T0 = 0, + RESERVED_T1, + DEBUG_DELTAS_T2, + DEBUG_REFERENCES_T3, + DEBUG_SIGNALS_T4, + GEN_MESSAGEPROCESSOR_T5, + GEN_COMMANDPROCESSOR_T6, + GEN_POWERCONFIG_T7, + GEN_ACQUISITIONCONFIG_T8, + TOUCH_MULTITOUCHSCREEN_T9, + TOUCH_SINGLETOUCHSCREEN_T10, + TOUCH_XSLIDER_T11, + TOUCH_YSLIDER_T12, + TOUCH_XWHEEL_T13, + TOUCH_YWHEEL_T14, + TOUCH_KEYARRAY_T15, + PROCG_SIGNALFILTER_T16, + PROCI_LINEARIZATIONTABLE_T17, + SPT_COMCONFIG_T18, + SPT_GPIOPWM_T19, + PROCI_GRIPFACESUPPRESSION_T20, + RESERVED_T21, + PROCG_NOISESUPPRESSION_T22, + TOUCH_PROXIMITY_T23, + PROCI_ONETOUCHGESTUREPROCESSOR_T24, + SPT_SELFTEST_T25, + DEBUG_CTERANGE_T26, + PROCI_TWOTOUCHGESTUREPROCESSOR_T27, + SPT_CTECONFIG_T28, + SPT_GPI_T29, + SPT_GATE_T30, + TOUCH_KEYSET_T31, + TOUCH_XSLIDERSET_T32, + RESERVED_T33, + GEN_MESSAGEBLOCK_T34, + SPT_GENERICDATA_T35, + RESERVED_T36, + DEBUG_DIAGNOSTIC_T37, + SPT_USERDATA_T38, + SPARE_T39, + PROCI_GRIPSUPPRESSION_T40, + SPARE_T41, + PROCI_TOUCHSUPPRESSION_T42, + SPARE_T43, + SPARE_T44, + SPARE_T45, + SPT_CTECONFIG_T46, + PROCI_STYLUS_T47, + PROCG_NOISESUPPRESSION_T48, + SPARE_T49, + SPARE_T50, + RESERVED_T255 = 255, +}; +#endif + +struct mxt224_platform_data { + int max_finger_touches; + const u8 **config; + const u8 **config_e; + const u8 *t46_ta_cfg; + const u8 *t48_ta_cfg; + int gpio_read_done; + int min_x; + int max_x; + int min_y; + int max_y; + int min_z; + int max_z; + int min_w; + int max_w; + void (*power_on)(void); + void (*power_off)(void); + void (*register_cb)(void*); + void (*read_ta_status)(void*); +// void (*orient_barnch)(int orient_swap);/*TSP TA noise 201107251133*/ +}; + + +typedef enum +{ + QT_PAGE_UP = 0x01, + QT_PAGE_DOWN = 0x02, + QT_DELTA_MODE = 0x10, + QT_REFERENCE_MODE = 0x11, + QT_CTE_MODE = 0x31 +}diagnostic_debug_command; + + +//110927 gumi noise +typedef struct +{ + bool median_on_flag; + bool mferr_setting; + uint8_t mferr_count; + uint8_t t46_actvsyncsperx_for_mferr; + uint8_t t48_mfinvlddiffthr_for_mferr; + uint8_t t48_mferrorthr_for_mferr; + uint8_t t48_thr_for_mferr; + uint8_t t48_movfilter_for_mferr; +}__packed t48_median_config_t; + + + +#endif diff --git a/include/linux/i2c/mxt224s_grande.h b/include/linux/i2c/mxt224s_grande.h new file mode 100644 index 0000000..b7d0938 --- /dev/null +++ b/include/linux/i2c/mxt224s_grande.h @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + */ + +#ifndef __MXT_H__ +#define __MXT_H__ + +#define MXT224_MAX_MT_FINGERS 10 +#define MXT_DEV_NAME "Atmel MXT224S" +#define CHECK_ANTITOUCH 1 + +enum { RESERVED_T0 = 0, + RESERVED_T1, + DEBUG_DELTAS_T2, + DEBUG_REFERENCES_T3, + DEBUG_SIGNALS_T4, + GEN_MESSAGEPROCESSOR_T5, + GEN_COMMANDPROCESSOR_T6, + GEN_POWERCONFIG_T7, + GEN_ACQUISITIONCONFIG_T8, + TOUCH_MULTITOUCHSCREEN_T9, + TOUCH_SINGLETOUCHSCREEN_T10, + TOUCH_XSLIDER_T11, + TOUCH_YSLIDER_T12, + TOUCH_XWHEEL_T13, + TOUCH_YWHEEL_T14, + TOUCH_KEYARRAY_T15, + PROCG_SIGNALFILTER_T16, + PROCI_LINEARIZATIONTABLE_T17, + SPT_COMCONFIG_T18, + SPT_GPIOPWM_T19, + PROCI_GRIPFACESUPPRESSION_T20, + RESERVED_T21, + PROCG_NOISESUPPRESSION_T22, + TOUCH_PROXIMITY_T23, + PROCI_ONETOUCHGESTUREPROCESSOR_T24, + SPT_SELFTEST_T25, + DEBUG_CTERANGE_T26, + PROCI_TWOTOUCHGESTUREPROCESSOR_T27, + SPT_CTECONFIG_T28, + SPT_GPI_T29, + SPT_GATE_T30, + TOUCH_KEYSET_T31, + TOUCH_XSLIDERSET_T32, + RESERVED_T33, + GEN_MESSAGEBLOCK_T34, + SPT_GENERICDATA_T35, + RESERVED_T36, + DEBUG_DIAGNOSTIC_T37, + SPT_USERDATA_T38, + SPARE_T39, + PROCI_GRIPSUPPRESSION_T40, + SPARE_T41, + PROCI_TOUCHSUPPRESSION_T42, + SPT_DIGITIZER_T43, + MESSAGECOUNT_T44, + SPARE_T45, + SPT_CTECONFIG_T46, + PROCI_STYLUS_T47, + PROCG_NOISESUPPRESSION_T48, + SPARE_T49, + SPARE_T50, + SPARE_T51, + TOUCH_PROXIMITY_KEY_T52, + GEN_DATASOURCE_T53, + SPARE_T54, + PROCI_ADAPTIVETHRESHOLD_T55, + PROCI_SHIELDLESS_T56, + PROCI_EXTRATOUCHSCREENDATA_T57, + SPARE_T58, + SPARE_T59, + SPARE_T60, + SPT_TIMER_T61, + PROCG_NOISESUPPRESSION_T62, + RESERVED_T255 = 255, +}; +struct mxt224s_platform_data { + int max_finger_touches; + const u8 **config; + const u8 **config_e; + int gpio_read_done; + int min_x; + int max_x; + int min_y; + int max_y; + int min_z; + int max_z; + int min_w; + int max_w; + u8 chrgtime_batt; + u8 chrgtime_charging; + u8 atchcalst; + u8 atchcalsthr; + u8 tchthr_batt; + u8 tchthr_charging; + u8 tchthr_batt_e; + u8 tchthr_charging_e; + u8 calcfg_batt_e; + u8 calcfg_charging_e; + u8 atchcalsthr_e; + u8 atchfrccalthr_e; + u8 atchfrccalratio_e; + u8 idlesyncsperx_batt; + u8 idlesyncsperx_charging; + u8 actvsyncsperx_batt; + u8 actvsyncsperx_charging; + u8 idleacqint_batt; + u8 idleacqint_charging; + u8 actacqint_batt; + u8 actacqint_charging; + u8 xloclip_batt; + u8 xloclip_charging; + u8 xhiclip_batt; + u8 xhiclip_charging; + u8 yloclip_batt; + u8 yloclip_charging; + u8 yhiclip_batt; + u8 yhiclip_charging; + u8 xedgectrl_batt; + u8 xedgectrl_charging; + u8 xedgedist_batt; + u8 xedgedist_charging; + u8 yedgectrl_batt; + u8 yedgectrl_charging; + u8 yedgedist_batt; + u8 yedgedist_charging; + u8 tchhyst_batt; + u8 tchhyst_charging; +#if CHECK_ANTITOUCH + u8 check_antitouch; + u8 check_timer; + u8 check_autocal; + u8 check_calgood; +#endif + const u8 *t9_config_batt; + const u8 *t9_config_chrg; + const u8 *t56_config_batt; + const u8 *t56_config_chrg; + const u8 *t62_config_batt; + const u8 *t62_config_chrg; + void (*power_on) (void); + void (*power_off) (void); + void (*register_cb) (void *); + void (*read_ta_status) (void *); + const u8 *config_fw_version; +}; +typedef enum + { MXT_PAGE_UP = 0x01, MXT_PAGE_DOWN = 0x02, MXT_DELTA_MODE = + 0x10, MXT_REFERENCE_MODE = 0x11, MXT_CTE_MODE = 0x31 +} diagnostic_debug_command; + +#endif /* */ diff --git a/include/linux/i2c/mxt540e.h b/include/linux/i2c/mxt540e.h index 6c34a39..38094c8 100644 --- a/include/linux/i2c/mxt540e.h +++ b/include/linux/i2c/mxt540e.h @@ -129,5 +129,7 @@ enum { int get_tsp_status(void); extern struct class *sec_class; - +#if defined(CONFIG_MACH_T0) +extern bool is_cable_attached; +#endif #endif diff --git a/include/linux/i2c/mxt540s.h b/include/linux/i2c/mxt540s.h new file mode 100644 index 0000000..ba687ed --- /dev/null +++ b/include/linux/i2c/mxt540s.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + */ + +#ifndef __MXT_H__ +#define __MXT_H__ + +#define MXT_DEV_NAME "Atmel MXT540S" + +#define MXT_540S_SW_RESET_TIME 300 /* msec */ +#define MXT_540S_HW_RESET_TIME 300 /* msec */ +#define MXT_540S_FW_RESET_TIME 500 /* msec */ + +enum { RESERVED_T0 = 0, + RESERVED_T1, + DEBUG_DELTAS_T2, + DEBUG_REFERENCES_T3, + DEBUG_SIGNALS_T4, + GEN_MESSAGEPROCESSOR_T5, + GEN_COMMANDPROCESSOR_T6, + GEN_POWERCONFIG_T7, + GEN_ACQUISITIONCONFIG_T8, + TOUCH_MULTITOUCHSCREEN_T9, + TOUCH_SINGLETOUCHSCREEN_T10, + TOUCH_XSLIDER_T11, + TOUCH_YSLIDER_T12, + TOUCH_XWHEEL_T13, + TOUCH_YWHEEL_T14, + TOUCH_KEYARRAY_T15, + PROCG_SIGNALFILTER_T16, + PROCI_LINEARIZATIONTABLE_T17, + SPT_COMCONFIG_T18, + SPT_GPIOPWM_T19, + PROCI_GRIPFACESUPPRESSION_T20, + RESERVED_T21, + PROCG_NOISESUPPRESSION_T22, + TOUCH_PROXIMITY_T23, + PROCI_ONETOUCHGESTUREPROCESSOR_T24, + SPT_SELFTEST_T25, + DEBUG_CTERANGE_T26, + PROCI_TWOTOUCHGESTUREPROCESSOR_T27, + SPT_CTECONFIG_T28, + SPT_GPI_T29, + SPT_GATE_T30, + TOUCH_KEYSET_T31, + TOUCH_XSLIDERSET_T32, + RESERVED_T33, + GEN_MESSAGEBLOCK_T34, + SPT_GENERICDATA_T35, + RESERVED_T36, + DEBUG_DIAGNOSTIC_T37, + SPT_USERDATA_T38, + SPARE_T39, + PROCI_GRIPSUPPRESSION_T40, + SPARE_T41, + PROCI_TOUCHSUPPRESSION_T42, + SPT_DIGITIZER_T43, + SPARE_T44, + SPARE_T45, + SPT_CTECONFIG_T46, + PROCI_STYLUS_T47, + PROCG_NOISESUPPRESSION_T48, + SPARE_T49, + SPARE_T50, + SPARE_T51, + TOUCH_PROXIMITY_KEY_T52, + GEN_DATASOURCE_T53, + SPARE_T54, + ADAPTIVE_T55, + PROCI_SHIELDLESS_T56, + PROCI_EXTRATOUCHSCREENDATA_T57, + SPARE_T58, + SPARE_T59, + SPARE_T60, + SPT_TIMER_T61, + PROCG_NOISESUPPRESSION_T62, + PROCI_ACTIVESTYLUS_T63, + RESERVED_T255 = 255, +}; + +struct mxt_callbacks { + void (*inform_charger)(struct mxt_callbacks *, bool); +}; + +struct mxt_platform_data { + int max_finger_touches; + int gpio_read_done; + const u8 **config; + int min_x; + int max_x; + int min_y; + int max_y; + int min_z; + int max_z; + int min_w; + int max_w; + int (*power_on) (void); + int (*power_off) (void); + int (*power_reset) (void); + void (*register_cb) (void *); + u8 boot_address; + const char *firmware_name; +}; + +#endif /* */ diff --git a/include/linux/i2c/si47xx_common.h b/include/linux/i2c/si47xx_common.h new file mode 100644 index 0000000..456e623 --- /dev/null +++ b/include/linux/i2c/si47xx_common.h @@ -0,0 +1,60 @@ +/* + * Si47xx_common.h -- Si47xx FM Radio driver + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _COMMON_H +#define _COMMON_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/slab.h> +#include <mach/gpio.h> + +#define error(fmt, arg...) printk(KERN_CRIT fmt "\n", ##arg) + +#ifdef Si47xx_DEBUG +#define debug(fmt, arg...) printk(KERN_CRIT "--------" fmt "\n", ##arg) +#else +#define debug(fmt, arg...) +#endif + +#define FM_PORT "GPX13" + +#define SI47XX_VOLUME_NUM 16 + +struct si47xx_platform_data { + u16 rx_vol[SI47XX_VOLUME_NUM]; + void (*power) (int on); +}; + +struct Si47xx_data { + struct si47xx_platform_data *pdata; + struct i2c_client *client; + struct device *dev; +}; + + +/* VNVS:28-OCT'09 : For testing FM tune and seek operation status */ +#define TEST_FM + +/* VNVS:7-JUNE'10 : RDS Interrupt ON Always */ +/* (Enabling interrupt when RDS is enabled) */ +#define RDS_INTERRUPT_ON_ALWAYS + +/* VNVS:18-JUN'10 : For testing RDS */ +/* Enable only for debugging RDS */ +/* #define RDS_TESTING */ +#ifdef RDS_TESTING +#define debug_rds(fmt, arg...) printk(KERN_CRIT "--------" fmt "\n", ##arg) +#define GROUP_TYPE_2A (2 * 2 + 0) +#define GROUP_TYPE_2B (2 * 2 + 1) +#else +#define debug_rds(fmt, arg...) +#endif + +extern wait_queue_head_t Si47xx_waitq; +#endif diff --git a/include/linux/i2c/touchkey_i2c.h b/include/linux/i2c/touchkey_i2c.h index addd763..71ec0b1 100644 --- a/include/linux/i2c/touchkey_i2c.h +++ b/include/linux/i2c/touchkey_i2c.h @@ -29,7 +29,8 @@ || defined(CONFIG_TARGET_LOCALE_NA)\ || defined(CONFIG_MACH_M0)\ || defined(CONFIG_MACH_C1)\ - || defined(CONFIG_MACH_C1VZW) + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_T0) #define TK_CMD_LED_ON 0x10 #define TK_CMD_LED_OFF 0x20 #else @@ -50,36 +51,36 @@ #elif defined(CONFIG_MACH_C1_NA_USCC_REV05) #define TK_FIRMWARE_VER 0x0E #define TK_MODULE_VER 0x08 -#elif defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1VZW)\ - || defined(CONFIG_MACH_C1) +#elif defined(CONFIG_MACH_M0)\ + || defined(CONFIG_MACH_C1)\ + || defined(CONFIG_MACH_M3) #define TK_FIRMWARE_VER 0x06 #define TK_MODULE_VER 0x05 -#elif defined(CONFIG_MACH_S2PLUS) -#define TK_FIRMWARE_VER 0x04 -#define TK_MODULE_VER 0x00 +#elif defined(CONFIG_MACH_T0) +#define TK_FIRMWARE_VER 0x11 +#define TK_MODULE_VER 0x08 #else #define TK_FIRMWARE_VER 0x04 #define TK_MODULE_VER 0x00 #endif /* LDO Regulator */ -#if defined(CONFIG_MACH_S2PLUS) -#define TK_REGULATOR_NAME "3_touch_1.8v" -#elif defined(CONFIG_MACH_M0)\ +#if defined(CONFIG_MACH_M0)\ || defined(CONFIG_MACH_C1)\ - || defined(CONFIG_MACH_C1VZW) + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_T0) #define TK_REGULATOR_NAME "touchkey" #else #define TK_REGULATOR_NAME "touch" #endif /* LED LDO Type*/ -#if defined(CONFIG_MACH_S2PLUS) \ - || defined(CONFIG_MACH_M0)\ +#if defined(CONFIG_MACH_M0)\ || defined(CONFIG_MACH_C1_KOR_SKT)\ || defined(CONFIG_MACH_C1_KOR_KT)\ - || defined(CONFIG_MACH_C1VZW)\ - || defined(CONFIG_MACH_C1) + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_C1)\ + || defined(CONFIG_MACH_T0) #define LED_LDO_WITH_EN_PIN #else #define LED_LDO_WITH_REGULATOR @@ -91,13 +92,16 @@ || defined(CONFIG_MACH_Q1_BD)\ || defined(CONFIG_MACH_M0)\ || defined(CONFIG_MACH_C1)\ - || defined(CONFIG_MACH_C1VZW) + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_T0) #define TK_HAS_AUTOCAL #endif /* Generalized SMBus access */ -#if defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1VZW)\ - || defined(CONFIG_MACH_C1) +#if defined(CONFIG_MACH_M0)\ + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_C1)\ + || defined(CONFIG_MACH_T0) #define TK_USE_GENERAL_SMBUS #endif @@ -107,16 +111,42 @@ || defined(CONFIG_TARGET_LOCALE_NA)\ || defined(CONFIG_MACH_M0)\ || defined(CONFIG_MACH_C1)\ - || defined(CONFIG_MACH_C1VZW) + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_T0) #define TK_HAS_FIRMWARE_UPDATE #endif -#if defined(CONFIG_MACH_M0_CHNOPEN) || defined(CONFIG_MACH_M0_HKTW) +#if defined(CONFIG_TARGET_LOCALE_NAATT) +#define TK_USE_4KEY_TYPE_ATT +#elif defined(CONFIG_MACH_LOCALE_NA) \ + || defined(CONFIG_MACH_U1_NA_SPR) \ + || defined(CONFIG_MACH_U1_NA_USCC) +#define TK_USE_4KEY_TYPE_NA +#elif defined(CONFIG_MACH_M0) \ + || defined(CONFIG_MACH_C1) \ + || defined(CONFIG_MACH_M3)\ + || defined(CONFIG_MACH_T0) +#define TK_USE_2KEY_TYPE_M0 +#else +#define TK_USE_2KEY_TYPE_U1 +#endif + +#if defined(TK_USE_4KEY_TYPE_ATT)\ + || defined(TK_USE_4KEY_TYPE_NA) +#define TK_USE_4KEY +#elif defined(TK_USE_2KEY_TYPE_M0)\ + || defined(TK_USE_2KEY_TYPE_U1) +#define TK_USE_2KEY +#endif + +#if defined(CONFIG_MACH_M0_CHNOPEN)\ + || defined(CONFIG_MACH_M0_HKTW) #define TOUCHKEY_FW_UPDATEABLE_HW_REV 10 #elif defined(CONFIG_MACH_M0) #define TOUCHKEY_FW_UPDATEABLE_HW_REV 11 #elif defined(CONFIG_MACH_C1) -#if defined(CONFIG_MACH_C1_KOR_SKT) || defined(CONFIG_MACH_C1_KOR_KT) +#if defined(CONFIG_MACH_C1_KOR_SKT)\ + || defined(CONFIG_MACH_C1_KOR_KT) #define TOUCHKEY_FW_UPDATEABLE_HW_REV 8 #elif defined(CONFIG_MACH_C1_KOR_LGT) #define TOUCHKEY_FW_UPDATEABLE_HW_REV 5 diff --git a/include/linux/init.h b/include/linux/init.h index 9146f39..5e869b7 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -199,6 +199,10 @@ extern int initcall_debug; #define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s) #define arch_initcall(fn) __define_initcall("3",fn,3) #define arch_initcall_sync(fn) __define_initcall("3s",fn,3s) +#ifdef CONFIG_FAST_RESUME +#define beforeresume_initcall(fn) __define_initcall("bresume",fn,bresume) +#define resume_initcall(fn) __define_initcall("resume",fn,resume) +#endif #define subsys_initcall(fn) __define_initcall("4",fn,4) #define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s) #define fs_initcall(fn) __define_initcall("5",fn,5) diff --git a/include/linux/input.h b/include/linux/input.h index 92d2741..d75f6f5 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -129,6 +129,9 @@ struct input_keymap_entry { #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ +#define EVIOCGSUSPENDBLOCK _IOR('E', 0x91, int) /* get suspend block enable */ +#define EVIOCSSUSPENDBLOCK _IOW('E', 0x91, int) /* set suspend block enable */ + /* * Device properties and quirks */ @@ -438,6 +441,14 @@ struct input_keymap_entry { #define KEY_WIMAX 246 #define KEY_RFKILL 247 /* Key that controls all radios */ +#define KEY_POUND 248 +#define KEY_STAR 249 +#define KEY_NETWORK 250 + +#define KEY_FOLDER_OPEN 251 /*only use Grande CHN CTC */ +#define KEY_FOLDER_CLOSE 252 /*only use Grande CHN CTC */ +#define KEY_3G 253 /*only use Grande CHN CTC */ + /* Code 255 is reserved for special needs of AT keyboard driver */ #define BTN_MISC 0x100 @@ -673,6 +684,14 @@ struct input_keymap_entry { #define KEY_CAMERA_LEFT 0x219 #define KEY_CAMERA_RIGHT 0x21a +#define KEY_DMB_ANT_DET_UP 0x21b +#define KEY_DMB_ANT_DET_DOWN 0x21c + +#define KEY_PEN_PDCT 0x230 /* E-PEN PDCT flag*/ + +#define KEY_FAKE_PWR 0x240 /* Fake Power off flag*/ + + #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 @@ -816,6 +835,7 @@ struct input_keymap_entry { #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ +#define SW_PEN_INSERT 0x0e /* set = pen out */ #define SW_MAX 0x0f #define SW_CNT (SW_MAX+1) diff --git a/include/linux/input/sec-input-bridge.h b/include/linux/input/sec-input-bridge.h new file mode 100644 index 0000000..0e5aa59 --- /dev/null +++ b/include/linux/input/sec-input-bridge.h @@ -0,0 +1,36 @@ +#ifndef LINUX_INPUT_SEC_INPUT_BRIDGE_H +#define LINUX_INPUT_SEC_INPUT_BRIDGE_H + +#include <linux/kobject.h> + +enum mkey_check_option { + MKEY_CHECK_AUTO, + MKEY_CHECK_AWAYS +}; + +struct sec_input_bridge_mkey { + unsigned int type; + unsigned int code; + enum mkey_check_option option; +}; + +struct sec_input_bridge_mmap { + const struct sec_input_bridge_mkey *mkey_map; + unsigned int num_mkey; + const char *uevent_env_str; + const char *uevent_env_value; + const unsigned char enable_uevent; + void (*pre_event_func)(void *event_data); + enum kobject_action uevent_action; +}; + +struct sec_input_bridge_platform_data { + void *event_data; + + const struct sec_input_bridge_mmap *mmap; + unsigned int num_map; + void (*lcd_warning_func)(void); +}; + +#endif /* LINUX_INPUT_SEC_INPUT_BRIDGE_H */ + diff --git a/include/linux/ir_remote_con_mc96.h b/include/linux/ir_remote_con_mc96.h new file mode 100644 index 0000000..8ab2430 --- /dev/null +++ b/include/linux/ir_remote_con_mc96.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _IR_REMOTE_CON_H_ +#define _IR_REMOTE_CON_H_ + +struct mc96_platform_data { + int str1; + int str2; + char char_name; + void (*ir_wake_en)(bool onoff); + void (*ir_remote_init) (void); + void(*ir_vdd_onoff)(bool onoff); +}; + +extern struct class *sec_class; + +#endif /* _IR_REMOTE_CON_H_ */ diff --git a/include/linux/k3g.h b/include/linux/k3g.h new file mode 100644 index 0000000..636fbe2 --- /dev/null +++ b/include/linux/k3g.h @@ -0,0 +1,263 @@ +/* + * k3g.h - ST Microelectronics three-axis gyroscope sensor + * + * Copyright (c) 2010 Samsung Eletronics + * Donggeun Kim <dg77.kim@samsung.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _K3G_H_ +#define _K3G_H_ + +#define K3G_WHO_AM_I 0x0f +#define K3G_CTRL_REG1 0x20 +#define K3G_CTRL_REG2 0x21 +#define K3G_CTRL_REG3 0x22 +#define K3G_CTRL_REG4 0x23 +#define K3G_CTRL_REG5 0x24 +#define K3G_REFERENCE 0x25 +#define K3G_OUT_TEMP 0x26 +#define K3G_STATUS_REG 0x27 +#define K3G_OUT_X_L 0x28 +#define K3G_OUT_X_H 0x29 +#define K3G_OUT_Y_L 0x2a +#define K3G_OUT_Y_H 0x2b +#define K3G_OUT_Z_L 0x2c +#define K3G_OUT_Z_H 0x2d +#define K3G_FIFO_CTRL_REG 0x2e +#define K3G_FIFO_SRC_REG 0x2f +#define K3G_INT1_CFG_REG 0x30 +#define K3G_INT1_SRC_REG 0x31 +#define K3G_INT1_THS_XH 0x32 +#define K3G_INT1_THS_XL 0x33 +#define K3G_INT1_THS_YH 0x34 +#define K3G_INT1_THS_YL 0x35 +#define K3G_INT1_THS_ZH 0x36 +#define K3G_INT1_THS_ZL 0x37 +#define K3G_INT1_DURATION_REG 0x38 + +#define K3G_MULTI_OUT_X_L 0xa8 + +#define K3G_DATA_RATE_SHIFT 6 +#define K3G_DATA_RATE_105HZ ((0x0) << K3G_DATA_RATE_SHIFT) +#define K3G_DATA_RATE_210HZ ((0x1) << K3G_DATA_RATE_SHIFT) +#define K3G_DATA_RATE_420HZ ((0x2) << K3G_DATA_RATE_SHIFT) +#define K3G_DATA_RATE_840HZ ((0x3) << K3G_DATA_RATE_SHIFT) +#define K3G_BANDWIDTH_SHIFT 4 +#define K3G_BANDWIDTH_MASK ((0x3) << K3G_BANDWIDTH_SHIFT) +#define K3G_POWERDOWN_SHIFT 3 +#define K3G_POWERDOWN_POWER_DOWN ((0x0) << K3G_POWERDOWN_SHIFT) +#define K3G_POWERDOWN_NORMAL ((0x1) << K3G_POWERDOWN_SHIFT) +#define K3G_POWERDOWN_MASK ((0x1) << K3G_POWERDOWN_SHIFT) +#define K3G_Z_EN_SHIFT 2 +#define K3G_Z_EN ((0x1) << K3G_Z_EN_SHIFT) +#define K3G_Y_EN_SHIFT 1 +#define K3G_Y_EN ((0x1) << K3G_Y_EN_SHIFT) +#define K3G_X_EN_SHIFT 0 +#define K3G_X_EN ((0x1) << K3G_X_EN_SHIFT) + +#define K3G_HIGH_PASS_FILTER_SHIFT 4 +#define K3G_HIGH_PASS_FILTER_NORMAL_MODE_RESET_READING \ + ((0x0) << K3G_HIGH_PASS_FILTER_SHIFT) +#define K3G_HIGH_PASS_FILTER_REFERENCE_SIGNAL \ + ((0x1) << K3G_HIGH_PASS_FILTER_SHIFT) +#define K3G_HIGH_PASS_FILTER_NORMAL_MODE \ + ((0x2) << K3G_HIGH_PASS_FILTER_SHIFT) +#define K3G_HIGH_PASS_FILTER_AUTORESET_ON_INTERRUPT \ + ((0x3) << K3G_HIGH_PASS_FILTER_SHIFT) +#define K3G_HIGH_PASS_FILTER_CUTOFF_FREQ_SHIFT 0 +#define K3G_HIGH_PASS_FILTER_CUTOFF_FREQ_MASK \ + ((0xf) << K3G_HIGH_PASS_FILTER_CUTOFF_FREQ_SHIFT) + +#define K3G_INT1_EN_SHIFT 7 +#define K3G_INT1_EN ((0x1) << K3G_INT1_EN_SHIFT) +#define K3G_INT1_BOOT_SHIFT 6 +#define K3G_INT1_BOOT ((0x1) << K3G_INT1_BOOT_SHIFT) +#define K3G_INT1_ACTIVE_SHIFT 5 +#define K3G_INT1_ACTIVE_HIGH ((0x0) << K3G_INT1_ACTIVE_SHIFT) +#define K3G_INT1_ACTIVE_LOW ((0x1) << K3G_INT1_ACTIVE_SHIFT) +#define K3G_INT_PUSH_PULL_OPEN_DRAIN_SHIFT 4 +#define K3G_INT_PUSH_PULL \ + ((0x0) << K3G_INT_PUSH_PULL_OPEN_DRAIN_SHIFT) +#define K3G_INT_OPEN_DRAIN \ + ((0x1) << K3G_INT_PUSH_PULL_OPEN_DRAIN_SHIFT) +#define K3G_INT2_SRC_SHIFT 0 +#define K3G_INT2_SRC_MASK ((0x0f) << K3G_INT2_SRC_SHIFT) +#define K3G_INT2_DATA_READY_SHIFT 3 +#define K3G_INT2_DATA_READY ((0x1) << K3G_INT2_DATA_READY_SHIFT) +#define K3G_INT2_WATERMARK_SHIFT 2 +#define K3G_INT2_WATERMARK ((0x1) << K3G_INT2_WATERMARK_SHIFT) +#define K3G_INT2_OVERRUN_SHIFT 1 +#define K3G_INT2_OVERRUN ((0x1) << K3G_INT2_OVERRUN_SHIFT) +#define K3G_INT2_EMPTY_SHIFT 0 +#define K3G_INT2_EMPTY ((0x1) << K3G_INT2_EMPTY_SHIFT) + +#define K3G_BLOCK_DATA_UPDATE_SHIFT 7 +#define K3G_BLOCK_DATA_UPDATE \ + ((0x1) << K3G_BLOCK_DATA_UPDATE_SHIFT) +#define K3G_BIG_LITTLE_ENDIAN_SHIFT 6 +#define K3G_BIG_ENDIAN ((0x0) << K3G_BIG_LITTLE_ENDIAN_SHIFT) +#define K3G_LITTLE_ENDIAN ((0x1) << K3G_BIG_LITTLE_ENDIAN_SHIFT) +#define K3G_FULL_SCALE_SHIFT 4 +#define K3G_FULL_SCALE_250DPS ((0x0) << K3G_FULL_SCALE_SHIFT) +#define K3G_FULL_SCALE_500DPS ((0x1) << K3G_FULL_SCALE_SHIFT) +#define K3G_FULL_SCALE_2000DPS ((0x2) << K3G_FULL_SCALE_SHIFT) +#define K3G_SELF_TEST_SHIFT 1 +#define K3G_SELF_TESET_NORMAL ((0x0) << K3G_SELF_TEST_SHIFT) +#define K3G_SELF_TESET_0 ((0x1) << K3G_SELF_TEST_SHIFT) +#define K3G_SELF_TESET_1 ((0x3) << K3G_SELF_TEST_SHIFT) +#define K3G_SPI_MODE_SHIFT 0 +#define K3G_SPI_FOUR_WIRE ((0x0) << K3G_SPI_MODE_SHIFT) +#define K3G_SPI_THREE_WIRE ((0x1) << K3G_SPI_MODE_SHIFT) + +#define K3G_REBOOT_SHIFT 7 +#define K3G_REBOOT ((0x1) << K3G_REBOOT_SHIFT) +#define K3G_FIFO_EN_SHIFT 6 +#define K3G_FIFO_EN ((0x1) << K3G_FIFO_EN_SHIFT) +#define K3G_HIGH_PASS_FILTER_EN_SHIFT 4 +#define K3G_HIGH_PASS_FILTER_EN \ + ((0x1) << K3G_HIGH_PASS_FILTER_EN_SHIFT) +#define K3G_INT1_SELECTION_SHIFT 2 +#define K3G_INT1_SELECTION ((0x3) << K3G_INT1_SELECTION_SHIFT) +#define K3G_OUT_SELECTION_SHIFT 0 +#define K3G_OUT_SELECTION ((0x3) << K3G_OUT_SELECTION_SHIFT) + +#define K3G_ZYX_OVERRUN_SHIFT 7 +#define K3G_ZYX_OVERRUN ((0x1) << K3G_ZYX_OVERRUN_SHIFT) +#define K3G_Z_OVERRUN_SHIFT 6 +#define K3G_Z_OVERRUN ((0x1) << K3G_Z_OVERRUN_SHIFT) +#define K3G_Y_OVERRUN_SHIFT 5 +#define K3G_Y_OVERRUN ((0x1) << K3G_Y_OVERRUN_SHIFT) +#define K3G_X_OVERRUN_SHIFT 4 +#define K3G_X_OVERRUN ((0x1) << K3G_X_OVERRUN_SHIFT) +#define K3G_ZYX_DATA_AVAILABLE_SHIFT 3 +#define K3G_ZYX_DATA_AVAILABEL \ + ((0x1) << K3G_ZYX_DATA_AVAILABLE_SHIFT) +#define K3G_Z_DATA_AVAILABLE_SHIFT 2 +#define K3G_Z_DATA_AVAILABLE ((0x1) << K3G_Z_DATA_AVAILABLE_SHIFT) +#define K3G_Y_DATA_AVAILABLE_SHIFT 1 +#define K3G_Y_DATA_AVAILABLE ((0x1) << K3G_Y_DATA_AVAILABLE_SHIFT) +#define K3G_X_DATA_AVAILABLE_SHIFT 0 +#define K3G_X_DATA_AVAILABLE ((0x1) << K3G_X_DATA_AVAILABLE_SHIFT) + +#define K3G_FIFO_MODE_SHIFT 5 +#define K3G_FIFO_BYPASS_MODE ((0x0) << K3G_FIFO_MODE_SHIFT) +#define K3G_FIFO_FIFO_MODE ((0x1) << K3G_FIFO_MODE_SHIFT) +#define K3G_FIFO_STREAM_MODE ((0x2) << K3G_FIFO_MODE_SHIFT) +#define K3G_FIFO_STREAM_TO_FIFO_MODE ((0x3) << K3G_FIFO_MODE_SHIFT) +#define K3G_FIFO_BYPASS_TO_STREAM_MODE ((0x4) << K3G_FIFO_MODE_SHIFT) +#define K3G_FIFO_MODE_MASK ((0x7) << K3G_FIFO_MODE_SHIFT) +#define K3G_WATERMARK_THRES_SHIFT 0 +#define K3G_WATERMARK_THRES_MASK ((0x1f) << K3G_WATERMARK_THRES_SHIFT) + +#define K3G_WATERMARK_SHIFT 7 +#define K3G_WATERMARK ((0x1) << K3G_WATERMARK_SHIFT) +#define K3G_OVERRUN_SHIFT 6 +#define K3G_OVERRUN ((0x1) << K3G_OVERRUN_SHIFT) +#define K3G_EMPTY_SHIFT 5 +#define K3G_EMPTY ((0x1) << K3G_EMPTY_SHIFT) +#define K3G_FIFO_STORED_SHIFT 0 +#define K3G_FIFO_STORED_MASK ((0x1f) << K3G_FIFO_STORED_SHIFT) + +#define K3G_AND_OR_COMBINATION_SHIFT 7 +#define K3G_OR_COMBINATION ((0x0) << K3G_AND_OR_COMBINATION_SHIFT) +#define K3G_AND_COMBINATION ((0x1) << K3G_AND_OR_COMBINATION_SHIFT) +#define K3G_LATCH_INTERRUPT_SHIFT 6 +#define K3G_INTERRUPT_NO_LATCHED ((0x0) << K3G_LATCH_INTERRUPT_SHIFT) +#define K3G_INTERRUPT_LATCHED ((0x1) << K3G_LATCH_INTERRUPT_SHIFT) +#define K3G_Z_HIGH_INT_EN_SHIFT 5 +#define K3G_Z_HIGH_INT_EN ((0x1) << K3G_Z_HIGH_INT_EN_SHIFT) +#define K3G_Z_LOW_INT_EN_SHIFT 4 +#define K3G_Z_LOW_INT_EN ((0x1) << K3G_Z_LOW_INT_EN_SHIFT) +#define K3G_Y_HIGH_INT_EN_SHIFT 3 +#define K3G_Y_HIGH_INT_EN ((0x1) << K3G_Y_HIGH_INT_EN_SHIFT) +#define K3G_Y_LOW_INT_EN_SHIFT 2 +#define K3G_Y_LOW_INT_EN ((0x1) << K3G_Y_LOW_INT_EN_SHIFT) +#define K3G_X_HIGH_INT_EN_SHIFT 1 +#define K3G_X_HIGH_INT_EN ((0x1) << K3G_X_HIGH_INT_EN_SHIFT) +#define K3G_X_LOW_INT_EN_SHIFT 0 +#define K3G_X_LOW_INT_EN ((0x1) << K3G_X_LOW_INT_EN_SHIFT) + +#define K3G_INTERRUPT_ACTIVE_SHIFT 6 +#define K3G_INTERRUPT_ACTIVE ((0x1) << K3G_INTERRUPT_ACTIVE_SHIFT) +#define K3G_Z_HIGH_SHIFT 5 +#define K3G_Z_HIGH ((0x1) << K3G_Z_HIGH_SHIFT) +#define K3G_Z_LOW_SHIFT 4 +#define K3G_Z_LOW ((0x1) << K3G_Z_LOW_SHIFT) +#define K3G_Y_HIGH_SHIFT 3 +#define K3G_Y_HIGH ((0x1) << K3G_Y_HIGH_SHIFT) +#define K3G_Y_LOW_SHIFT 2 +#define K3G_Y_LOW ((0x1) << K3G_Y_LOW_SHIFT) +#define K3G_X_HIGH_SHIFT 1 +#define K3G_X_HIGH ((0x1) << K3G_X_HIGH_SHIFT) +#define K3G_X_LOW_SHIFT 0 +#define K3G_X_LOW ((0x1) << K3G_X_LOW_SHIFT) + +#define K3G_INT1_WAIT_EN_SHIFT 7 +#define K3G_INT1_WAIT_EN ((0x1) << K3G_INT1_WAIT_EN_SHIFT) +#define K3G_INT1_DURATION_SHIFT 0 +#define K3G_INT1_DURATION_MASK ((0x7f) << K3G_INT1_DURATION_SHIFT) + +#define K3G_TEMP_SHIFT 0 +#define K3G_TEMP_MASK ((0xff) << K3G_TEMP_SHIFT) + +#define K3G_DEV_ID 0xd3 + +struct k3g_platform_data { + int irq2; + u8 data_rate; + u8 bandwidth; + u8 powerdown; + u8 zen; + u8 yen; + u8 xen; + u8 hpmode; + u8 hpcf; + u8 int1_enable; + u8 int1_boot; + u8 int1_hl_active; + u8 int_pp_od; + u8 int2_src; + u8 block_data_update; + u8 endian; + u8 fullscale; + u8 selftest; + u8 spi_mode; + u8 reboot; + u8 fifo_enable; + u8 hp_enable; + u8 int1_sel; + u8 out_sel; + u8 fifo_mode; + u8 fifo_threshold; + u8 int1_combination; + u8 int1_latch; + u8 int1_z_high_enable; + u8 int1_z_low_enable; + u8 int1_y_high_enable; + u8 int1_y_low_enable; + u8 int1_x_high_enable; + u8 int1_x_low_enable; + u8 int1_wait_enable; + u8 int1_wait_duration; + u16 int1_z_threshold; + u16 int1_y_threshold; + u16 int1_x_threshold; +}; + +struct k3g_chip { + struct i2c_client *client; + struct iio_dev *indio_dev; + struct work_struct work_thresh; + struct work_struct work_fifo; + struct iio_trigger *trig; + s64 last_timestamp; + struct mutex lock; + struct mutex ring_lock; + struct k3g_platform_data *pdata; +}; + +#endif diff --git a/include/linux/kernel_sec_common.h b/include/linux/kernel_sec_common.h new file mode 100644 index 0000000..5e500f6 --- /dev/null +++ b/include/linux/kernel_sec_common.h @@ -0,0 +1,205 @@ +#ifndef _KERNEL_SEC_COMMON_H_ +#define _KERNEL_SEC_COMMON_H_ + +#include <asm/io.h> +#include <linux/module.h> +#include <linux/delay.h> +#include <mach/map.h> +#include <mach/regs-clock.h> +#include <linux/sched.h> + +/* MAGIC_CODE in LOKE + you have to use this vitrual address with consideration */ +/*#define LOKE_BOOT_USB_DWNLD_V_ADDR 0xC1000000*/ +#define LOKE_BOOT_USB_DWNLD_V_ADDR 0xD1000000 +#define LOKE_BOOT_USB_DWNLDMAGIC_NO 0x66262564 + +/* AP -> CP : AP Crash Ind */ +#define KERNEL_SEC_DUMP_AP_DEAD_INDICATOR 0xABCD00C9 +/* CP -> AP : CP ready for uplaod mode */ +#define KERNEL_SEC_DUMP_AP_DEAD_ACK 0xCACAEDED + +/*it's longer than DPRAM_ERR_MSG_LEN, in dpram.h */ +#define KERNEL_SEC_DEBUG_CAUSE_STR_LEN 65 +#define KERNEL_SEC_DEBUG_LEVEL_LOW (0x574F4C44) +#define KERNEL_SEC_DEBUG_LEVEL_MID (0x44494D44) +#define KERNEL_SEC_DEBUG_LEVEL_HIGH (0x47494844) + +/* INFORMATION REGISTER */ +/* +#define S5P_INFORM0 S5P_CLKREG(0xF000) +#define S5P_INFORM1 S5P_CLKREG(0xF004) +#define S5P_INFORM2 S5P_CLKREG(0xF008) +#define S5P_INFORM3 S5P_CLKREG(0xF00C) +#define S5P_INFORM4 S5P_CLKREG(0xF010) +#define S5P_INFORM5 S5P_CLKREG(0xF014) +#define S5P_INFORM6 S5P_CLKREG(0xF018) /*Magic code for upload cause.*/ +#define S5P_INFORM7 S5P_CLKREG(0xF01C) + +/* WDOG register */ +/*#define (S3C_PA_WDT) 0xE2700000 */ + +#if 1 /* dpram Physical address for the internal DPRAM in S5PC210 */ +#define IDPRAM_PHYSICAL_ADDR S5P_PA_MODEMIF +#endif +/* klaatu - schedule log */ +/* #define SCHED_LOG_MAX 1000 */ + +typedef struct { + void *dummy; + void *fn; +} irq_log_t; + +typedef union { + char task[TASK_COMM_LEN]; + irq_log_t irq; +} task_log_t; + +typedef struct { + unsigned long long time; + task_log_t log; +} sched_log_t; + +/* extern sched_log_t gExcpTaskLog[SCHED_LOG_MAX]; */ +extern unsigned int gExcpTaskLogIdx; + +typedef struct tag_mmu_info { + int SCTLR; + int TTBR0; + int TTBR1; + int TTBCR; + int DACR; + int DFSR; + int DFAR; + int IFSR; + int IFAR; + int DAFSR; + int IAFSR; + int PMRRR; + int NMRRR; + int FCSEPID; + int CONTEXT; + int URWTPID; + int UROTPID; + int POTPIDR; +} t_kernel_sec_mmu_info; + +/*ARM CORE regs mapping structure*/ +typedef struct { + /* COMMON */ + unsigned int r0; + unsigned int r1; + unsigned int r2; + unsigned int r3; + unsigned int r4; + unsigned int r5; + unsigned int r6; + unsigned int r7; + unsigned int r8; + unsigned int r9; + unsigned int r10; + unsigned int r11; + unsigned int r12; + + /* SVC */ + unsigned int r13_svc; + unsigned int r14_svc; + unsigned int spsr_svc; + + /* PC & CPSR */ + unsigned int pc; + unsigned int cpsr; + + /* USR/SYS */ + unsigned int r13_usr; + unsigned int r14_usr; + + /* FIQ */ + unsigned int r8_fiq; + unsigned int r9_fiq; + unsigned int r10_fiq; + unsigned int r11_fiq; + unsigned int r12_fiq; + unsigned int r13_fiq; + unsigned int r14_fiq; + unsigned int spsr_fiq; + + /* IRQ */ + unsigned int r13_irq; + unsigned int r14_irq; + unsigned int spsr_irq; + + /* MON */ + unsigned int r13_mon; + unsigned int r14_mon; + unsigned int spsr_mon; + + /* ABT */ + unsigned int r13_abt; + unsigned int r14_abt; + unsigned int spsr_abt; + + /* UNDEF */ + unsigned int r13_und; + unsigned int r14_und; + unsigned int spsr_und; + +} t_kernel_sec_arm_core_regsiters; + +typedef enum { + UPLOAD_CAUSE_INIT = 0x00000000, + UPLOAD_CAUSE_KERNEL_PANIC = 0x000000C8, + UPLOAD_CAUSE_FORCED_UPLOAD = 0x00000022, + UPLOAD_CAUSE_CP_ERROR_FATAL = 0x000000CC, + UPLOAD_CAUSE_USER_FAULT = 0x0000002F, +#if 1 /* dpram */ + UPLOAD_CAUSE_CDMA_ERROR = 0x000000F1, + UPLOAD_CAUSE_CDMA_TIMEOUT = 0x000000F2, + UPLOAD_CAUSE_CDMA_RESET = 0x000000F3, +#endif + BLK_UART_MSG_FOR_FACTRST_2ND_ACK = 0x00000088, +} kernel_sec_upload_cause_type; + +#define KERNEL_SEC_UPLOAD_CAUSE_MASK 0x000000FF +#define KERNEL_SEC_UPLOAD_AUTOTEST_BIT 31 +#define KERNEL_SEC_UPLOAD_AUTOTEST_MASK (1<<KERNEL_SEC_UPLOAD_AUTOTEST_BIT) + +#define KERNEL_SEC_DEBUG_LEVEL_BIT 29 +#define KERNEL_SEC_DEBUG_LEVEL_MASK (3<<KERNEL_SEC_DEBUG_LEVEL_BIT) + +extern void __iomem *kernel_sec_viraddr_wdt_reset_reg; +extern void kernel_sec_map_wdog_reg(void); + +extern void kernel_sec_set_cp_upload(void); +extern void kernel_sec_set_cp_ack(void); +extern void kernel_sec_set_upload_magic_number(void); +extern void kernel_sec_set_upload_cause \ + (kernel_sec_upload_cause_type uploadType); +extern void kernel_sec_set_cause_strptr(unsigned char *str_ptr, int size); +extern void kernel_sec_set_autotest(void); +extern void kernel_sec_clear_upload_magic_number(void); +extern void kernel_sec_set_build_info(void); + +extern void kernel_sec_hw_reset(bool bSilentReset); +extern void kernel_sec_init(void); + +extern void kernel_sec_get_core_reg_dump(t_kernel_sec_arm_core_regsiters *regs); +extern int kernel_sec_get_mmu_reg_dump(t_kernel_sec_mmu_info *mmu_info); +extern void kernel_sec_save_final_context(void); + +extern bool kernel_set_debug_level(int level); +extern int kernel_get_debug_level(void); +extern int kernel_get_debug_state(void); + +extern bool kernel_sec_set_debug_level(int level); +extern int kernel_sec_get_debug_level_from_param(void); +extern int kernel_sec_get_debug_level(void); + +#if 1 /* dpram */ +extern void kernel_sec_cdma_dpram_dump(void); +#endif + +#define KERNEL_SEC_LEN_BUILD_TIME 16 +#define KERNEL_SEC_LEN_BUILD_DATE 16 + +#endif /* _KERNEL_SEC_COMMON_H_ */ diff --git a/include/linux/kr3dh.h b/include/linux/kr3dh.h new file mode 100644 index 0000000..48f8466 --- /dev/null +++ b/include/linux/kr3dh.h @@ -0,0 +1,122 @@ +/* + * kr3dh.c - ST Microelectronics three-axes accelerometer + * + * Copyright (C) 2010 Samsung Electronics + * Donggeun Kim <dg77.kim@samsung.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _KR3DH_H_ +#define _KR3DH_H_ + +enum kr3dh_ouput_data_rate { + KR3DH_ODR_50HZ, + KR3DH_ODR_100HZ, + KR3DH_ODR_400HZ, + KR3DH_ODR_1000HZ, +}; + +enum kr3dh_power_mode { + KR3DH_POWER_DOWN, + KR3DH_NORMAL_MODE, + KR3DH_LOW_POWER_ONE_HALF_HZ, + KR3DH_LOW_POWER_1HZ, + KR3DH_LOW_POWER_2HZ, + KR3DH_LOW_POWER_5HZ, + KR3DH_LOW_POWER_10HZ, +}; + +enum kr3dh_int_hl_active { + KR3DH_HIGH, + KR3DH_LOW, +}; + +enum kr3dh_int_pp_od { + KR3DH_PUSH_PULL, + KR3DH_OPEN_DRAIN, +}; + +enum kr3dh_int_cfg { + KR3DH_INT_SOURCE, + KR3DH_INT_SOURCE_OR, + KR3DH_DATA_READY, + KR3DH_BOOT_RUNNING, +}; + +enum kr3dh_spi_mode { + KR3DH_FOUR_WIRE, + KR3DH_THREE_WIRE, +}; + +enum kr3dh_scale_range { + KR3DH_RANGE_2G, + KR3DH_RANGE_4G, + KR3DH_RANGE_8G = 3, +}; + +enum kr3dh_turn_on_mode { + KR3DH_SLEEP_TO_WAKE_DISABLE, + KR3DH_SLEEP_TO_WAKE_ENABLE = 3, +}; + +enum kr3dh_int_combination { + KR3DH_OR_COMBINATION, + KR3DH_AND_COMBINATION, +}; + +struct kr3dh_platform_data { + int irq2; + int negate_x; + int negate_y; + int negate_z; + int change_xy; + u8 power_mode; + u8 data_rate; + u8 zen; + u8 yen; + u8 xen; + u8 reboot; + u8 hpmode; + u8 filter_sel; + u8 hp_enable_1; + u8 hp_enable_2; + u8 hpcf; + u8 int_hl_active; + u8 int_pp_od; + u8 int2_latch; + u8 int2_cfg; + u8 int1_latch; + u8 int1_cfg; + u8 block_data_update; + u8 endian; + u8 fullscale; + u8 selftest_sign; + u8 selftest; + u8 spi_mode; + u8 turn_on_mode; + u8 int1_combination; + u8 int1_6d_enable; + u8 int1_z_high_enable; + u8 int1_z_low_enable; + u8 int1_y_high_enable; + u8 int1_y_low_enable; + u8 int1_x_high_enable; + u8 int1_x_low_enable; + u8 int1_threshold; + u8 int1_duration; + u8 int2_combination; + u8 int2_6d_enable; + u8 int2_z_high_enable; + u8 int2_z_low_enable; + u8 int2_y_high_enable; + u8 int2_y_low_enable; + u8 int2_x_high_enable; + u8 int2_x_low_enable; + u8 int2_threshold; + u8 int2_duration; +}; + +#endif diff --git a/include/linux/lcd-property.h b/include/linux/lcd-property.h new file mode 100644 index 0000000..4c83076 --- /dev/null +++ b/include/linux/lcd-property.h @@ -0,0 +1,35 @@ +/* + * LCD panel property definitions. + * + * Copyright (c) 2012 Samsung Electronics + * + * Joongmock Shin <jmock.shin@samsung.com> + * Eunchul Kim <chulspro.kim@samsung.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ +#ifndef LCD_PROPERTY_H +#define LCD_PROPERTY_H + +/* definition of flip */ +enum lcd_property_flip { + LCD_PROPERTY_FLIP_NONE = (0 << 0), + LCD_PROPERTY_FLIP_VERTICAL = (1 << 0), + LCD_PROPERTY_FLIP_HORIZONTAL = (1 << 1), +}; + +/* + * A structure for lcd property. + * + * @flip: flip information for each lcd. + * @dynamic_refresh: enable/disable dynamic refresh. + */ +struct lcd_property { + enum lcd_property_flip flip; + bool dynamic_refresh; +}; + +#endif /* LCD_PROPERTY_H */ + diff --git a/include/linux/ld9040.h b/include/linux/ld9040.h index 88bdf56..6fb3377 100644 --- a/include/linux/ld9040.h +++ b/include/linux/ld9040.h @@ -43,3 +43,10 @@ struct spi_ops { #define LCDTYPE_M2 (1) #define LCDTYPE_SM2_A1 (0) #define LCDTYPE_SM2_A2 (2) + +enum { + ACL_STATUS_0P = 0, + ACL_STATUS_40P, + ACL_STATUS_50P, + ACL_STATUS_MAX +}; diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h index 0d72c7f..3f071ec 100644 --- a/include/linux/leds-lp5521.h +++ b/include/linux/leds-lp5521.h @@ -5,8 +5,6 @@ * * Contact: Samu Onkalo <samu.p.onkalo@nokia.com> * - * Updated: Milo(Woogyom) Kim <milo.kim@ti.com> - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. @@ -34,6 +32,15 @@ struct lp5521_led_config { u8 max_current; }; +struct lp5521_led_pattern { + u8 *r; + u8 *g; + u8 *b; + u8 size_r; + u8 size_g; + u8 size_b; +}; + #define LP5521_CLOCK_AUTO 0 #define LP5521_CLOCK_INT 1 #define LP5521_CLOCK_EXT 2 @@ -54,11 +61,13 @@ struct lp5521_platform_data { struct lp5521_led_config *led_config; u8 num_channels; u8 clock_mode; - u8 update_config; int (*setup_resources)(void); void (*release_resources)(void); void (*enable)(bool state); const char *label; + u8 update_config; + struct lp5521_led_pattern *patterns; + int num_patterns; }; #endif /* __LINUX_LP5521_H */ diff --git a/include/linux/leds.h b/include/linux/leds.h index dcc1d70..3a278a2 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -24,7 +24,7 @@ struct device; enum led_brightness { LED_OFF = 0, -#if defined(CONFIG_MACH_Q1_BD) +#if defined(CONFIG_MACH_Q1_BD) || defined(CONFIG_MACH_U1_NA_USCC) LED_BRIGHTNESS_LEVEL1 = 1, LED_BRIGHTNESS_LEVEL2 = 2, LED_BRIGHTNESS_LEVEL3 = 3, diff --git a/include/linux/mdm_hsic_pm.h b/include/linux/mdm_hsic_pm.h new file mode 100644 index 0000000..6388074 --- /dev/null +++ b/include/linux/mdm_hsic_pm.h @@ -0,0 +1,45 @@ +#ifndef __MDM_HSIC_PM_H__ +#define __MDM_HSIC_PM_H__ +#include <linux/usb.h> + +enum pwr_stat { + POWER_OFF, + POWER_ON, +}; + +void request_active_lock_set(const char *name); +void request_active_lock_release(const char *name); +void request_boot_lock_set(const char *name); +void request_boot_lock_release(const char *name); +void set_host_stat(const char *name, enum pwr_stat status); +int wait_dev_pwr_stat(const char *name, enum pwr_stat status); +int check_udev_suspend_allowed(const char *name); +bool check_request_blocked(const char *name); + +/*add wakelock interface for fast dormancy*/ +#ifdef CONFIG_HAS_WAKELOCK +void fast_dormancy_wakelock(const char *name); +#else +void fast_dormancy_wakelock(const char *name) {} +#endif + +/** + * register_udev_to_pm_dev - called at interface driver probe function + * + * @name: name of pm device to register usb device + * @udev: pointer of udev to register + */ +int register_udev_to_pm_dev(const char *name, struct usb_device *udev); + +/** + * unregister_udev_from_pm_dev - called at interface driver disconnect function + * + * @name: name of pm device to unregister usb device + * @udev: pointer of udev to unregister + */ +void unregister_udev_from_pm_dev(const char *name, struct usb_device *udev); + +extern struct blocking_notifier_head mdm_reset_notifier_list; +extern void mdm_force_fatal(void); +extern bool lpa_handling; +#endif /* __MDM_HSIC_PM_H__ */ diff --git a/include/linux/melfas_mms_ts.h b/include/linux/melfas_mms_ts.h new file mode 100644 index 0000000..a98ff97 --- /dev/null +++ b/include/linux/melfas_mms_ts.h @@ -0,0 +1,79 @@ +/* + * include/linux/mms144.h - platform data structure for MCS Series sensor + * + * Copyright (C) 2010 Melfas, 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. + * + */ + +#ifndef _LINUX_MELFAS_TS_H +#define _LINUX_MELFAS_TS_H + +#define MELFAS_TS_NAME "melfas_ts" +#define MELFAS_DEV_ADDR 0x48 + +extern struct class *sec_class; + +struct melfas_mms_platform_data { + int max_x; + int max_y; + + bool invert_x; + bool invert_y; + + int gpio_int; + int gpio_sda; + int gpio_scl; + int (*power) (int on); + int (*mux_fw_flash) (bool to_gpios); + int (*is_vdd_on) (void); + void (*input_event) (void *data); + void (*register_cb) (void *); +}; + +enum eISCRet_t { + ISC_NONE = -1, + ISC_SUCCESS = 0, + ISC_FILE_OPEN_ERROR, + ISC_FILE_CLOSE_ERROR, + ISC_FILE_FORMAT_ERROR, + ISC_WRITE_BUFFER_ERROR, + ISC_I2C_ERROR, + ISC_UPDATE_MODE_ENTER_ERROR, + ISC_CRC_ERROR, + ISC_VALIDATION_ERROR, + ISC_COMPATIVILITY_ERROR, + ISC_UPDATE_SECTION_ERROR, + ISC_SLAVE_ERASE_ERROR, + ISC_SLAVE_DOWNLOAD_ERROR, + ISC_DOWNLOAD_WHEN_SLAVE_IS_UPDATED_ERROR, + ISC_INITIAL_PACKET_ERROR, + ISC_NO_NEED_UPDATE_ERROR, + ISC_LIMIT +}; + +enum eSectionType_t { + SEC_NONE = -1, + SEC_BOOTLOADER = 0, + SEC_CORE, + SEC_PRIVATE_CONFIG, + SEC_PUBLIC_CONFIG, + SEC_LIMIT +}; + +struct tISCFWInfo_t { + unsigned char version; + unsigned char compatible_version; + unsigned char start_addr; + unsigned char end_addr; +}; + +#endif /* _LINUX_MELFAS_TS_H */ diff --git a/include/linux/melfas_ts.h b/include/linux/melfas_ts.h index 4805ce8..8f43384 100644 --- a/include/linux/melfas_ts.h +++ b/include/linux/melfas_ts.h @@ -38,7 +38,7 @@ struct melfas_tsi_platform_data { struct notifier_block fb_notif; #endif -#if defined(CONFIG_MACH_C1CTC) || defined(CONFIG_MACH_M0_CHNOPEN) ||\ +#if defined(CONFIG_MACH_M0_CHNOPEN) || \ defined(CONFIG_MACH_M0_CMCC) || defined(CONFIG_MACH_M0_CTC) int (*lcd_type)(void); #endif diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index ff0b1a2..7a2c536 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h @@ -177,9 +177,11 @@ enum max77693_haptic_reg { /* MAX77693 STATUS2 register */ #define STATUS2_CHGTYP_SHIFT 0 #define STATUS2_CHGDETRUN_SHIFT 3 +#define STATUS2_DXOVP_SHIFT 5 #define STATUS2_VBVOLT_SHIFT 6 #define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) #define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT) +#define STATUS2_DXOVP_MASK (0x1 << STATUS2_DXOVP_SHIFT) #define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT) /* MAX77693 CDETCTRL1 register */ @@ -232,7 +234,12 @@ enum max77693_reg_ctrl1_val { MAX77693_MUIC_CTRL1_BIN_6_110 = 0x06, MAX77693_MUIC_CTRL1_BIN_7_111 = 0x07, }; - +#if defined(CONFIG_SWITCH_DUAL_MODEM) +enum max77693_switch_sel_val { + MAX77693_SWITCH_SEL_1st_BIT_USB = 0x3 << 0, + MAX77693_SWITCH_SEL_2nd_BIT_UART = 0x3 << 2, +}; +#else enum max77693_switch_sel_val { MAX77693_SWITCH_SEL_1st_BIT_USB = 0x1 << 0, MAX77693_SWITCH_SEL_2nd_BIT_UART = 0x1 << 1, @@ -240,6 +247,7 @@ enum max77693_switch_sel_val { MAX77693_SWITCH_SEL_3rd_BIT_LTE_UART = 0x1 << 2, #endif }; +#endif enum max77693_reg_ctrl1_type { CTRL1_AP_USB = @@ -349,6 +357,10 @@ enum max77693_types { TYPE_MAX77693, }; +#ifdef CONFIG_FAST_BOOT +extern bool fake_shut_down; +#endif + extern struct device *switch_dev; extern int max77693_irq_init(struct max77693_dev *max77693); extern void max77693_irq_exit(struct max77693_dev *max77693); @@ -385,6 +397,12 @@ enum cable_type_muic { CABLE_TYPE_MHL_MUIC, CABLE_TYPE_MHL_VB_MUIC, CABLE_TYPE_SMARTDOCK_MUIC, + CABLE_TYPE_SMARTDOCK_TA_MUIC, + CABLE_TYPE_SMARTDOCK_USB_MUIC, + CABLE_TYPE_AUDIODOCK_MUIC, +#if defined(CONFIG_MUIC_DET_JACK) + CABLE_TYPE_EARJACK_MUIC, +#endif CABLE_TYPE_UNKNOWN_MUIC }; @@ -392,6 +410,10 @@ enum { AP_USB_MODE = 0, CP_USB_MODE, AUDIO_MODE, +#if defined(CONFIG_SWITCH_DUAL_MODEM) + CP_ESC_USB_MODE, +#endif + }; enum { @@ -400,6 +422,10 @@ enum { #ifdef CONFIG_LTE_VIA_SWITCH UART_PATH_LTE, #endif +#if defined(CONFIG_SWITCH_DUAL_MODEM) + UART_PATH_CP_ESC, +#endif + }; #endif /* CONFIG_MFD_MAX77693 */ diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h index 07f2162..274693a 100644 --- a/include/linux/mfd/max77693.h +++ b/include/linux/mfd/max77693.h @@ -35,6 +35,14 @@ enum { MAX77693_MUIC_ATTACHED }; +enum { + MAX77693_MUIC_DOCK_DETACHED = 0, + MAX77693_MUIC_DOCK_DESKDOCK, + MAX77693_MUIC_DOCK_CARDOCK, + MAX77693_MUIC_DOCK_AUDIODOCK = 7, + MAX77693_MUIC_DOCK_SMARTDOCK = 8 +}; + /* MAX77686 regulator IDs */ enum max77693_regulators { MAX77693_ESAFEOUT1 = 0, @@ -63,6 +71,7 @@ struct max77693_charger_platform_data { #ifdef CONFIG_VIBETONZ #define MAX8997_MOTOR_REG_CONFIG2 0x2 #define MOTOR_LRA (1<<7) +#define MOTOR_ERM (0<<7) #define MOTOR_EN (1<<6) #define EXT_PWM (0<<5) #define DIVIDER_128 (1<<1) @@ -117,14 +126,17 @@ struct max77693_muic_data { void (*usb_cb) (u8 attached); void (*uart_cb) (u8 attached); int (*charger_cb) (enum cable_type_muic); - void (*deskdock_cb) (bool attached); - void (*cardock_cb) (bool attached); + void (*dock_cb) (int type); void (*mhl_cb) (int attached); void (*init_cb) (void); int (*set_safeout) (int path); bool(*is_mhl_attached) (void); int (*cfg_uart_gpio) (void); void (*jig_uart_cb) (int path); +#if defined(CONFIG_MUIC_DET_JACK) + void (*earjack_cb) (int attached); + void (*earjackkey_cb) (int pressed, unsigned int code); +#endif int (*host_notify_cb) (int enable); int gpio_usb_sel; int sw_path; @@ -135,7 +147,11 @@ struct max77693_muic_data { }; #if defined(CONFIG_MACH_M0_CTC) -int max7693_muic_cp_usb_state(void); +extern int max7693_muic_cp_usb_state(void); #endif +#if defined(CONFIG_MUIC_MAX77693_SUPPORT_OTG_AUDIO_DOCK) +extern void max77693_muic_attach_audio_dock(void); +#endif /* CONFIG_MUIC_MAX77693_SUPPORT_OTG_AUDIO_DOCK */ + #endif /* __LINUX_MFD_MAX77693_H */ diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h index 256ed57..0658eba 100644 --- a/include/linux/mfd/max8997.h +++ b/include/linux/mfd/max8997.h @@ -24,8 +24,7 @@ #define __LINUX_MFD_MAX8997_H #include <linux/regulator/machine.h> - -#if defined(CONFIG_MACH_Q1_BD) +#if defined(CONFIG_MACH_Q1_BD) || defined(CONFIG_MACH_U1_NA_USCC) #define MAX8997_SUPPORT_TORCH #endif /* CONFIG_MACH_Q1_BD */ @@ -125,6 +124,35 @@ enum { UART_PATH_AP, }; +enum { + USB_SEL_IF = 0, + USB_SEL_CP, +}; + +enum muic_acc_type { + MUIC_ACC_TYPE_NONE = 0, + MUIC_ACC_TYPE_OTG, + MUIC_ACC_TYPE_MHL, + MUIC_ACC_TYPE_STATION, + MUIC_ACC_TYPE_JIG_USB_OFF, + MUIC_ACC_TYPE_JIG_USB_ON, + MUIC_ACC_TYPE_DESKDOCK, + MUIC_ACC_TYPE_JIG_UART_OFF, + MUIC_ACC_TYPE_JIG_UART_ON, + MUIC_ACC_TYPE_CARDOCK, + MUIC_ACC_TYPE_TA, + MUIC_ACC_TYPE_USB, + MUIC_ACC_TYPE_UNKNOWN +}; + +enum muic_chg_type { + MUIC_CHG_TYPE_NONE = 0, + MUIC_CHG_TYPE_USB, + MUIC_CHG_TYPE_TA, + MUIC_CHG_TYPE_MHL_VB, + MUIC_CHG_TYPE_UNKNOWN +}; + enum cable_type { CABLE_TYPE_NONE = 0, CABLE_TYPE_USB, @@ -153,18 +181,13 @@ struct max8997_muic_data { void (*init_cb) (void); int (*set_safeout) (int path); bool (*is_mhl_attached) (void); -#if !defined(CONFIG_MACH_U1CAMERA_BD) int (*cfg_uart_gpio) (void); -#endif /* CONFIG_MACH_U1CAMERA_BD */ void (*jig_uart_cb) (int path); int (*host_notify_cb) (int enable); -#if !defined(CONFIG_MACH_U1CAMERA_BD) int gpio_usb_sel; -#endif /* CONFIG_MACH_U1CAMERA_BD */ - int sw_path; -#if !defined(CONFIG_MACH_U1CAMERA_BD) + int gpio_uart_sel; + int usb_path; int uart_path; -#endif /* CONFIG_MACH_U1CAMERA_BD */ }; struct max8997_buck1_dvs_funcs { diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h index 5afc005..5ba71a2 100644 --- a/include/linux/mfd/s5m87xx/s5m-core.h +++ b/include/linux/mfd/s5m87xx/s5m-core.h @@ -145,6 +145,7 @@ enum s5m8767_reg { S5M8767_REG_LDO26CTRL, S5M8767_REG_LDO27CTRL, S5M8767_REG_LDO28CTRL, + S5M8767_REG_BUCK1DVS2 = 0xE2, }; /* S5M8763 registers */ @@ -377,6 +378,7 @@ struct s5m_platform_data { bool wtsr_smpl; + int buck1_init; int buck2_init; int buck3_init; int buck4_init; diff --git a/include/linux/migrate.h b/include/linux/migrate.h index e39aeec..95323a6 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -12,9 +12,15 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **); extern void putback_lru_pages(struct list_head *l); extern int migrate_page(struct address_space *, struct page *, struct page *); +#ifndef CONFIG_DMA_CMA extern int migrate_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, bool sync); +#else +extern int migrate_pages(struct list_head *l, new_page_t x, + unsigned long private, bool offlining, + bool sync, int tries); +#endif extern int migrate_huge_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, bool sync); @@ -34,9 +40,15 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, #define PAGE_MIGRATION 0 static inline void putback_lru_pages(struct list_head *l) {} +#ifndef CONFIG_DMA_CMA static inline int migrate_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, bool sync) { return -ENOSYS; } +#else +static inline int migrate_pages(struct list_head *l, new_page_t x, + unsigned long private, bool offlining, + bool sync, int tries) { return -ENOSYS; } +#endif static inline int migrate_huge_pages(struct list_head *l, new_page_t x, unsigned long private, bool offlining, bool sync) { return -ENOSYS; } diff --git a/include/linux/mm.h b/include/linux/mm.h index f59179b..2ce8e03 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -448,7 +448,11 @@ void put_page(struct page *page); void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); +#ifndef CONFIG_DMA_CMA int split_free_page(struct page *page); +#else +int split_free_page(struct page *page, bool for_cma); +#endif /* * Compound pages have a destructor function. Provide a @@ -1603,6 +1607,9 @@ int in_gate_area_no_mm(unsigned long addr); #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) #endif /* __HAVE_ARCH_GATE_AREA */ +#ifdef CONFIG_DMA_CMA +void perform_drop_caches(unsigned int mode); +#endif int drop_caches_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); unsigned long shrink_slab(struct shrink_control *shrink, diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 059839c..0f230ce 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -198,6 +198,9 @@ struct vm_area_struct { #ifdef CONFIG_NUMA struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif +#ifdef CONFIG_ZRAM_FOR_ANDROID + int vma_swap_done; +#endif /* CONFIG_ZRAM_FOR_ANDROID */ }; struct core_thread { @@ -330,6 +333,9 @@ struct mm_struct { #ifdef CONFIG_CPUMASK_OFFSTACK struct cpumask cpumask_allocation; #endif +#ifdef CONFIG_ZRAM_FOR_ANDROID + int mm_swap_done; +#endif /* CONFIG_ZRAM_FOR_ANDROID */ }; static inline void mm_init_cpumask(struct mm_struct *mm) diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6ca73e3..942cd59 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -206,6 +206,8 @@ struct mmc_card { #define MMC_QUIRK_DISABLE_CD (1<<5) /* disconnect CD/DAT[3] resistor */ #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ +/* MoviNAND secure issue */ +#define MMC_QUIRK_MOVINAND_SECURE (1<<8) unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ #define MMC_NO_POWER_NOTIFICATION 0 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c5105b9..ad75fd5 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -255,7 +255,7 @@ struct mmc_host { #define MMC_CAP2_HS200_1_2V_SDR (1 << 8) /* can support */ #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ MMC_CAP2_HS200_1_2V_SDR) - +#define MMC_CAP2_ADAPT_PACKED (1 << 9) /* Disable packed write adaptively */ mmc_pm_flag_t pm_caps; /* supported pm features */ unsigned int power_notify_type; #define MMC_HOST_PW_NOTIFY_NONE 0 diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5b5350a..bc047b4 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -279,6 +279,7 @@ struct _mmc_csd { #define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */ #define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */ #define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ +#define EXT_CSD_VENDOR_SPECIFIC_FIELD 64 /* RO, 64bytes */ #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ #define EXT_CSD_HPI_MGMT 161 /* R/W */ diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 39016ed..39016ed 100755..100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9f7c3eb..e5dcd07 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -35,6 +35,8 @@ */ #define PAGE_ALLOC_COSTLY_ORDER 3 +#ifndef CONFIG_DMA_CMA + #define MIGRATE_UNMOVABLE 0 #define MIGRATE_RECLAIMABLE 1 #define MIGRATE_MOVABLE 2 @@ -43,6 +45,37 @@ #define MIGRATE_ISOLATE 4 /* can't allocate from here */ #define MIGRATE_TYPES 5 +#else +enum { + MIGRATE_UNMOVABLE, + MIGRATE_RECLAIMABLE, + MIGRATE_MOVABLE, + MIGRATE_PCPTYPES, /* the number of types on the pcp lists */ + MIGRATE_RESERVE = MIGRATE_PCPTYPES, + /* + * MIGRATE_CMA migration type is designed to mimic the way + * ZONE_MOVABLE works. Only movable pages can be allocated + * from MIGRATE_CMA pageblocks and page allocator never + * implicitly change migration type of MIGRATE_CMA pageblock. + * + * The way to use it is to change migratetype of a range of + * pageblocks to MIGRATE_CMA which can be done by + * __free_pageblock_cma() function. What is important though + * is that a range of pageblocks must be aligned to + * MAX_ORDER_NR_PAGES should biggest page be bigger then + * a single pageblock. + */ + MIGRATE_CMA, + MIGRATE_ISOLATE, /* can't allocate from here */ + MIGRATE_TYPES +}; + +bool is_cma_pageblock(struct page *page); +#define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA) +#define cma_wmark_pages(zone) (zone->min_cma_pages) + +#endif + #define for_each_migratetype_order(order, type) \ for (order = 0; order < MAX_ORDER; order++) \ for (type = 0; type < MIGRATE_TYPES; type++) @@ -115,6 +148,9 @@ enum zone_stat_item { NUMA_OTHER, /* allocation from other node */ #endif NR_ANON_TRANSPARENT_HUGEPAGES, +#ifdef CONFIG_DMA_CMA + NR_FREE_CMA_PAGES, +#endif NR_VM_ZONE_STAT_ITEMS }; /* @@ -316,6 +352,14 @@ struct zone { /* see spanned/present_pages for more description */ seqlock_t span_seqlock; #endif +#ifdef CONFIG_DMA_CMA + /* + * CMA needs to increase watermark levels during the allocation + * process to make sure that the system is not starved. + */ + unsigned long min_cma_pages; + bool cma_alloc; +#endif struct free_area free_area[MAX_ORDER]; #ifndef CONFIG_SPARSEMEM diff --git a/include/linux/msm_charm.h b/include/linux/msm_charm.h index 779fd38..3695643 100644 --- a/include/linux/msm_charm.h +++ b/include/linux/msm_charm.h @@ -10,6 +10,11 @@ #define NORMAL_BOOT_DONE _IOW(CHARM_CODE, 5, int) #define RAM_DUMP_DONE _IOW(CHARM_CODE, 6, int) #define WAIT_FOR_RESTART _IOR(CHARM_CODE, 7, int) +#define SILENT_RESET_CONTROL _IOR(CHARM_CODE, 8, int) +#define AUTOPM_LOCK _IOW(CHARM_CODE, 9, int) +#define GET_BOOT_PROTOCOL _IOW(CHARM_CODE, 10, int) +#define GET_FORCE_RAMDUMP _IOW(CHARM_CODE, 11, int) +#define WAIT_FOR_ERROR _IOW(CHARM_CODE, 12, int) enum charm_boot_type { CHARM_NORMAL_BOOT = 0, diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/linux/netfilter/xt_IDLETIMER.h index 208ae93..faaa28b 100644 --- a/include/linux/netfilter/xt_IDLETIMER.h +++ b/include/linux/netfilter/xt_IDLETIMER.h @@ -4,6 +4,7 @@ * Header file for Xtables timer target module. * * Copyright (C) 2004, 2010 Nokia Corporation + * * Written by Timo Teras <ext-timo.teras@nokia.com> * * Converted to x_tables and forward-ported to 2.6.34 @@ -32,12 +33,19 @@ #include <linux/types.h> #define MAX_IDLETIMER_LABEL_SIZE 28 +#define NLMSG_MAX_SIZE 64 + +#define NL_EVENT_TYPE_INACTIVE 0 +#define NL_EVENT_TYPE_ACTIVE 1 struct idletimer_tg_info { __u32 timeout; char label[MAX_IDLETIMER_LABEL_SIZE]; + /* Use netlink messages for notification in addition to sysfs */ + __u8 send_nl_msg; + /* for kernel module internal use only */ struct idletimer_tg *timer __attribute__((aligned(8))); }; diff --git a/include/linux/netlink.h b/include/linux/netlink.h index a9dd895..e8e9cc3 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -26,6 +26,7 @@ #define NETLINK_ECRYPTFS 19 #define NETLINK_RDMA 20 + #define MAX_LINKS 32 struct sockaddr_nl { diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index dca6723..4ba9276 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -745,8 +745,14 @@ enum nl80211_commands { * * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with * a single scan request, a wiphy attribute. + * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can + * scan with a single scheduled scan request, a wiphy attribute. * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements * that can be added to a scan request + * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information + * elements that can be added to a scheduled scan request + * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be + * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute. * * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive @@ -987,6 +993,24 @@ enum nl80211_commands { * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan * cycles, in msecs. + + * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more + * sets of attributes to match during scheduled scans. Only BSSs + * that match any of the sets will be reported. These are + * pass-thru filter rules. + * For a match to succeed, the BSS must match all attributes of a + * set. Since not every hardware supports matching all types of + * attributes, there is no guarantee that the reported BSSs are + * fully complying with the match sets and userspace needs to be + * able to ignore them by itself. + * Thus, the implementation is somewhat hardware-dependent, but + * this is only an optimization and the userspace application + * needs to handle all the non-filtered results anyway. + * If the match attributes don't make sense when combined with + * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID + * is included in the probe request, but the match attributes + * will never let it go through), -EINVAL may be returned. + * If ommited, no filtering is done. * * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported * interface combinations. In each nested item, it contains attributes @@ -1194,6 +1218,26 @@ enum nl80211_attrs { NL80211_ATTR_INTERFACE_COMBINATIONS, NL80211_ATTR_SOFTWARE_IFTYPES, + NL80211_ATTR_REKEY_DATA, + + NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, + NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, + + NL80211_ATTR_SCAN_SUPP_RATES, + + NL80211_ATTR_HIDDEN_SSID, + + NL80211_ATTR_IE_PROBE_RESP, + NL80211_ATTR_IE_ASSOC_RESP, + + NL80211_ATTR_STA_WME, + NL80211_ATTR_SUPPORT_AP_UAPSD, + + NL80211_ATTR_ROAM_SUPPORT, + + NL80211_ATTR_SCHED_SCAN_MATCH, + NL80211_ATTR_MAX_MATCH_SETS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -1654,6 +1698,26 @@ enum nl80211_reg_rule_attr { }; /** + * enum nl80211_sched_scan_match_attr - scheduled scan match attributes + * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved + * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, + * only report BSS with matching SSID. + * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter + * attribute number currently defined + * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use + */ +enum nl80211_sched_scan_match_attr { + __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, + + NL80211_ATTR_SCHED_SCAN_MATCH_SSID, + + /* keep last */ + __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, + NL80211_SCHED_SCAN_MATCH_ATTR_MAX = + __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 +}; + +/** * enum nl80211_reg_rule_flags - regulatory rule flags * * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6081493..9a63bd6 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -131,6 +131,54 @@ enum pageflags { #ifndef __GENERATING_BOUNDS_H +#ifdef CONFIG_DMA_CMA +struct page; +extern struct page *migrate_pages_current; + +/* + * Macros to create function definitions for page flags + */ +#define TESTPAGEFLAG(uname, lname) \ +static inline int Page##uname(struct page *page) \ + { do { } while (0); return test_bit(PG_##lname, &page->flags); } + +#define SETPAGEFLAG(uname, lname) \ +static inline void SetPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + set_bit(PG_##lname, &page->flags); } + +#define CLEARPAGEFLAG(uname, lname) \ +static inline void ClearPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + clear_bit(PG_##lname, &page->flags); } + +#define __SETPAGEFLAG(uname, lname) \ +static inline void __SetPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + __set_bit(PG_##lname, &page->flags); } + +#define __CLEARPAGEFLAG(uname, lname) \ +static inline void __ClearPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + __clear_bit(PG_##lname, &page->flags); } + +#define TESTSETFLAG(uname, lname) \ +static inline int TestSetPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + return test_and_set_bit(PG_##lname, &page->flags); } + +#define TESTCLEARFLAG(uname, lname) \ +static inline int TestClearPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + return test_and_clear_bit(PG_##lname, &page->flags); } + +#define __TESTCLEARFLAG(uname, lname) \ +static inline int __TestClearPage##uname(struct page *page) \ + { WARN_ON(0 && page == migrate_pages_current); \ + return __test_and_clear_bit(PG_##lname, &page->flags); } + +#else + /* * Macros to create function definitions for page flags */ @@ -166,6 +214,8 @@ static inline int TestClearPage##uname(struct page *page) \ static inline int __TestClearPage##uname(struct page *page) \ { return __test_and_clear_bit(PG_##lname, &page->flags); } +#endif + #define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 051c1b1..4502fdc 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -1,6 +1,7 @@ #ifndef __LINUX_PAGEISOLATION_H #define __LINUX_PAGEISOLATION_H +#ifndef CONFIG_DMA_CMA /* * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. * If specified range includes migrate types other than MOVABLE, @@ -33,5 +34,38 @@ test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn); extern int set_migratetype_isolate(struct page *page); extern void unset_migratetype_isolate(struct page *page); +#else +/* + * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. + * If specified range includes migrate types other than MOVABLE or CMA, + * this will fail with -EBUSY. + * + * For isolating all pages in the range finally, the caller have to + * free all pages in the range. test_page_isolated() can be used for + * test it. + */ +extern int +start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, + unsigned migratetype); + +/* + * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. + * target range is [start_pfn, end_pfn) + */ +extern int +undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, + unsigned migratetype); + +/* + * Test all pages in [start_pfn, end_pfn) are isolated or not. + */ +int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn); + +/* + * Internal functions. Changes pageblock's migrate type. + */ +extern int set_migratetype_isolate(struct page *page); +extern void unset_migratetype_isolate(struct page *page, unsigned migratetype); +#endif #endif diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 716875e..7933b74 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -205,7 +205,11 @@ extern struct page *__page_cache_alloc(gfp_t gfp); #else static inline struct page *__page_cache_alloc(gfp_t gfp) { +#ifndef CONFIG_DMA_CMA return alloc_pages(gfp, 0); +#else + return alloc_pages(gfp & ~__GFP_MOVABLE, 0); +#endif } #endif diff --git a/include/linux/platform_data/cypress_cyttsp4.h b/include/linux/platform_data/cypress_cyttsp4.h new file mode 100644 index 0000000..03819d6 --- /dev/null +++ b/include/linux/platform_data/cypress_cyttsp4.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Motorola Mobility, Inc. + * Modified by Cypress Semiconductor 2011-2012 + * - increase touch_settings.size from uint8_t to uint32_t + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +/* Defines generic platform structures for touch drivers */ +#ifndef _LINUX_TOUCH_PLATFORM_H +#define _LINUX_TOUCH_PLATFORM_H + +#include <linux/types.h> + +enum { + GPIO_TOUCH_nINT = 0, + GPIO_TOUCH_EN, + GPIO_TOUCH_SCL, + GPIO_TOUCH_SDA +}; + +struct touch_settings { + const uint8_t *data; + uint32_t size; + uint8_t tag; +} __attribute__ ((packed)); + +struct touch_firmware { + const uint8_t *img; + uint32_t size; + const uint8_t *ver; + uint8_t vsize; +} __attribute__ ((packed)); + +struct touch_framework { + const uint16_t *abs; + uint8_t size; + uint8_t enable_vkeys; +} __attribute__ ((packed)); + +struct touch_platform_data { + struct touch_settings *sett[256]; + struct touch_firmware *fw; + struct touch_framework *frmwrk; + + uint8_t addr[2]; + uint16_t flags; + + int (*hw_reset)(void); + int (*hw_power)(int); + int (*hw_recov)(int); + int (*irq_stat)(void); +} __attribute__ ((packed)); + +#endif /* _LINUX_TOUCH_PLATFORM_H */ diff --git a/include/linux/platform_data/lte_modem_bootloader.h b/include/linux/platform_data/lte_modem_bootloader.h index 27a0450..893a1aa 100644 --- a/include/linux/platform_data/lte_modem_bootloader.h +++ b/include/linux/platform_data/lte_modem_bootloader.h @@ -21,12 +21,8 @@ #define IOCTL_LTE_MODEM_XMIT_BOOT _IOW('o', 0x23, unsigned int) #define IOCTL_LTE_MODEM_LTE2AP_STATUS _IOR('o', 0x24, unsigned int) -#define AIRPLAIN_MODE_TEST - -#ifdef AIRPLAIN_MODE_TEST -#define IOCTL_LTE_MODEM_AIRPLAIN_ON _IOWR('o', 0x25, unsigned int) -#define IOCTL_LTE_MODEM_AIRPLAIN_OFF _IOWR('o', 0x26, unsigned int) -#endif +#define IOCTL_LTE_MODEM_FACTORY_MODE_ON _IOWR('o', 0x25, unsigned int) +#define IOCTL_LTE_MODEM_FACTORY_MODE_OFF _IOWR('o', 0x26, unsigned int) struct lte_modem_bootloader_param { char __user *buf; diff --git a/include/linux/platform_data/mms152_ts.h b/include/linux/platform_data/mms152_ts.h new file mode 100644 index 0000000..29ddd48 --- /dev/null +++ b/include/linux/platform_data/mms152_ts.h @@ -0,0 +1,46 @@ +/* + * mms_ts.h - Platform data for Melfas MMS-series touch driver + * + * Copyright (C) 2011 Google Inc. + * Author: Dima Zavin <dima@android.com> + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef _LINUX_MMS_TOUCH_H +#define _LINUX_MMS_TOUCH_H +#define MELFAS_TS_NAME "melfas-ts" + +struct melfas_tsi_platform_data { + int max_x; + int max_y; + + bool invert_x; + bool invert_y; + + int gpio_int; + int gpio_sda; + int gpio_scl; + int (*mux_fw_flash) (bool to_gpios); + int (*power) (bool on); + int (*is_vdd_on) (void); + const char *fw_name; + bool use_touchkey; + const u8 *touchkey_keycode; + const u8 *config_fw_version; +#ifdef CONFIG_INPUT_FBSUSPEND + struct notifier_block fb_notif; +#endif + void (*input_event) (void *data); + int (*lcd_type) (void); + void (*register_cb) (void *); +}; +extern struct class *sec_class; +void tsp_charger_infom(bool en); + +#endif /* _LINUX_MMS_TOUCH_H */ diff --git a/include/linux/platform_data/mms_ts.h b/include/linux/platform_data/mms_ts.h index 8c51e58..a8448a6 100644 --- a/include/linux/platform_data/mms_ts.h +++ b/include/linux/platform_data/mms_ts.h @@ -27,7 +27,7 @@ struct melfas_tsi_platform_data { int gpio_sda; int gpio_scl; int (*mux_fw_flash) (bool to_gpios); - int (*power) (int on); + int (*power) (bool on); int (*is_vdd_on) (void); const char *fw_name; bool use_touchkey; diff --git a/include/linux/platform_data/mms_ts_gc.h b/include/linux/platform_data/mms_ts_gc.h index 318dadf..76a383e 100644 --- a/include/linux/platform_data/mms_ts_gc.h +++ b/include/linux/platform_data/mms_ts_gc.h @@ -28,7 +28,11 @@ struct melfas_tsi_platform_data { int gpio_scl; int (*mux_fw_flash)(bool to_gpios); int (*power)(int on); - const char *fw_name; + u8 *tsp_vendor; + u8 *tsp_ic; + int tsp_tx; + int tsp_rx; + int fw_version; const u8 *config_fw_version; void (*input_event)(void *data); void (*register_cb)(void *); diff --git a/include/linux/platform_data/modem.h b/include/linux/platform_data/modem.h index d66af9f..8eb949c 100644 --- a/include/linux/platform_data/modem.h +++ b/include/linux/platform_data/modem.h @@ -23,7 +23,10 @@ enum modem_t { VIA_CBP72, SEC_CMC221, QC_MDM6600, + QC_ESC6270, + SPRD_SC8803, DUMMY, + MAX_MODEM_TYPE }; enum dev_format { @@ -36,7 +39,8 @@ enum dev_format { IPC_RAMDUMP, MAX_DEV_FORMAT, }; -#define MAX_IPC_DEV (IPC_RFS + 1) +#define MAX_IPC_DEV (IPC_RFS + 1) /* FMT, RAW, RFS */ +#define MAX_SIPC5_DEV (IPC_RAW + 1) /* FMT, RAW */ enum modem_io { IODEV_MISC, @@ -52,6 +56,7 @@ enum modem_link { LINKDEV_USB, LINKDEV_HSIC, LINKDEV_C2C, + LINKDEV_PLD, LINKDEV_MAX, }; #define LINKTYPE(modem_link) (1u << (modem_link)) @@ -59,6 +64,7 @@ enum modem_link { enum modem_network { UMTS_NETWORK, CDMA_NETWORK, + TDSCDMA_NETWORK, LTE_NETWORK, }; @@ -108,15 +114,20 @@ struct modemlink_pm_data { unsigned gpio_link_hostwake; unsigned gpio_link_slavewake; int (*link_reconnect)(void); + + /* usb hub only */ int (*port_enable)(int, int); - int *p_hub_status; + int (*hub_standby)(void *); + void *hub_pm_data; bool has_usbhub; + /* cpu/bus frequency lock */ atomic_t freqlock; - int (*cpufreq_lock)(void); - int (*cpufreq_unlock)(void); + int (*freq_lock)(struct device *dev); + int (*freq_unlock)(struct device *dev); int autosuspend_delay_ms; /* if zero, the default value is used */ + void (*ehci_reg_dump)(struct device *); }; struct modemlink_pm_link_activectl { @@ -124,14 +135,25 @@ struct modemlink_pm_link_activectl { int gpio_request_host_active; }; +#define RES_CP_ACTIVE_IRQ_ID 0 +#define RES_DPRAM_MEM_ID 1 +#define RES_DPRAM_IRQ_ID 2 +#define RES_DPRAM_SFR_ID 3 + enum dpram_type { EXT_DPRAM, - CP_IDPRAM, AP_IDPRAM, - C2C_DPRAM, + CP_IDPRAM, + SHM_DPRAM, MAX_DPRAM_TYPE }; +#define DPRAM_SIZE_8KB 0x02000 +#define DPRAM_SIZE_16KB 0x04000 +#define DPRAM_SIZE_32KB 0x08000 +#define DPRAM_SIZE_64KB 0x10000 +#define DPRAM_SIZE_128KB 0x20000 + enum dpram_speed { DPRAM_SPEED_LOW, DPRAM_SPEED_MID, @@ -159,6 +181,19 @@ struct dpram_ipc_device { }; struct dpram_ipc_map { +#if defined(CONFIG_LINK_DEVICE_PLD) + u16 __iomem *mbx_ap2cp; + u16 __iomem *magic_ap2cp; + u16 __iomem *access_ap2cp; + + u16 __iomem *mbx_cp2ap; + u16 __iomem *magic_cp2ap; + u16 __iomem *access_cp2ap; + + struct dpram_ipc_device dev[MAX_IPC_DEV]; + + u16 __iomem *address_buffer; +#else u16 __iomem *magic; u16 __iomem *access; @@ -166,75 +201,38 @@ struct dpram_ipc_map { u16 __iomem *mbx_cp2ap; u16 __iomem *mbx_ap2cp; +#endif }; struct modemlink_dpram_control { void (*reset)(void); - void (*setup_speed)(enum dpram_speed); - int (*wakeup)(void); - void (*sleep)(void); - void (*clear_intr)(void); - u16 (*recv_intr)(void); + u16 (*recv_intr)(void); void (*send_intr)(u16); - u16 (*recv_msg)(void); + u16 (*recv_msg)(void); void (*send_msg)(u16); - u16 (*get_magic)(void); - void (*set_magic)(u16); - - u16 (*get_access)(void); - void (*set_access)(u16); - - u32 (*get_tx_head)(int); - u32 (*get_tx_tail)(int); - void (*set_tx_head)(int, u32); - void (*set_tx_tail)(int, u32); - u8 __iomem * (*get_tx_buff)(int); - u32 (*get_tx_buff_size)(int); - u16 (*get_mask_req_ack)(int); - u16 (*get_mask_res_ack)(int); - u16 (*get_mask_send)(int); - - u32 (*get_rx_head)(int); - u32 (*get_rx_tail)(int); - void (*set_rx_head)(int, u32); - void (*set_rx_tail)(int, u32); - u8 __iomem * (*get_rx_buff)(int); - u32 (*get_rx_buff_size)(int); - - void (*log_disp)(struct modemlink_dpram_control *dpctl); - int (*cpupload_step1)(struct modemlink_dpram_control *dpctl); - int (*cpupload_step2)(void *arg, struct modemlink_dpram_control *dpctl); - int (*cpimage_load_prepare)(struct modemlink_dpram_control *dpctl); - int (*cpimage_load)(void *arg, struct modemlink_dpram_control *dpctl); - int (*nvdata_load)(void *arg, struct modemlink_dpram_control *dpctl); - int (*phone_boot_start)(struct modemlink_dpram_control *dpctl); - int (*phone_boot_start_post_process)(void); - void (*phone_boot_start_handler)(struct modemlink_dpram_control *dpctl); - void (*dload_cmd_hdlr)( - struct modemlink_dpram_control *dpctl, u16 cmd); - void (*bt_map_init)(struct modemlink_dpram_control *dpctl); - void (*load_init)(struct modemlink_dpram_control *dpctl); -#if defined(CONFIG_MACH_M0_CTC) - void (*terminate_link)(struct modemlink_dpram_control *dpctl); -#endif - u8 __iomem *dp_base; - u32 dp_size; - enum dpram_type dp_type; /* DPRAM type */ - int aligned; /* If aligned access is required, ... */ + int (*wakeup)(void); + void (*sleep)(void); - int dpram_irq; - unsigned long dpram_irq_flags; - char *dpram_irq_name; - char *dpram_wlock_name; + void (*setup_speed)(enum dpram_speed); - int max_ipc_dev; + enum dpram_type dp_type; /* DPRAM type */ + int aligned; /* aligned access is required */ + u8 __iomem *dp_base; + u32 dp_size; + int dpram_irq; + unsigned long dpram_irq_flags; + + int max_ipc_dev; struct dpram_ipc_map *ipc_map; -}; -#define DPRAM_MAGIC_CODE 0xAA + unsigned boot_size_offset; + unsigned boot_tag_offset; + unsigned boot_count_offset; + unsigned max_boot_frame_size; +}; /* platform data */ struct modem_data { @@ -255,10 +253,22 @@ struct modem_data { #endif unsigned gpio_cp_warm_reset; unsigned gpio_sim_detect; -#ifdef CONFIG_LINK_DEVICE_DPRAM +#if defined(CONFIG_LINK_DEVICE_DPRAM) || defined(CONFIG_LINK_DEVICE_PLD) unsigned gpio_dpram_int; #endif +#ifdef CONFIG_LINK_DEVICE_PLD + unsigned gpio_fpga1_creset; + unsigned gpio_fpga1_cdone; + unsigned gpio_fpga1_rst_n; + unsigned gpio_fpga1_cs_n; + + unsigned gpio_fpga2_creset; + unsigned gpio_fpga2_cdone; + unsigned gpio_fpga2_rst_n; + unsigned gpio_fpga2_cs_n; +#endif + #ifdef CONFIG_LTE_MODEM_CMC221 unsigned gpio_dpram_status; unsigned gpio_dpram_wakeup; @@ -275,6 +285,21 @@ struct modem_data { struct regulator *cp_vbus; #endif +#ifdef CONFIG_TDSCDMA_MODEM_SPRD8803 + unsigned gpio_ipc_mrdy; + unsigned gpio_ipc_srdy; + unsigned gpio_ipc_sub_mrdy; + unsigned gpio_ipc_sub_srdy; + unsigned gpio_ap_cp_int1; + unsigned gpio_ap_cp_int2; +#endif + +#ifdef CONFIG_SEC_DUAL_MODEM_MODE + unsigned gpio_sim_io_sel; + unsigned gpio_cp_ctrl1; + unsigned gpio_cp_ctrl2; +#endif + /* Switch with 2 links in a modem */ unsigned gpio_dynamic_switching; @@ -283,7 +308,7 @@ struct modem_data { enum modem_t modem_type; enum modem_link link_types; char *link_name; -#ifdef CONFIG_LINK_DEVICE_DPRAM +#if defined(CONFIG_LINK_DEVICE_DPRAM) || defined(CONFIG_LINK_DEVICE_PLD) /* Link to DPRAM control functions dependent on each platform */ struct modemlink_dpram_control *dpram_ctl; #endif @@ -306,6 +331,8 @@ struct modem_data { /* Debugging option */ bool use_mif_log; + /* SIM Detect polarity */ + bool sim_polarity; }; #define LOG_TAG "mif: " diff --git a/include/linux/platform_data/modem_na.h b/include/linux/platform_data/modem_na.h new file mode 100644 index 0000000..1fafcdb --- /dev/null +++ b/include/linux/platform_data/modem_na.h @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2010 Google, Inc. + * Copyright (C) 2010 Samsung Electronics. + * + * 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. + * + */ + +#ifndef __MODEM_IF_H__ +#define __MODEM_IF_H__ + +enum modem_t { + IMC_XMM6260, + VIA_CBP71, + SEC_CMC221, + SEC_CMC220, +}; + +enum dev_format { + IPC_FMT, + IPC_RAW, + IPC_RFS, + IPC_CMD, + IPC_BOOT, + IPC_MULTI_RAW, + IPC_RAMDUMP, +}; + +enum modem_io { + IODEV_MISC, + IODEV_NET, + IODEV_DUMMY, +}; + +enum modem_link { + LINKDEV_MIPI, + LINKDEV_DPRAM, + LINKDEV_SPI, + LINKDEV_USB, + LINKDEV_MAX, +}; + +enum modem_network { + UMTS_NETWORK, + CDMA_NETWORK, + LTE_NETWORK, +}; + +/* This structure is used in board-tuna-modem.c */ +struct modem_io_t { + char *name; + int id; + enum dev_format format; + enum modem_io io_type; + enum modem_link link; +}; + +struct modemlink_pm_data { + char *name; + /* link power contol 2 types : pin & regulator control */ + int (*link_ldo_enable)(bool); + unsigned gpio_link_enable; + unsigned gpio_link_active; + unsigned gpio_link_hostwake; + unsigned gpio_link_slavewake; + int (*link_reconnect)(void); + int (*port_enable)(int, int); + int *p_hub_status; + bool has_usbhub; + + atomic_t freqlock; + int (*cpufreq_lock)(void); + int (*cpufreq_unlock)(void); + + int autosuspend_delay_ms; /* if zero, the default value is used */ +}; + +struct modemlink_pm_link_activectl { + int gpio_initialized; + int gpio_request_host_active; +}; + +/* dpram specific struct */ +struct modemlink_shared_channel { + char *name; + unsigned out_offset; + unsigned out_size; + unsigned in_offset; + unsigned in_size; +}; + +struct modemlink_memmap { + unsigned magic_offset; + unsigned magic_size; + unsigned access_offset; + unsigned access_size; + unsigned in_box_offset; + unsigned in_box_size; + unsigned out_box_offset; + unsigned out_box_size; + + unsigned num_shared_map; + struct modemlink_shared_channel *shared_map; + + /*for interanl dpram interrupt clear*/ + void (*vendor_clear_irq)(void); + int (*board_ota_reset)(void); +}; + +/* platform data */ +struct modem_data { + char *name; + + unsigned gpio_cp_on; + unsigned gpio_cp_off; + unsigned gpio_reset_req_n; + unsigned gpio_cp_reset; + unsigned gpio_pda_active; + unsigned gpio_phone_active; + unsigned gpio_cp_dump_int; + unsigned gpio_flm_uart_sel; + unsigned gpio_cp_warm_reset; + unsigned gpio_ap_wakeup; +#if defined(CONFIG_LTE_MODEM_CMC221) || defined(CONFIG_LTE_MODEM_CMC220) + unsigned gpio_slave_wakeup; + unsigned gpio_host_wakeup; + unsigned gpio_host_active; + int irq_host_wakeup; +#endif + /* modem component */ + enum modem_t modem_type; + enum modem_link link_type; + enum modem_network modem_net; + unsigned num_iodevs; + struct modem_io_t *iodevs; + void *modemlink_extension; + void (*clear_intr)(void); + int (*ota_reset)(void); +#ifdef CONFIG_INTERNAL_MODEM_IF + void (*sfr_init)(void); + unsigned gpio_mbx_intr; +#endif + + /* Modem link PM support */ + struct modemlink_pm_data *link_pm_data; + /* Align mit mask used to adjust IPC RAW and MULTI_RAW HDLC + Packets from interndal dpram */ + unsigned char align; +}; + +/* DEBUG */ +#define LOG_TAG "mif: " + +#define mif_err(fmt, ...) \ + pr_err(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__) +#define mif_debug(fmt, ...) \ + pr_debug(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__) +#define mif_info(fmt, ...) \ + pr_info(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__) +#define mif_trace(fmt, ...) \ + printk(KERN_DEBUG "mif: %s: %d: called(%pF): " fmt, \ + __func__, __LINE__, __builtin_return_address(0), ##__VA_ARGS__) + +#endif diff --git a/include/linux/platform_data/usb3503_otg_conn.h b/include/linux/platform_data/usb3503_otg_conn.h new file mode 100644 index 0000000..224a87e --- /dev/null +++ b/include/linux/platform_data/usb3503_otg_conn.h @@ -0,0 +1,22 @@ +#ifndef USB3503_H +#define USB3503_H + +#define USB3503_I2C_NAME "usb3503" +int usb3503_set_mode(int mode); + +enum { + USB_3503_MODE_HUB = 0, + USB_3503_MODE_STANDBY = 1, +}; + +struct usb3503_platform_data { + bool init_needed; + bool es_ver; + char inital_mode; + int (*hw_config)(void); + int (*reset_n)(int); + int (*port_enable)(int, int); +}; + +#endif + diff --git a/include/linux/power/max17042_fuelgauge_px.h b/include/linux/power/max17042_fuelgauge_px.h index c02aabb..11e8ce8 100644 --- a/include/linux/power/max17042_fuelgauge_px.h +++ b/include/linux/power/max17042_fuelgauge_px.h @@ -12,6 +12,10 @@ #ifndef _MAX17042_BATTERY_H #define _MAX17042_BATTERY_H +#if defined(CONFIG_TARGET_LOCALE_KOR) +#include <linux/power_supply.h> +#endif /* CONFIG_TARGET_LOCALE_KOR */ + /* Register address */ #define STATUS_REG 0x00 #define VALRT_THRESHOLD_REG 0x01 @@ -36,6 +40,10 @@ #define REMCAP_AV_REG 0x1F #define FULLCAP_NOM_REG 0x23 #define MISCCFG_REG 0x2B +#if defined(CONFIG_TARGET_LOCALE_KOR) +#define FILTERCFG_REG 0x29 +#define CGAIN_REG 0x2E +#endif /* CONFIG_TARGET_LOCALE_KOR */ #define RCOMP_REG 0x38 #define FSTAT_REG 0x3D #define DQACC_REG 0x45 @@ -62,10 +70,13 @@ struct max17042_platform_data { int sdi_capacity; int sdi_vfcapacity; + int sdi_low_bat_comp_start_vol; int atl_capacity; int atl_vfcapacity; - int sdi_low_bat_comp_start_vol; int atl_low_bat_comp_start_vol; + int byd_capacity; + int byd_vfcapacity; + int byd_low_bat_comp_start_vol; int fuel_alert_line; int (*check_jig_status) (void); @@ -96,11 +107,15 @@ struct fuelgauge_info { int low_batt_comp_cnt[LOW_BATT_COMP_RANGE_NUM][LOW_BATT_COMP_LEVEL_NUM]; int check_start_vol; int low_batt_comp_flag; + int psoc; }; struct max17042_chip { struct i2c_client *client; struct max17042_platform_data *pdata; +#if defined(CONFIG_TARGET_LOCALE_KOR) + struct power_supply battery; +#endif /* CONFIG_TARGET_LOCALE_KOR */ struct fuelgauge_info info; struct mutex fg_lock; }; @@ -200,6 +215,27 @@ struct max17042_chip { #define ATL_Range2_3_Slope 111 #define ATL_Range1_1_Slope 0 #define ATL_Range1_3_Slope 0 +/* BYD type low battery compensation offset */ +#define BYD_Range5_1_Offset 3318 +#define BYD_Range5_3_Offset 3383 +#define BYD_Range4_1_Offset 3451 +#define BYD_Range4_3_Offset 3618 +#define BYD_Range3_1_Offset 3453 +#define BYD_Range3_3_Offset 3615 +#define BYD_Range2_1_Offset 3447 +#define BYD_Range2_3_Offset 3606 +#define BYD_Range1_1_Offset 3438 +#define BYD_Range1_3_Offset 3591 +#define BYD_Range5_1_Slope 0 +#define BYD_Range5_3_Slope 0 +#define BYD_Range4_1_Slope 53 +#define BYD_Range4_3_Slope 94 +#define BYD_Range3_1_Slope 54 +#define BYD_Range3_3_Slope 92 +#define BYD_Range2_1_Slope 45 +#define BYD_Range2_3_Slope 78 +#define BYD_Range1_1_Slope 0 +#define BYD_Range1_3_Slope 0 #elif defined(CONFIG_MACH_P8) || defined(CONFIG_MACH_P8LTE) /* Current range for P8(not dependent on battery type */ #define CURRENT_RANGE1 0 @@ -307,6 +343,7 @@ enum { UNKNOWN_TYPE = 0, SDI_BATTERY_TYPE, ATL_BATTERY_TYPE, + BYD_BATTERY_TYPE, }; #ifdef CONFIG_MACH_P8LTE @@ -339,5 +376,5 @@ extern void fg_fullcharged_compensation(u32 is_recharging, u32 pre_update); extern void fg_check_vf_fullcap_range(void); extern int fg_check_cap_corruption(void); extern void fg_set_full_charged(void); - +extern void fg_reset_fullcap_in_fullcharge(void); #endif diff --git a/include/linux/power/max17042_fuelgauge_u1.h b/include/linux/power/max17042_fuelgauge_u1.h index 9ce423d..6686fef 100644 --- a/include/linux/power/max17042_fuelgauge_u1.h +++ b/include/linux/power/max17042_fuelgauge_u1.h @@ -14,7 +14,7 @@ #define __MAX17042_BATTERY_H_ /*#define NO_READ_I2C_FOR_MAXIM */ -#if !defined(CONFIG_MACH_Q1_BD) +#if !defined(CONFIG_MACH_Q1_BD) && !defined(CONFIG_MACH_TRATS) #define RECAL_SOC_FOR_MAXIM #endif /*#define LOG_REG_FOR_MAXIM */ diff --git a/include/linux/power/sec_battery_px.h b/include/linux/power/sec_battery_px.h index 6497f53..7b8dadc 100644 --- a/include/linux/power/sec_battery_px.h +++ b/include/linux/power/sec_battery_px.h @@ -62,6 +62,12 @@ enum capacity_type { CAPACITY_TYPE_REP, }; +enum dock_type { + DOCK_NONE = 0, + DOCK_DESK, + DOCK_KEYBOARD, +}; + extern int low_batt_compensation(int fg_soc, int fg_vcell, int fg_current); extern void reset_low_batt_comp_cnt(void); extern int get_fuelgauge_value(int data); diff --git a/include/linux/power/sec_battery_u1.h b/include/linux/power/sec_battery_u1.h index cbd635e..1d214c9 100644 --- a/include/linux/power/sec_battery_u1.h +++ b/include/linux/power/sec_battery_u1.h @@ -27,8 +27,8 @@ #define HWREV_FOR_BATTERY 0x06 #elif defined(CONFIG_MACH_Q1_BD) #define HWREV_FOR_BATTERY 0x02 -#elif defined(CONFIG_MACH_U1CAMERA_BD) -#define HWREV_FOR_BATTERY 0x00 +#elif defined(CONFIG_MACH_TRATS) +#define HWREV_FOR_BATTERY 0x02 #else /*U1 EUR OPEN */ #define HWREV_FOR_BATTERY 0x08 #endif diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 6347fd9..c5b958b 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -110,6 +110,9 @@ enum power_supply_property { POWER_SUPPLY_PROP_ENERGY_NOW, POWER_SUPPLY_PROP_ENERGY_AVG, POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ +#ifdef CONFIG_SLP + POWER_SUPPLY_PROP_CAPACITY_RAW, +#endif POWER_SUPPLY_PROP_CAPACITY_LEVEL, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TEMP_AMBIENT, @@ -146,6 +149,40 @@ enum { POWER_SUPPLY_VBUS_GOOD, }; +/* + * EXTENDED_ONLINE_TYPE + * - support various charger cable type + * - set type from each accessory driver(muic, host, mhl, etc,,,) + * + * - type format + * | 31-24: RSVD | 23-16: MAIN TYPE | 15-8: SUB TYPE | 7-0: POWER TYPE | + */ +#define ONLINE_TYPE_RSVD_SHIFT 24 +#define ONLINE_TYPE_RSVD_MASK (0xF << ONLINE_TYPE_RSVD_SHIFT) +#define ONLINE_TYPE_MAIN_SHIFT 16 +#define ONLINE_TYPE_MAIN_MASK (0xF << ONLINE_TYPE_MAIN_SHIFT) +#define ONLINE_TYPE_SUB_SHIFT 8 +#define ONLINE_TYPE_SUB_MASK (0xF << ONLINE_TYPE_SUB_SHIFT) +#define ONLINE_TYPE_PWR_SHIFT 0 +#define ONLINE_TYPE_PWR_MASK (0xF << ONLINE_TYPE_PWR_SHIFT) + +enum online_sub_type { + ONLINE_SUB_TYPE_UNKNOWN = 0, + ONLINE_SUB_TYPE_MHL, + ONLINE_SUB_TYPE_AUDIO, + ONLINE_SUB_TYPE_DESK, + ONLINE_SUB_TYPE_SMART_NOTG, + ONLINE_SUB_TYPE_SMART_OTG, +}; + +enum online_power_type { + ONLINE_POWER_TYPE_UNKNOWN = 0, + ONLINE_POWER_TYPE_BATTERY, + ONLINE_POWER_TYPE_TA, + ONLINE_POWER_TYPE_USB, +}; +/* EXTENDED_ONLINE_TYPE */ + union power_supply_propval { int intval; const char *strval; diff --git a/include/linux/regulator/lp8720.h b/include/linux/regulator/lp8720.h new file mode 100644 index 0000000..e95a424 --- /dev/null +++ b/include/linux/regulator/lp8720.h @@ -0,0 +1,101 @@ +/* + * National Semiconductors LP8720 PMIC chip client interface + * + * Based on lp3971.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LINUX_REGULATOR_LP8720_H +#define __LINUX_REGULATOR_LP8720_H + +#include <linux/regulator/machine.h> + +/* LP8720 regulator ids */ +enum { + LP8720_LDO1 = 0, + LP8720_LDO2, + LP8720_LDO3, + LP8720_LDO4, + LP8720_LDO5, + LP8720_BUCK_V1, + LP8720_BUCK_V2, + LP8720_REG_MAX, +}; + +#define LP8720_LDO1_EN BIT(0) +#define LP8720_LDO2_EN BIT(1) +#define LP8720_LDO3_EN BIT(2) +#define LP8720_LDO4_EN BIT(3) +#define LP8720_LDO5_EN BIT(4) +#define LP8720_BUCK_V1_EN BIT(5) +#define LP8720_BUCK_V2_EN BIT(5) + +#define LP8720_LDO1_REG (0x01) +#define LP8720_LDO2_REG (0x02) +#define LP8720_LDO3_REG (0x03) +#define LP8720_LDO4_REG (0x04) +#define LP8720_LDO5_REG (0x05) +#define LP8720_BUCK_V1_REG (0x06) +#define LP8720_BUCK_V2_REG (0x07) + +/* LP8720 PMIC Registers. */ +#define LP8720_GENERAL_SETTINGsS_REG (0x00) +#define LP8720_LDO1_SETTINGS_REG (0x01) +#define LP8720_LDO2_SETTINGS_REG (0x02) +#define LP8720_LDO3_SETTINGS_REG (0x03) +#define LP8720_LDO4_SETTINGS_REG (0x04) +#define LP8720_LDO5_SETTINGS_REG (0x05) +#define LP8720_BUCK_SETTINGS1_REG (0x06) +#define LP8720_BUCK_SETTINGS2_REG (0x07) +#define LP8720_ENABLE_REG (0x08) +#define LP8720_PULLDOWN_REG (0x09) +#define LP8720_STATUS_REG (0x0A) +#define LP8720_INTERRUPT_REG (0x0B) +#define LP8720_INTERRUPTM_REG (0x0C) + +#define LP8720_LDOV_SHIFT (0) +#define LP8720_LDOT_SHIFT (5) +#define LP8720_BUCK_SHIFT (0) +#define LP8720_LDOV_MASK (0x1F << LP8720_LDOV_SHIFT) +#define LP8720_LDOT_MASK (0x7 << LP8720_LDOT_SHIFT) +#define LP8720_BUCK_MASK (0x1F << LP8720_BUCK_SHIFT) + +#define LP8720_LDO_VOL_CONTR_BASE 0x01 +#define LP8720_LDO_VOL_CONTR_REG(x) (LP8720_LDO_VOL_CONTR_BASE + (x)) + +#define LP8720_BUCK_VOL_CONTR_BASE 0x06 +#define LP8720_BUCK_VOL_CONTR_REG(x) (LP8720_BUCK_VOL_CONTR_BASE + (x)) + +struct lp8720 { + struct device *dev; + struct mutex io_lock; + struct i2c_client *i2c; + int num_regulators; + struct regulator_dev **rdev; +}; + +struct lp8720_regulator_subdev { + int id; + struct regulator_init_data *initdata; +}; + +struct lp8720_platform_data { + char *name; + unsigned int en_pin; + int num_regulators; + struct lp8720_regulator_subdev *regulators; +}; +#endif /* __LINUX_REGULATOR_LP8720_H */ diff --git a/include/linux/rtc.h b/include/linux/rtc.h index ceeb53c..8394141 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -150,6 +150,8 @@ struct rtc_class_ops { int (*set_alarm)(struct device *, struct rtc_wkalrm *); #if defined(CONFIG_RTC_ALARM_BOOT) int (*set_alarm_boot)(struct device *, struct rtc_wkalrm *); +#elif defined(CONFIG_RTC_POWER_OFF) + int (*set_alarm_poweroff)(struct device *, struct rtc_wkalrm *); #endif int (*proc)(struct device *, struct seq_file *); int (*set_mmss)(struct device *, unsigned long secs); @@ -236,10 +238,13 @@ extern int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alrm); #if defined(CONFIG_RTC_ALARM_BOOT) extern int rtc_set_alarm_boot(struct rtc_device *rtc, - struct rtc_wkalrm *alarm); + struct rtc_wkalrm *alarm); +#elif defined(CONFIG_RTC_POWER_OFF) +extern int rtc_set_alarm_poweroff(struct rtc_device *rtc, + struct rtc_wkalrm *alarm); #endif extern int rtc_initialize_alarm(struct rtc_device *rtc, - struct rtc_wkalrm *alrm); + struct rtc_wkalrm *alrm); extern void rtc_update_irq(struct rtc_device *rtc, unsigned long num, unsigned long events); diff --git a/include/linux/sensor/ak8963.h b/include/linux/sensor/ak8963.h new file mode 100644 index 0000000..6d525d4 --- /dev/null +++ b/include/linux/sensor/ak8963.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#ifndef AKM8963_H +#define AKM8963_H + +#include <linux/ioctl.h> + +#define AKM8963_I2C_NAME "ak8963" + +/* Rx buffer size, i.e from ST1 to ST2 */ +#define SENSOR_DATA_SIZE 8 +#define AKMIO 0xA1 + +/* IOCTLs for AKM library */ +/* WRITE and READ sizes don't include data. On WRITE, the first value is data + * size plus one and the second value is the register address. On READ + * the first value is the data size and second value is the register + * address and the data is written back into the buffer starting at + * the second byte (the length is unchanged). + */ +#define ECS_IOCTL_READ _IOWR(AKMIO, 0x01, char*) +#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char*) +#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x03, short) +#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x04, char[SENSOR_DATA_SIZE]) +#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x05, int[YPR_DATA_SIZE]) +#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x06, int) +#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x07, int) +#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x08, long long int[AKM_NUM_SENSORS]) +#define ECS_IOCTL_GET_LAYOUT _IOR(AKMIO, 0x09, char) +#define ECS_IOCTL_GET_OUTBIT _IOR(AKMIO, 0x0B, char) +#define ECS_IOCTL_RESET _IO(AKMIO, 0x0C) +#define ECS_IOCTL_GET_ACCEL _IOR(AKMIO, 0x30, short[3]) + + /* IOCTLs for APPs */ +#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short) +#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) +#define ECS_IOCTL_APP_GET_MFLAG _IOR(AKMIO, 0x12, short) +#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) +#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) +#define ECS_IOCTL_APP_SET_TFLAG _IOW(AKMIO, 0x15, short) +#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short) +#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) +#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t) +#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY + + + +/* Set raw magnetic vector flag */ +#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) + +/* Get raw magnetic vector flag */ +#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) + +#ifdef __KERNEL__ +struct akm8963_platform_data { + int gpio_data_ready_int; + char layout; + char outbit; + int gpio_RST; +}; +#endif + +#endif diff --git a/include/linux/sensor/gp2a.h b/include/linux/sensor/gp2a.h index 7900203..4b2b62c 100644 --- a/include/linux/sensor/gp2a.h +++ b/include/linux/sensor/gp2a.h @@ -64,5 +64,6 @@ int is_gp2a030a(void); struct gp2a_platform_data { int (*gp2a_led_on) (bool); int p_out; /* proximity-sensor-output gpio */ + unsigned long (*gp2a_get_threshold)(void); }; #endif diff --git a/include/linux/sensor/sensors_core.h b/include/linux/sensor/sensors_core.h index ef90dd9..969e460 100644 --- a/include/linux/sensor/sensors_core.h +++ b/include/linux/sensor/sensors_core.h @@ -22,4 +22,13 @@ struct accel_platform_data { * or if it is false, driver reports original axis-raw-data */ bool axis_adjust; }; + +struct gyro_platform_data { + int (*gyro_get_position) (void); + /* Change axis or not for user-level + * If it is true, driver reports adjusted axis-raw-data + * to user-space based on gyro_get_position() value, + * or if it is false, driver reports original axis-raw-data */ + bool axis_adjust; +}; #endif /* __LINUX_SENSORS_CORE_H_INCLUDED */ diff --git a/include/linux/sii9234.h b/include/linux/sii9234.h index f15bfa3..cb61906 100755..100644 --- a/include/linux/sii9234.h +++ b/include/linux/sii9234.h @@ -26,6 +26,7 @@ struct sii9234_platform_data { u8 power_state; u8 swing_level; + u8 factory_test; int ddc_i2c_num; void (*init)(void); void (*mhl_sel)(bool enable); @@ -37,6 +38,10 @@ struct sii9234_platform_data { #else void (*vbus_present)(bool on); #endif +#ifdef CONFIG_SAMSUNG_MHL_UNPOWERED + int (*get_vbus_status)(void); + void (*sii9234_otg_control)(bool onoff); +#endif struct i2c_client *mhl_tx_client; struct i2c_client *tpi_client; struct i2c_client *hdmi_rx_client; @@ -50,8 +55,15 @@ struct sii9234_platform_data { extern u8 mhl_onoff_ex(bool onoff); #endif +#if defined(__MHL_NEW_CBUS_MSC_CMD__) +#if defined(CONFIG_MFD_MAX77693) +extern void max77693_muic_usb_cb(u8 usb_mode); +#endif +#endif + #ifdef CONFIG_SAMSUNG_WORKAROUND_HPD_GLANCE extern void mhl_hpd_handler(bool onoff); +extern bool (*is_mhl_power_state_on)(void); #endif #ifdef CONFIG_SAMSUNG_USE_11PIN_CONNECTOR @@ -66,4 +78,9 @@ extern int max77693_muic_get_status1_adc_value(void); extern void sii9234_wake_lock(void); extern void sii9234_wake_unlock(void); #endif + +#ifdef CONFIG_JACK_MON +extern void jack_event_handler(const char *name, int value); +#endif + #endif /* _SII9234_H_ */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index f13b52b..bdef082 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -511,8 +511,8 @@ extern struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); extern struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); -extern struct sk_buff *pskb_copy(struct sk_buff *skb, - gfp_t gfp_mask); +extern struct sk_buff *__pskb_copy(struct sk_buff *skb, + int headroom, gfp_t gfp_mask); extern int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); @@ -1614,6 +1614,12 @@ static inline void netdev_free_page(struct net_device *dev, struct page *page) __free_page(page); } +static inline struct sk_buff *pskb_copy(struct sk_buff *skb, + gfp_t gfp_mask) +{ + return __pskb_copy(skb, skb_headroom(skb), gfp_mask); +} + /** * skb_clone_writable - is the header of a clone writable * @skb: buffer to check diff --git a/include/linux/ssp_platformdata.h b/include/linux/ssp_platformdata.h new file mode 100644 index 0000000..80d8501 --- /dev/null +++ b/include/linux/ssp_platformdata.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2011 Samsung Electronics. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _SSP_PLATFORMDATA_H_ +#define _SSP_PLATFORMDATA_H_ + +struct ssp_platform_data { + int (*wakeup_mcu)(void); + int (*check_mcu_ready)(void); + int (*check_mcu_busy)(void); + int (*set_mcu_reset)(int); + int (*check_ap_rev)(void); +}; +#endif diff --git a/include/linux/synaptics_s7301.h b/include/linux/synaptics_s7301.h index 7af78ae..09284a0 100644 --- a/include/linux/synaptics_s7301.h +++ b/include/linux/synaptics_s7301.h @@ -37,9 +37,10 @@ #if defined(CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK) #include <mach/cpufreq.h> #include <mach/dev.h> -#define SEC_DVFS_LOCK_TIMEOUT 100 +#define SEC_DVFS_LOCK_TIMEOUT 200 #define SEC_DVFS_LOCK_FREQ 800000 #define SEC_BUS_LOCK_FREQ 267160 +#define SEC_BUS_LOCK_FREQ2 400200 #endif #define MAX_TOUCH_NUM 10 @@ -163,6 +164,7 @@ struct synaptics_drv_data { bool dvfs_lock_status; #endif bool ready; + bool input_open; bool charger_connection; bool drawing_mode; bool suspend; @@ -175,19 +177,20 @@ struct synaptics_drv_data { u8 firm_version[4]; u8 firm_config[13]; u8 *cmd_temp; + u8 *references; u8 *tx_to_tx; u8 *tx_to_gnd; u16 x_line; u16 y_line; u16 refer_max; u16 refer_min; - u16 *references; u16 rx_to_rx[42][42]; unsigned long func_bit[BITS_TO_LONGS(MAX_FUNC+1)]; }; extern struct class *sec_class; extern int set_tsp_sysfs(struct synaptics_drv_data *data); +extern void remove_tsp_sysfs(struct synaptics_drv_data *data); extern int synaptics_fw_updater(struct synaptics_drv_data *data, u8 *fw_data); extern void forced_fw_upload(struct synaptics_drv_data *data); diff --git a/include/linux/tty.h b/include/linux/tty.h index 1ff6b62..5c31cd6 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -218,7 +218,7 @@ struct tty_port_operations { /* Called on the final put of a port */ void (*destruct)(struct tty_port *port); }; - + struct tty_port { struct tty_struct *tty; /* Back pointer */ const struct tty_port_operations *ops; /* Port operations */ @@ -294,7 +294,11 @@ struct tty_struct { void *driver_data; struct list_head tty_files; +#ifdef CONFIG_MDM_HSIC_PM +#define N_TTY_BUF_SIZE 16384 +#else #define N_TTY_BUF_SIZE 4096 +#endif /* * The following is data for the N_TTY line discipline. For diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h index 886bd78..ccbb19b 100644 --- a/include/linux/usb/android_composite.h +++ b/include/linux/usb/android_composite.h @@ -72,6 +72,8 @@ struct android_usb_platform_data { * (anywhere from 1 to FSG_MAX_LUNS which is 8). */ unsigned int nluns; + /* cdfs supprot : verizon require */ + unsigned int cdfs_support; }; /* Platform data for "usb_mass_storage" driver. */ @@ -97,4 +99,12 @@ struct acm_platform_data { u8 num_inst; }; +#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE +int register_usb_composite_notifier(struct notifier_block *notifier); +int unregister_usb_composite_notifier(struct notifier_block *notifier); +#else +#define register_usb_composite_notifier NULL +#define unregister_usb_composite_notifier NULL +#endif + #endif /* __LINUX_USB_ANDROID_H */ diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h index 5b2dcf9..61ebe0a 100644 --- a/include/linux/usb/f_accessory.h +++ b/include/linux/usb/f_accessory.h @@ -36,13 +36,15 @@ #define ACCESSORY_STRING_URI 4 #define ACCESSORY_STRING_SERIAL 5 -/* Control request for retrieving device's protocol version (currently 1) +/* Control request for retrieving device's protocol version * * requestType: USB_DIR_IN | USB_TYPE_VENDOR * request: ACCESSORY_GET_PROTOCOL * value: 0 * index: 0 * data version number (16 bits little endian) + * 1 for original accessory support + * 2 adds HID and device to host audio support */ #define ACCESSORY_GET_PROTOCOL 51 @@ -70,6 +72,65 @@ */ #define ACCESSORY_START 53 +/* Control request for registering a HID device. + * Upon registering, a unique ID is sent by the accessory in the + * value parameter. This ID will be used for future commands for + * the device + * + * requestType: USB_DIR_OUT | USB_TYPE_VENDOR + * request: ACCESSORY_REGISTER_HID_DEVICE + * value: Accessory assigned ID for the HID device + * index: total length of the HID report descriptor + * data none + */ +#define ACCESSORY_REGISTER_HID 54 + +/* Control request for unregistering a HID device. + * + * requestType: USB_DIR_OUT | USB_TYPE_VENDOR + * request: ACCESSORY_REGISTER_HID + * value: Accessory assigned ID for the HID device + * index: 0 + * data none + */ +#define ACCESSORY_UNREGISTER_HID 55 + +/* Control request for sending the HID report descriptor. + * If the HID descriptor is longer than the endpoint zero max packet size, + * the descriptor will be sent in multiple ACCESSORY_SET_HID_REPORT_DESC + * commands. The data for the descriptor must be sent sequentially + * if multiple packets are needed. + * + * requestType: USB_DIR_OUT | USB_TYPE_VENDOR + * request: ACCESSORY_SET_HID_REPORT_DESC + * value: Accessory assigned ID for the HID device + * index: offset of data in descriptor + * (needed when HID descriptor is too big for one packet) + * data the HID report descriptor + */ +#define ACCESSORY_SET_HID_REPORT_DESC 56 + +/* Control request for sending HID events. + * + * requestType: USB_DIR_OUT | USB_TYPE_VENDOR + * request: ACCESSORY_SEND_HID_EVENT + * value: Accessory assigned ID for the HID device + * index: 0 + * data the HID report for the event + */ +#define ACCESSORY_SEND_HID_EVENT 57 + +/* Control request for setting the audio mode. + * + * requestType: USB_DIR_OUT | USB_TYPE_VENDOR + * request: ACCESSORY_SET_AUDIO_MODE + * value: 0 - no audio + * 1 - device to host, 44100 16-bit stereo PCM + * index: 0 + * data none + */ +#define ACCESSORY_SET_AUDIO_MODE 58 + /* ioctls for retrieving strings set by the host */ #define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256]) #define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256]) @@ -79,5 +140,7 @@ #define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256]) /* returns 1 if there is a start request pending */ #define ACCESSORY_IS_START_REQUESTED _IO('M', 7) +/* returns audio mode (set via the ACCESSORY_SET_AUDIO_MODE control request) */ +#define ACCESSORY_GET_AUDIO_MODE _IO('M', 8) #endif /* __LINUX_USB_F_ACCESSORY_H */ diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 605b0aa..76f4396 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *); enum skb_state { illegal = 0, tx_start, tx_done, - rx_start, rx_done, rx_cleanup + rx_start, rx_done, rx_cleanup, + unlink_start }; struct skb_data { /* skb->cb is one of these */ diff --git a/include/linux/usb3803.h b/include/linux/usb3803.h new file mode 100644 index 0000000..6cf247d --- /dev/null +++ b/include/linux/usb3803.h @@ -0,0 +1,23 @@ +#ifndef USB3803_H +#define USB3803_H + +#define USB3803_I2C_NAME "usb3803" +int usb3803_set_mode(int mode); + +enum { + USB_3803_MODE_HUB = 0, + USB_3803_MODE_BYPASS = 1, + USB_3803_MODE_STANDBY = 2, +}; + +struct usb3803_platform_data { + bool init_needed; + bool es_ver; + char inital_mode; + int (*hw_config)(void); + int (*reset_n)(int); + int (*bypass_n)(int); + int (*clock_en)(int); +}; + +#endif diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 687fb11..9e4b356 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -33,6 +33,10 @@ struct vm_struct { unsigned int nr_pages; phys_addr_t phys_addr; void *caller; +#ifdef CONFIG_DEBUG_VMALLOC + unsigned int pid; + unsigned char *task_name; +#endif }; /* diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h index 209fe53..2d9ad6e 100644 --- a/include/linux/wacom_i2c.h +++ b/include/linux/wacom_i2c.h @@ -22,12 +22,22 @@ #define NAMEBUF 12 #define WACNAME "WAC_I2C_EMR" #define WACFLASH "WAC_I2C_FLASH" + +#ifdef CONFIG_EPEN_WACOM_G9PM +#define WACOM_FW_SIZE 61440 +#else #define WACOM_FW_SIZE 32768 +#endif /*Wacom Command*/ -#define COM_COORD_NUM 7 -#define COM_QUERY_NUM 9 +#if defined(CONFIG_MACH_T0) +#define COM_COORD_NUM 8 +#else +#define COM_COORD_NUM 7 +#endif +#define COM_QUERY_NUM 9 +#define COM_SAMPLERATE_STOP 0x30 #define COM_SAMPLERATE_40 0x33 #define COM_SAMPLERATE_80 0x32 #define COM_SAMPLERATE_133 0x31 @@ -57,60 +67,217 @@ #define WACOM_DELAY_FOR_RST_RISING 200 /* #define INIT_FIRMWARE_FLASH */ +#define WACOM_PDCT_WORK_AROUND + /*PDCT Signal*/ #define PDCT_NOSIGNAL 1 #define PDCT_DETECT_PEN 0 -#define WACOM_PDCT_WORK_AROUND + +#define WACOM_PRESSURE_MAX 255 + +/*Digitizer Type*/ +#define EPEN_DTYPE_B660 1 +#define EPEN_DTYPE_B713 2 +#define EPEN_DTYPE_B746 3 #if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_P4) +#define WACOM_DVFS_LOCK_FREQ 800000 #ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK #define SEC_BUS_LOCK #endif +#if defined(CONFIG_QC_MODEM) +#define WACOM_HAVE_FWE_PIN +#endif +#define BATTERY_SAVING_MODE +#define WACOM_CONNECTION_CHECK #define WACOM_HAVE_RESET_CONTROL 0 #define WACOM_POSX_MAX 21866 #define WACOM_POSY_MAX 13730 #define WACOM_POSX_OFFSET 170 #define WACOM_POSY_OFFSET 170 +#define WACOM_MAX_PRESSURE 0x3FF #define WACOM_IRQ_WORK_AROUND +#define WACOM_PEN_DETECT +#define WACOM_MAX_COORD_X WACOM_POSX_MAX +#define WACOM_MAX_COORD_Y WACOM_POSY_MAX + #elif defined(CONFIG_MACH_Q1_BD) -#define BOARD_Q1C210 + #define COOR_WORK_AROUND #define WACOM_IMPORT_FW_ALGO +#define WACOM_USE_OFFSET_TABLE +#define WACOM_USE_AVERAGING +#define WACOM_USE_TILT_OFFSET + #define WACOM_SLEEP_WITH_PEN_SLP #define WACOM_HAVE_RESET_CONTROL 1 #define CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK +#define WACOM_DVFS_LOCK_FREQ 500000 -#if defined(BOARD_P4ADOBE) && defined(COOR_WORK_AROUND) - #define COOR_WORK_AROUND_X_MAX 0x54C0 - #define COOR_WORK_AROUND_Y_MAX 0x34F8 - #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF -#elif (defined(BOARD_Q1OMAP4430) || defined(BOARD_Q1C210))\ - && defined(COOR_WORK_AROUND) - #define COOR_WORK_AROUND_X_MAX 0x2C80 - #define COOR_WORK_AROUND_Y_MAX 0x1BD0 - #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF -#endif +#define COOR_WORK_AROUND_X_MAX 0x2C80 +#define COOR_WORK_AROUND_Y_MAX 0x1BD0 +#define COOR_WORK_AROUND_PRESSURE_MAX 0xFF #define WACOM_I2C_TRANSFER_STYLE #if !defined(WACOM_I2C_TRANSFER_STYLE) #define WACOM_I2C_RECV_SEND_STYLE #endif -#ifdef CONFIG_MACH_Q1_BD +#define WACOM_MAX_COORD_X 11392 +#define WACOM_MAX_COORD_Y 7120 +#define WACOM_MAX_PRESSURE 0xFF + /* For Android origin */ -#define WACOM_POSX_MAX 7120 -#define WACOM_POSY_MAX 11392 -#define WACOM_PRESSURE_MAX 255 +#define WACOM_POSX_MAX WACOM_MAX_COORD_Y +#define WACOM_POSY_MAX WACOM_MAX_COORD_X #define MAX_ROTATION 4 #define MAX_HAND 2 -#endif /* CONFIG_MACH_Q1_BD */ -#endif /* !defined(WACOM_P4) */ + +#elif defined(CONFIG_MACH_T0) + +#define WACOM_MAX_COORD_X 12288 +#define WACOM_MAX_COORD_Y 6912 +#define WACOM_MAX_PRESSURE 0xFF + +/* For Android origin */ +#define WACOM_POSX_MAX WACOM_MAX_COORD_Y +#define WACOM_POSY_MAX WACOM_MAX_COORD_X + +#define COOR_WORK_AROUND +#define WACOM_IMPORT_FW_ALGO +#define WACOM_USE_OFFSET_TABLE +#define WACOM_USE_AVERAGING +#define WACOM_USE_BOXFILTER +#define WACOM_USE_TILT_OFFSET + +#define MAX_ROTATION 4 +#define MAX_HAND 2 + +#define WACOM_PEN_DETECT + +/* origin offset */ +#define EPEN_B660_ORG_X 456 +#define EPEN_B660_ORG_Y 504 + +#define EPEN_B713_ORG_X 676 +#define EPEN_B713_ORG_Y 724 + +/*Box Filter Parameters*/ +#define X_INC_S1 1500 +#define X_INC_E1 (WACOM_MAX_COORD_X - 1500) +#define Y_INC_S1 1500 +#define Y_INC_E1 (WACOM_MAX_COORD_Y - 1500) + +#define Y_INC_S2 700 +#define Y_INC_E2 (WACOM_MAX_COORD_Y - 700) +#define Y_INC_S3 900 +#define Y_INC_E3 (WACOM_MAX_COORD_Y - 900) + +#define CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK +#define WACOM_DVFS_LOCK_FREQ 800000 +#define BATTERY_SAVING_MODE + +/*HWID to distinguish Detect Switch*/ +#if defined(CONFIG_MACH_T0_EUR_LTE) \ + || defined(CONFIG_MACH_T0_EUR_OPEN) \ + || defined(CONFIG_MACH_T0_USA_ATT) \ + || defined(CONFIG_MACH_T0_USA_VZW) \ + || defined(CONFIG_MACH_T0_USA_SPR) \ + || defined(CONFIG_MACH_T0_USA_TMO) \ + || defined(CONFIG_MACH_T0GQ_JPN_LTE_DCM) \ + || defined(CONFIG_MACH_T0_JPN_LTE_DCM) \ + || defined(CONFIG_MACH_T0_CHN_OPEN) \ + || defined(CONFIG_MACH_T0_CHN_CU) \ + || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \ + || defined(CONFIG_MACH_T0_CHN_CMCC) \ + || defined(CONFIG_MACH_T0_CHN_CTC) \ + || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS) +#define WACOM_DETECT_SWITCH_HWID 7 + +#elif defined(CONFIG_MACH_T0_KOR_SKT) \ + || defined(CONFIG_MACH_T0_KOR_LGT) \ + || defined(CONFIG_MACH_T0_KOR_KT) +#define WACOM_DETECT_SWITCH_HWID 6 + +#elif defined(CONFIG_MACH_T0_USA_USCC) + #define WACOM_DETECT_SWITCH_HWID 8 + +#else + +#define WACOM_DETECT_SWITCH_HWID 0xFFFF +#endif + +/*HWID to distinguish FWE1*/ +#if defined(CONFIG_MACH_T0_EUR_LTE) \ + || defined(CONFIG_MACH_T0_EUR_OPEN) \ + || defined(CONFIG_MACH_T0_USA_ATT) \ + || defined(CONFIG_MACH_T0_USA_VZW) \ + || defined(CONFIG_MACH_T0_USA_SPR) \ + || defined(CONFIG_MACH_T0_USA_TMO) \ + || defined(CONFIG_MACH_T0_USA_USCC) \ + || defined(CONFIG_MACH_T0_KOR_SKT) \ + || defined(CONFIG_MACH_T0_KOR_KT) \ + || defined(CONFIG_MACH_T0_KOR_LGT) \ + || defined(CONFIG_MACH_T0GQ_JPN_LTE_DCM) \ + || defined(CONFIG_MACH_T0_JPN_LTE_DCM) \ + || defined(CONFIG_MACH_T0_CHN_OPEN) \ + || defined(CONFIG_MACH_T0_CHN_CU) \ + || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \ + || defined(CONFIG_MACH_T0_CHN_CMCC) \ + || defined(CONFIG_MACH_T0_CHN_CTC) \ + || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS) +#define WACOM_FWE1_HWID 8 + +#else +#define WACOM_FWE1_HWID 0xFFFF + +#endif + +/*HWID to distinguish B713 Digitizer*/ +#define WACOM_DTYPE_B713_HWID 4 +/*HWID to distinguish B746 Digitizer*/ +#if defined(CONFIG_MACH_T0_CHN_CMCC) +#define WACOM_DTYPE_B746_HWID 8 + +#elif defined(CONFIG_MACH_T0_EUR_LTE) \ + || defined(CONFIG_MACH_T0_EUR_OPEN) \ + || defined(CONFIG_MACH_T0_USA_ATT) \ + || defined(CONFIG_MACH_T0_USA_VZW) \ + || defined(CONFIG_MACH_T0_USA_SPR) \ + || defined(CONFIG_MACH_T0_KOR_SKT) \ + || defined(CONFIG_MACH_T0_KOR_LGT) \ + || defined(CONFIG_MACH_T0_KOR_KT) \ + || defined(CONFIG_MACH_T0_CHN_OPEN) \ + || defined(CONFIG_MACH_T0_CHN_CU) \ + || defined(CONFIG_MACH_T0_CHN_CU_DUOS) \ + || defined(CONFIG_MACH_T0_CHN_CTC) \ + || defined(CONFIG_MACH_T0_CHN_OPEN_DUOS) +#define WACOM_DTYPE_B746_HWID 9 + +#elif defined(CONFIG_MACH_T0_USA_TMO) \ + || defined(CONFIG_MACH_T0_USA_USCC) \ + || defined(CONFIG_MACH_T0_JPN_LTE_DCM) +#define WACOM_DTYPE_B746_HWID 10 + +#else +#define WACOM_DTYPE_B746_HWID 0xFFFF + +#endif + + +#endif /*End of Model config*/ #if !defined(WACOM_SLEEP_WITH_PEN_SLP) #define WACOM_SLEEP_WITH_PEN_LDO_EN #endif +#ifdef BATTERY_SAVING_MODE +#ifndef WACOM_PEN_DETECT +#define WACOM_PEN_DETECT +#endif +#endif + /*Parameters for wacom own features*/ struct wacom_features { int x_max; @@ -161,6 +328,12 @@ struct wacom_g5_platform_data { int max_pressure; int min_pressure; int gpio_pendct; +#ifdef WACOM_PEN_DETECT + int gpio_pen_insert; +#endif +#ifdef WACOM_HAVE_FWE_PIN + int gpio_fwe; +#endif int (*init_platform_hw)(void); int (*exit_platform_hw)(void); int (*suspend_platform_hw)(void); @@ -174,6 +347,7 @@ struct wacom_g5_platform_data { /*Parameters for i2c driver*/ struct wacom_i2c { struct i2c_client *client; + struct i2c_client *client_boot; struct input_dev *input_dev; struct early_suspend early_suspend; struct mutex lock; @@ -182,6 +356,7 @@ struct wacom_i2c { int irq; #ifdef WACOM_PDCT_WORK_AROUND int irq_pdct; + bool rdy_pdct; #endif int pen_pdct; int gpio; @@ -190,12 +365,29 @@ struct wacom_i2c { int pen_pressed; int side_pressed; int tool; + u16 last_x; + u16 last_y; +#ifdef WACOM_PEN_DETECT + struct delayed_work pen_insert_dwork; + bool pen_insert; + int gpio_pen_insert; +#ifdef CONFIG_MACH_T0 + int invert_pen_insert; +#endif +#endif +#ifdef WACOM_HAVE_FWE_PIN + int gpio_fwe; +#endif +#ifdef WACOM_IMPORT_FW_ALGO + bool use_offset_table; + bool use_box_filter; +#endif + bool checksum_result; const char name[NAMEBUF]; struct wacom_features *wac_feature; struct wacom_g5_platform_data *wac_pdata; struct wacom_g5_callbacks callbacks; int (*power)(int on); - struct work_struct update_work; struct delayed_work resume_work; #ifdef WACOM_IRQ_WORK_AROUND struct delayed_work pendct_dwork; @@ -204,10 +396,20 @@ struct wacom_i2c { unsigned int cpufreq_level; bool dvfs_lock_status; struct delayed_work dvfs_work; -#if defined(CONFIG_MACH_P4NOTE) struct device *bus_dev; #endif +#ifdef CONFIG_MACH_P4NOTE + bool pen_type; +#endif +#ifdef WACOM_CONNECTION_CHECK + bool connection_check; +#endif +#ifdef BATTERY_SAVING_MODE + bool battery_saving_mode; #endif + bool power_enable; + bool boot_mode; + bool query_status; }; #endif /* _LINUX_WACOM_I2C_H */ diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h index a9407fe..a9407fe 100755..100644 --- a/include/linux/wakelock.h +++ b/include/linux/wakelock.h 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 <linux/miscdevice.h> +#include <linux/wakelock.h> +#include <linux/notifier.h> +#include <linux/mutex.h> +#include <asm/byteorder.h> + +#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 diff --git a/include/media/isdbt_pdata.h b/include/media/isdbt_pdata.h new file mode 100644 index 0000000..88f07ca --- /dev/null +++ b/include/media/isdbt_pdata.h @@ -0,0 +1,25 @@ +/* +* Copyright (C) (2011, Samsung Electronics) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#ifndef _ISDBT_PDATA_H_ +#define _ISDBT_PDATA_H_ + +#if defined(CONFIG_ISDBT) +struct isdbt_platform_data { + void (*gpio_on) (void); + void (*gpio_off)(void); + int irq; +}; +#endif +#endif diff --git a/include/media/m9mo_platform.h b/include/media/m9mo_platform.h index ba9799a..f7a6cef 100644 --- a/include/media/m9mo_platform.h +++ b/include/media/m9mo_platform.h @@ -19,5 +19,6 @@ struct m9mo_platform_data { /* ISP interrupt */ int (*config_isp_irq)(void); int (*config_sambaz)(int); + int (*af_led_power)(int); int irq; }; diff --git a/include/media/s5k5bbgx_platform.h b/include/media/s5k5bbgx_platform.h new file mode 100644 index 0000000..7db9215 --- /dev/null +++ b/include/media/s5k5bbgx_platform.h @@ -0,0 +1,23 @@ +/* + * Driver for S5K5BBGX (VGA camera) from SAMSUNG ELECTRONICS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#define DEFAULT_FMT V4L2_PIX_FMT_UYVY /* YUV422 */ +#define DEFAULT_PREVIEW_WIDTH 640 +#define DEFAULT_PREVIEW_HEIGHT 480 +#define DEFAULT_CAPTURE_WIDTH 1600 +#define DEFAULT_CAPTURE_HEIGHT 1200 + +struct s5k5bbgx_platform_data { + unsigned int default_width; + unsigned int default_height; + unsigned int pixelformat; + int freq; /* MCLK in KHz */ + /* This SoC supports Parallel & CSI-2 */ + int is_mipi; +}; diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index bef6665..94f22c4 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -23,6 +23,8 @@ */ #ifdef CONFIG_BT_MGMT #include "bluetooth_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/bluetooth.h" #else #ifndef __BLUETOOTH_H #define __BLUETOOTH_H diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 0745a56..7ba1e29 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -7,7 +7,6 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation; - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. @@ -23,6 +22,8 @@ */ #ifdef CONFIG_BT_MGMT #include "hci_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/hci.h" #else #ifndef __HCI_H #define __HCI_H diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4b677c6c..c2c6b31 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -23,6 +23,8 @@ */ #ifdef CONFIG_BT_MGMT #include "hci_core_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/hci_core.h" #else #ifndef __HCI_CORE_H #define __HCI_CORE_H diff --git a/include/net/bluetooth/hci_mgmt.h b/include/net/bluetooth/hci_mgmt.h index 651bccf..4c2f12a 100644 --- a/include/net/bluetooth/hci_mgmt.h +++ b/include/net/bluetooth/hci_mgmt.h @@ -172,9 +172,16 @@ enum { #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) -#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \ - EDR_ESCO_MASK) - +/* SS_BLUETOOTH(is80.hwang) 2012.03.02 */ +/* change applied EDR ESCO packet */ +#ifdef CONFIG_BT_CSR8811 +#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \ +ESCO_2EV3 /*EDR_ESCO_MASK*/) +#else +#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \ +EDR_ESCO_MASK) +#endif +/* SS_BLUEZ_BT(is80.hwang) End */ /* wbs */ /* Air Coding Format */ #define ACF_TRANS 0x0003; diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h new file mode 120000 index 0000000..e48f44c --- /dev/null +++ b/include/net/bluetooth/hci_mon.h @@ -0,0 +1 @@ +tizen/hci_mon.h
\ No newline at end of file diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index f3e7462..aec1d8e 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -25,6 +25,8 @@ */ #ifdef CONFIG_BT_MGMT #include "l2cap_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/l2cap.h" #else #ifndef __L2CAP_H #define __L2CAP_H diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 2f20e5b..d78593b 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h @@ -23,6 +23,8 @@ #ifdef CONFIG_BT_MGMT #include "mgmt_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/mgmt.h" #else #define MGMT_INDEX_NONE 0xFFFF diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 4e24fcd..45261cc 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h @@ -20,7 +20,9 @@ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ - +#if defined(CONFIG_BT_TIZEN) +#include "tizen/rfcomm.h" +#else #ifndef __RFCOMM_H #define __RFCOMM_H @@ -370,3 +372,4 @@ static inline void rfcomm_cleanup_ttys(void) } #endif #endif /* __RFCOMM_H */ +#endif /* CONFIG_BT_TIZEN */ diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index cd56952..7f2869a 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h @@ -24,6 +24,8 @@ #ifdef CONFIG_BT_MGMT #include "sco_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/sco.h" #else #ifndef __SCO_H #define __SCO_H diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index ad5a29e..111f3a2 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h @@ -21,6 +21,8 @@ */ #ifdef CONFIG_BT_MGMT #include "smp_mgmt.h" +#elif defined(CONFIG_BT_TIZEN) +#include "tizen/smp.h" #else #ifndef __SMP_H #define __SMP_H diff --git a/include/net/bluetooth/tizen/bluetooth.h b/include/net/bluetooth/tizen/bluetooth.h new file mode 100644 index 0000000..2e686f4 --- /dev/null +++ b/include/net/bluetooth/tizen/bluetooth.h @@ -0,0 +1,288 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + + Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __BLUETOOTH_H +#define __BLUETOOTH_H + +#include <asm/types.h> +#include <asm/byteorder.h> +#include <linux/list.h> +#include <linux/poll.h> +#include <net/sock.h> + +#ifndef AF_BLUETOOTH +#define AF_BLUETOOTH 31 +#define PF_BLUETOOTH AF_BLUETOOTH +#endif + +/* Bluetooth versions */ +#define BLUETOOTH_VER_1_1 1 +#define BLUETOOTH_VER_1_2 2 +#define BLUETOOTH_VER_2_0 3 + +/* Reserv for core and drivers use */ +#define BT_SKB_RESERVE 8 + +#define BTPROTO_L2CAP 0 +#define BTPROTO_HCI 1 +#define BTPROTO_SCO 2 +#define BTPROTO_RFCOMM 3 +#define BTPROTO_BNEP 4 +#define BTPROTO_CMTP 5 +#define BTPROTO_HIDP 6 +#define BTPROTO_AVDTP 7 + +#define SOL_HCI 0 +#define SOL_L2CAP 6 +#define SOL_SCO 17 +#define SOL_RFCOMM 18 + +#define BT_SECURITY 4 +struct bt_security { + __u8 level; + __u8 key_size; +}; +#define BT_SECURITY_SDP 0 +#define BT_SECURITY_LOW 1 +#define BT_SECURITY_MEDIUM 2 +#define BT_SECURITY_HIGH 3 + +#define BT_DEFER_SETUP 7 + +#define BT_FLUSHABLE 8 + +#define BT_FLUSHABLE_OFF 0 +#define BT_FLUSHABLE_ON 1 + +#define BT_POWER 9 +struct bt_power { + __u8 force_active; +}; +#define BT_POWER_FORCE_ACTIVE_OFF 0 +#define BT_POWER_FORCE_ACTIVE_ON 1 + +#define BT_CHANNEL_POLICY 10 + +/* BR/EDR only (default policy) + * AMP controllers cannot be used. + * Channel move requests from the remote device are denied. + * If the L2CAP channel is currently using AMP, move the channel to BR/EDR. + */ +#define BT_CHANNEL_POLICY_BREDR_ONLY 0 + +/* BR/EDR Preferred + * Allow use of AMP controllers. + * If the L2CAP channel is currently on AMP, move it to BR/EDR. + * Channel move requests from the remote device are allowed. + */ +#define BT_CHANNEL_POLICY_BREDR_PREFERRED 1 + +/* AMP Preferred + * Allow use of AMP controllers + * If the L2CAP channel is currently on BR/EDR and AMP controller + * resources are available, initiate a channel move to AMP. + * Channel move requests from the remote device are allowed. + * If the L2CAP socket has not been connected yet, try to create + * and configure the channel directly on an AMP controller rather + * than BR/EDR. + */ +#define BT_CHANNEL_POLICY_AMP_PREFERRED 2 + +__printf(1, 2) +int bt_info(const char *fmt, ...); +__printf(1, 2) +int bt_err(const char *fmt, ...); + +#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) +#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) +#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__) + +/* Connection and socket states */ +enum { + BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ + BT_OPEN, + BT_BOUND, + BT_LISTEN, + BT_CONNECT, + BT_CONNECT2, + BT_CONFIG, + BT_DISCONN, + BT_CLOSED +}; + +/* If unused will be removed by compiler */ +static inline const char *state_to_string(int state) +{ + switch (state) { + case BT_CONNECTED: + return "BT_CONNECTED"; + case BT_OPEN: + return "BT_OPEN"; + case BT_BOUND: + return "BT_BOUND"; + case BT_LISTEN: + return "BT_LISTEN"; + case BT_CONNECT: + return "BT_CONNECT"; + case BT_CONNECT2: + return "BT_CONNECT2"; + case BT_CONFIG: + return "BT_CONFIG"; + case BT_DISCONN: + return "BT_DISCONN"; + case BT_CLOSED: + return "BT_CLOSED"; + } + + return "invalid state"; +} + +/* BD Address */ +typedef struct { + __u8 b[6]; +} __packed bdaddr_t; + +#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) +#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) + +/* Copy, swap, convert BD Address */ +static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) +{ + return memcmp(ba1, ba2, sizeof(bdaddr_t)); +} +static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) +{ + memcpy(dst, src, sizeof(bdaddr_t)); +} + +void baswap(bdaddr_t *dst, bdaddr_t *src); +char *batostr(bdaddr_t *ba); +bdaddr_t *strtoba(char *str); + +/* Common socket structures and functions */ + +#define bt_sk(__sk) ((struct bt_sock *) __sk) + +struct bt_sock { + struct sock sk; + bdaddr_t src; + bdaddr_t dst; + struct list_head accept_q; + struct sock *parent; + u32 defer_setup; + bool suspended; +}; + +struct bt_sock_list { + struct hlist_head head; + rwlock_t lock; +}; + +int bt_sock_register(int proto, const struct net_proto_family *ops); +int bt_sock_unregister(int proto); +void bt_sock_link(struct bt_sock_list *l, struct sock *s); +void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); +int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *msg, size_t len, int flags); +int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, + struct msghdr *msg, size_t len, int flags); +uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); +int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); + +void bt_accept_enqueue(struct sock *parent, struct sock *sk); +void bt_accept_unlink(struct sock *sk); +struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); + +/* Skb helpers */ +struct bt_skb_cb { + __u8 pkt_type; + __u8 incoming; + __u16 expect; + __u16 tx_seq; + __u8 retries; + __u8 sar; + __u8 force_active; +}; +#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) + +static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) +{ + struct sk_buff *skb; + + if ((skb = alloc_skb(len + BT_SKB_RESERVE, how))) { + skb_reserve(skb, BT_SKB_RESERVE); + bt_cb(skb)->incoming = 0; + } + return skb; +} + +static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, + unsigned long len, int nb, int *err) +{ + struct sk_buff *skb; + + if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { + skb_reserve(skb, BT_SKB_RESERVE); + bt_cb(skb)->incoming = 0; + } + + if (!skb && *err) + return NULL; + + *err = sock_error(sk); + if (*err) + goto out; + + if (sk->sk_shutdown) { + *err = -ECONNRESET; + goto out; + } + + return skb; + +out: + kfree_skb(skb); + return NULL; +} + +int bt_to_errno(__u16 code); + +extern int hci_sock_init(void); +extern void hci_sock_cleanup(void); + +extern int bt_sysfs_init(void); +extern void bt_sysfs_cleanup(void); + +extern struct dentry *bt_debugfs; + +int l2cap_init(void); +void l2cap_exit(void); + +int sco_init(void); +void sco_exit(void); + +void bt_sock_reclassify_lock(struct sock *sk, int proto); + +#endif /* __BLUETOOTH_H */ diff --git a/include/net/bluetooth/tizen/hci.h b/include/net/bluetooth/tizen/hci.h new file mode 100644 index 0000000..d47e523 --- /dev/null +++ b/include/net/bluetooth/tizen/hci.h @@ -0,0 +1,1436 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + + Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __HCI_H +#define __HCI_H + +#define HCI_MAX_ACL_SIZE 1024 +#define HCI_MAX_SCO_SIZE 255 +#define HCI_MAX_EVENT_SIZE 260 +#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) + +/* HCI dev events */ +#define HCI_DEV_REG 1 +#define HCI_DEV_UNREG 2 +#define HCI_DEV_UP 3 +#define HCI_DEV_DOWN 4 +#define HCI_DEV_SUSPEND 5 +#define HCI_DEV_RESUME 6 + +/* HCI notify events */ +#define HCI_NOTIFY_CONN_ADD 1 +#define HCI_NOTIFY_CONN_DEL 2 +#define HCI_NOTIFY_VOICE_SETTING 3 + +/* HCI bus types */ +#define HCI_VIRTUAL 0 +#define HCI_USB 1 +#define HCI_PCCARD 2 +#define HCI_UART 3 +#define HCI_RS232 4 +#define HCI_PCI 5 +#define HCI_SDIO 6 + +/* HCI controller types */ +#define HCI_BREDR 0x00 +#define HCI_AMP 0x01 + +/* HCI device quirks */ +enum { + HCI_QUIRK_NO_RESET, + HCI_QUIRK_RAW_DEVICE, + HCI_QUIRK_FIXUP_BUFFER_SIZE +}; + +/* HCI device flags */ +enum { + HCI_UP, + HCI_INIT, + HCI_RUNNING, + + HCI_PSCAN, + HCI_ISCAN, + HCI_AUTH, + HCI_ENCRYPT, + HCI_INQUIRY, + + HCI_RAW, + + HCI_RESET, +}; + +/* + * BR/EDR and/or LE controller flags: the flags defined here should represent + * states from the controller. + */ +enum { + HCI_SETUP, + HCI_AUTO_OFF, + HCI_MGMT, + HCI_PAIRABLE, + HCI_SERVICE_CACHE, + HCI_LINK_KEYS, + HCI_DEBUG_KEYS, + HCI_UNREGISTER, + + HCI_LE_SCAN, + HCI_SSP_ENABLED, + HCI_HS_ENABLED, + HCI_LE_ENABLED, + HCI_CONNECTABLE, + HCI_DISCOVERABLE, + HCI_LINK_SECURITY, + HCI_PENDING_CLASS, +}; + +/* HCI ioctl defines */ +#define HCIDEVUP _IOW('H', 201, int) +#define HCIDEVDOWN _IOW('H', 202, int) +#define HCIDEVRESET _IOW('H', 203, int) +#define HCIDEVRESTAT _IOW('H', 204, int) + +#define HCIGETDEVLIST _IOR('H', 210, int) +#define HCIGETDEVINFO _IOR('H', 211, int) +#define HCIGETCONNLIST _IOR('H', 212, int) +#define HCIGETCONNINFO _IOR('H', 213, int) +#define HCIGETAUTHINFO _IOR('H', 215, int) + +#define HCISETRAW _IOW('H', 220, int) +#define HCISETSCAN _IOW('H', 221, int) +#define HCISETAUTH _IOW('H', 222, int) +#define HCISETENCRYPT _IOW('H', 223, int) +#define HCISETPTYPE _IOW('H', 224, int) +#define HCISETLINKPOL _IOW('H', 225, int) +#define HCISETLINKMODE _IOW('H', 226, int) +#define HCISETACLMTU _IOW('H', 227, int) +#define HCISETSCOMTU _IOW('H', 228, int) + +#define HCIBLOCKADDR _IOW('H', 230, int) +#define HCIUNBLOCKADDR _IOW('H', 231, int) + +#define HCIINQUIRY _IOR('H', 240, int) + +/* HCI timeouts */ +#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ +#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ +#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ +#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ +#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ +#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ +#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */ + +/* HCI data types */ +#define HCI_COMMAND_PKT 0x01 +#define HCI_ACLDATA_PKT 0x02 +#define HCI_SCODATA_PKT 0x03 +#define HCI_EVENT_PKT 0x04 +#define HCI_VENDOR_PKT 0xff + +/* HCI packet types */ +#define HCI_DM1 0x0008 +#define HCI_DM3 0x0400 +#define HCI_DM5 0x4000 +#define HCI_DH1 0x0010 +#define HCI_DH3 0x0800 +#define HCI_DH5 0x8000 + +#define HCI_HV1 0x0020 +#define HCI_HV2 0x0040 +#define HCI_HV3 0x0080 + +#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) +#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) + +/* eSCO packet types */ +#define ESCO_HV1 0x0001 +#define ESCO_HV2 0x0002 +#define ESCO_HV3 0x0004 +#define ESCO_EV3 0x0008 +#define ESCO_EV4 0x0010 +#define ESCO_EV5 0x0020 +#define ESCO_2EV3 0x0040 +#define ESCO_3EV3 0x0080 +#define ESCO_2EV5 0x0100 +#define ESCO_3EV5 0x0200 + +#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) +#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) + +/* ACL flags */ +#define ACL_START_NO_FLUSH 0x00 +#define ACL_CONT 0x01 +#define ACL_START 0x02 +#define ACL_ACTIVE_BCAST 0x04 +#define ACL_PICO_BCAST 0x08 + +/* Baseband links */ +#define SCO_LINK 0x00 +#define ACL_LINK 0x01 +#define ESCO_LINK 0x02 +/* Low Energy links do not have defined link type. Use invented one */ +#define LE_LINK 0x80 + +/* LMP features */ +#define LMP_3SLOT 0x01 +#define LMP_5SLOT 0x02 +#define LMP_ENCRYPT 0x04 +#define LMP_SOFFSET 0x08 +#define LMP_TACCURACY 0x10 +#define LMP_RSWITCH 0x20 +#define LMP_HOLD 0x40 +#define LMP_SNIFF 0x80 + +#define LMP_PARK 0x01 +#define LMP_RSSI 0x02 +#define LMP_QUALITY 0x04 +#define LMP_SCO 0x08 +#define LMP_HV2 0x10 +#define LMP_HV3 0x20 +#define LMP_ULAW 0x40 +#define LMP_ALAW 0x80 + +#define LMP_CVSD 0x01 +#define LMP_PSCHEME 0x02 +#define LMP_PCONTROL 0x04 + +#define LMP_RSSI_INQ 0x40 +#define LMP_ESCO 0x80 + +#define LMP_EV4 0x01 +#define LMP_EV5 0x02 +#define LMP_NO_BREDR 0x20 +#define LMP_LE 0x40 + +#define LMP_SNIFF_SUBR 0x02 +#define LMP_PAUSE_ENC 0x04 +#define LMP_EDR_ESCO_2M 0x20 +#define LMP_EDR_ESCO_3M 0x40 +#define LMP_EDR_3S_ESCO 0x80 + +#define LMP_EXT_INQ 0x01 +#define LMP_SIMUL_LE_BR 0x02 +#define LMP_SIMPLE_PAIR 0x08 +#define LMP_NO_FLUSH 0x40 + +#define LMP_LSTO 0x01 +#define LMP_INQ_TX_PWR 0x02 +#define LMP_EXTFEATURES 0x80 + +/* Extended LMP features */ +#define LMP_HOST_SSP 0x01 +#define LMP_HOST_LE 0x02 +#define LMP_HOST_LE_BREDR 0x04 + +/* Connection modes */ +#define HCI_CM_ACTIVE 0x0000 +#define HCI_CM_HOLD 0x0001 +#define HCI_CM_SNIFF 0x0002 +#define HCI_CM_PARK 0x0003 + +/* Link policies */ +#define HCI_LP_RSWITCH 0x0001 +#define HCI_LP_HOLD 0x0002 +#define HCI_LP_SNIFF 0x0004 +#define HCI_LP_PARK 0x0008 + +/* Link modes */ +#define HCI_LM_ACCEPT 0x8000 +#define HCI_LM_MASTER 0x0001 +#define HCI_LM_AUTH 0x0002 +#define HCI_LM_ENCRYPT 0x0004 +#define HCI_LM_TRUSTED 0x0008 +#define HCI_LM_RELIABLE 0x0010 +#define HCI_LM_SECURE 0x0020 + +/* Authentication types */ +#define HCI_AT_NO_BONDING 0x00 +#define HCI_AT_NO_BONDING_MITM 0x01 +#define HCI_AT_DEDICATED_BONDING 0x02 +#define HCI_AT_DEDICATED_BONDING_MITM 0x03 +#define HCI_AT_GENERAL_BONDING 0x04 +#define HCI_AT_GENERAL_BONDING_MITM 0x05 + +/* Link Key types */ +#define HCI_LK_COMBINATION 0x00 +#define HCI_LK_LOCAL_UNIT 0x01 +#define HCI_LK_REMOTE_UNIT 0x02 +#define HCI_LK_DEBUG_COMBINATION 0x03 +#define HCI_LK_UNAUTH_COMBINATION 0x04 +#define HCI_LK_AUTH_COMBINATION 0x05 +#define HCI_LK_CHANGED_COMBINATION 0x06 +/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ +#define HCI_SMP_STK 0x80 +#define HCI_SMP_STK_SLAVE 0x81 +#define HCI_SMP_LTK 0x82 +#define HCI_SMP_LTK_SLAVE 0x83 + +/* ---- HCI Error Codes ---- */ +#define HCI_ERROR_AUTH_FAILURE 0x05 +#define HCI_ERROR_REJ_BAD_ADDR 0x0f +#define HCI_ERROR_REMOTE_USER_TERM 0x13 +#define HCI_ERROR_LOCAL_HOST_TERM 0x16 +#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 + +/* Flow control modes */ +#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 +#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 + +/* Extended Inquiry Response field types */ +#define EIR_FLAGS 0x01 /* flags */ +#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ +#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ +#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ +#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ +#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ +#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ +#define EIR_NAME_SHORT 0x08 /* shortened local name */ +#define EIR_NAME_COMPLETE 0x09 /* complete local name */ +#define EIR_TX_POWER 0x0A /* transmit power level */ +#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ +#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ +#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ +#define EIR_DEVICE_ID 0x10 /* device ID */ + +/* ----- HCI Commands ---- */ +#define HCI_OP_NOP 0x0000 + +#define HCI_OP_INQUIRY 0x0401 +struct hci_cp_inquiry { + __u8 lap[3]; + __u8 length; + __u8 num_rsp; +} __packed; + +#define HCI_OP_INQUIRY_CANCEL 0x0402 + +#define HCI_OP_EXIT_PERIODIC_INQ 0x0404 + +#define HCI_OP_CREATE_CONN 0x0405 +struct hci_cp_create_conn { + bdaddr_t bdaddr; + __le16 pkt_type; + __u8 pscan_rep_mode; + __u8 pscan_mode; + __le16 clock_offset; + __u8 role_switch; +} __packed; + +#define HCI_OP_DISCONNECT 0x0406 +struct hci_cp_disconnect { + __le16 handle; + __u8 reason; +} __packed; + +#define HCI_OP_ADD_SCO 0x0407 +struct hci_cp_add_sco { + __le16 handle; + __le16 pkt_type; +} __packed; + +#define HCI_OP_CREATE_CONN_CANCEL 0x0408 +struct hci_cp_create_conn_cancel { + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_ACCEPT_CONN_REQ 0x0409 +struct hci_cp_accept_conn_req { + bdaddr_t bdaddr; + __u8 role; +} __packed; + +#define HCI_OP_REJECT_CONN_REQ 0x040a +struct hci_cp_reject_conn_req { + bdaddr_t bdaddr; + __u8 reason; +} __packed; + +#define HCI_OP_LINK_KEY_REPLY 0x040b +struct hci_cp_link_key_reply { + bdaddr_t bdaddr; + __u8 link_key[16]; +} __packed; + +#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c +struct hci_cp_link_key_neg_reply { + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_PIN_CODE_REPLY 0x040d +struct hci_cp_pin_code_reply { + bdaddr_t bdaddr; + __u8 pin_len; + __u8 pin_code[16]; +} __packed; +struct hci_rp_pin_code_reply { + __u8 status; + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e +struct hci_cp_pin_code_neg_reply { + bdaddr_t bdaddr; +} __packed; +struct hci_rp_pin_code_neg_reply { + __u8 status; + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_CHANGE_CONN_PTYPE 0x040f +struct hci_cp_change_conn_ptype { + __le16 handle; + __le16 pkt_type; +} __packed; + +#define HCI_OP_AUTH_REQUESTED 0x0411 +struct hci_cp_auth_requested { + __le16 handle; +} __packed; + +#define HCI_OP_SET_CONN_ENCRYPT 0x0413 +struct hci_cp_set_conn_encrypt { + __le16 handle; + __u8 encrypt; +} __packed; + +#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 +struct hci_cp_change_conn_link_key { + __le16 handle; +} __packed; + +#define HCI_OP_REMOTE_NAME_REQ 0x0419 +struct hci_cp_remote_name_req { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_mode; + __le16 clock_offset; +} __packed; + +#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a +struct hci_cp_remote_name_req_cancel { + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_READ_REMOTE_FEATURES 0x041b +struct hci_cp_read_remote_features { + __le16 handle; +} __packed; + +#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c +struct hci_cp_read_remote_ext_features { + __le16 handle; + __u8 page; +} __packed; + +#define HCI_OP_READ_REMOTE_VERSION 0x041d +struct hci_cp_read_remote_version { + __le16 handle; +} __packed; + +#define HCI_OP_SETUP_SYNC_CONN 0x0428 +struct hci_cp_setup_sync_conn { + __le16 handle; + __le32 tx_bandwidth; + __le32 rx_bandwidth; + __le16 max_latency; + __le16 voice_setting; + __u8 retrans_effort; + __le16 pkt_type; +} __packed; + +#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 +struct hci_cp_accept_sync_conn_req { + bdaddr_t bdaddr; + __le32 tx_bandwidth; + __le32 rx_bandwidth; + __le16 max_latency; + __le16 content_format; + __u8 retrans_effort; + __le16 pkt_type; +} __packed; + +#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a +struct hci_cp_reject_sync_conn_req { + bdaddr_t bdaddr; + __u8 reason; +} __packed; + +#define HCI_OP_IO_CAPABILITY_REPLY 0x042b +struct hci_cp_io_capability_reply { + bdaddr_t bdaddr; + __u8 capability; + __u8 oob_data; + __u8 authentication; +} __packed; + +#define HCI_OP_USER_CONFIRM_REPLY 0x042c +struct hci_cp_user_confirm_reply { + bdaddr_t bdaddr; +} __packed; +struct hci_rp_user_confirm_reply { + __u8 status; + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d + +#define HCI_OP_USER_PASSKEY_REPLY 0x042e +struct hci_cp_user_passkey_reply { + bdaddr_t bdaddr; + __le32 passkey; +} __packed; + +#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f + +#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 +struct hci_cp_remote_oob_data_reply { + bdaddr_t bdaddr; + __u8 hash[16]; + __u8 randomizer[16]; +} __packed; + +#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 +struct hci_cp_remote_oob_data_neg_reply { + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 +struct hci_cp_io_capability_neg_reply { + bdaddr_t bdaddr; + __u8 reason; +} __packed; + +#define HCI_OP_SNIFF_MODE 0x0803 +struct hci_cp_sniff_mode { + __le16 handle; + __le16 max_interval; + __le16 min_interval; + __le16 attempt; + __le16 timeout; +} __packed; + +#define HCI_OP_EXIT_SNIFF_MODE 0x0804 +struct hci_cp_exit_sniff_mode { + __le16 handle; +} __packed; + +#define HCI_OP_ROLE_DISCOVERY 0x0809 +struct hci_cp_role_discovery { + __le16 handle; +} __packed; +struct hci_rp_role_discovery { + __u8 status; + __le16 handle; + __u8 role; +} __packed; + +#define HCI_OP_SWITCH_ROLE 0x080b +struct hci_cp_switch_role { + bdaddr_t bdaddr; + __u8 role; +} __packed; + +#define HCI_OP_READ_LINK_POLICY 0x080c +struct hci_cp_read_link_policy { + __le16 handle; +} __packed; +struct hci_rp_read_link_policy { + __u8 status; + __le16 handle; + __le16 policy; +} __packed; + +#define HCI_OP_WRITE_LINK_POLICY 0x080d +struct hci_cp_write_link_policy { + __le16 handle; + __le16 policy; +} __packed; +struct hci_rp_write_link_policy { + __u8 status; + __le16 handle; +} __packed; + +#define HCI_OP_READ_DEF_LINK_POLICY 0x080e +struct hci_rp_read_def_link_policy { + __u8 status; + __le16 policy; +} __packed; + +#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f +struct hci_cp_write_def_link_policy { + __le16 policy; +} __packed; + +#define HCI_OP_SNIFF_SUBRATE 0x0811 +struct hci_cp_sniff_subrate { + __le16 handle; + __le16 max_latency; + __le16 min_remote_timeout; + __le16 min_local_timeout; +} __packed; + +#define HCI_OP_SET_EVENT_MASK 0x0c01 +struct hci_cp_set_event_mask { + __u8 mask[8]; +} __packed; + +#define HCI_OP_RESET 0x0c03 + +#define HCI_OP_SET_EVENT_FLT 0x0c05 +struct hci_cp_set_event_flt { + __u8 flt_type; + __u8 cond_type; + __u8 condition[0]; +} __packed; + +/* Filter types */ +#define HCI_FLT_CLEAR_ALL 0x00 +#define HCI_FLT_INQ_RESULT 0x01 +#define HCI_FLT_CONN_SETUP 0x02 + +/* CONN_SETUP Condition types */ +#define HCI_CONN_SETUP_ALLOW_ALL 0x00 +#define HCI_CONN_SETUP_ALLOW_CLASS 0x01 +#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 + +/* CONN_SETUP Conditions */ +#define HCI_CONN_SETUP_AUTO_OFF 0x01 +#define HCI_CONN_SETUP_AUTO_ON 0x02 + +#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 +struct hci_cp_delete_stored_link_key { + bdaddr_t bdaddr; + __u8 delete_all; +} __packed; + +#define HCI_MAX_NAME_LENGTH 248 + +#define HCI_OP_WRITE_LOCAL_NAME 0x0c13 +struct hci_cp_write_local_name { + __u8 name[HCI_MAX_NAME_LENGTH]; +} __packed; + +#define HCI_OP_READ_LOCAL_NAME 0x0c14 +struct hci_rp_read_local_name { + __u8 status; + __u8 name[HCI_MAX_NAME_LENGTH]; +} __packed; + +#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 + +#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 + +#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a + #define SCAN_DISABLED 0x00 + #define SCAN_INQUIRY 0x01 + #define SCAN_PAGE 0x02 + +#define HCI_OP_READ_AUTH_ENABLE 0x0c1f + +#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 + #define AUTH_DISABLED 0x00 + #define AUTH_ENABLED 0x01 + +#define HCI_OP_READ_ENCRYPT_MODE 0x0c21 + +#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 + #define ENCRYPT_DISABLED 0x00 + #define ENCRYPT_P2P 0x01 + #define ENCRYPT_BOTH 0x02 + +#define HCI_OP_READ_CLASS_OF_DEV 0x0c23 +struct hci_rp_read_class_of_dev { + __u8 status; + __u8 dev_class[3]; +} __packed; + +#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 +struct hci_cp_write_class_of_dev { + __u8 dev_class[3]; +} __packed; + +#define HCI_OP_READ_VOICE_SETTING 0x0c25 +struct hci_rp_read_voice_setting { + __u8 status; + __le16 voice_setting; +} __packed; + +#define HCI_OP_WRITE_VOICE_SETTING 0x0c26 +struct hci_cp_write_voice_setting { + __le16 voice_setting; +} __packed; + +#define HCI_OP_HOST_BUFFER_SIZE 0x0c33 +struct hci_cp_host_buffer_size { + __le16 acl_mtu; + __u8 sco_mtu; + __le16 acl_max_pkt; + __le16 sco_max_pkt; +} __packed; + +#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 + +#define HCI_MAX_EIR_LENGTH 240 + +#define HCI_OP_WRITE_EIR 0x0c52 +struct hci_cp_write_eir { + __u8 fec; + __u8 data[HCI_MAX_EIR_LENGTH]; +} __packed; + +#define HCI_OP_READ_SSP_MODE 0x0c55 +struct hci_rp_read_ssp_mode { + __u8 status; + __u8 mode; +} __packed; + +#define HCI_OP_WRITE_SSP_MODE 0x0c56 +struct hci_cp_write_ssp_mode { + __u8 mode; +} __packed; + +#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 +struct hci_rp_read_local_oob_data { + __u8 status; + __u8 hash[16]; + __u8 randomizer[16]; +} __packed; + +#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 + +#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 +struct hci_rp_read_flow_control_mode { + __u8 status; + __u8 mode; +} __packed; + +#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d +struct hci_cp_write_le_host_supported { + __u8 le; + __u8 simul; +} __packed; + +#define HCI_OP_READ_LOCAL_VERSION 0x1001 +struct hci_rp_read_local_version { + __u8 status; + __u8 hci_ver; + __le16 hci_rev; + __u8 lmp_ver; + __le16 manufacturer; + __le16 lmp_subver; +} __packed; + +#define HCI_OP_READ_LOCAL_COMMANDS 0x1002 +struct hci_rp_read_local_commands { + __u8 status; + __u8 commands[64]; +} __packed; + +#define HCI_OP_READ_LOCAL_FEATURES 0x1003 +struct hci_rp_read_local_features { + __u8 status; + __u8 features[8]; +} __packed; + +#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 +struct hci_cp_read_local_ext_features { + __u8 page; +} __packed; +struct hci_rp_read_local_ext_features { + __u8 status; + __u8 page; + __u8 max_page; + __u8 features[8]; +} __packed; + +#define HCI_OP_READ_BUFFER_SIZE 0x1005 +struct hci_rp_read_buffer_size { + __u8 status; + __le16 acl_mtu; + __u8 sco_mtu; + __le16 acl_max_pkt; + __le16 sco_max_pkt; +} __packed; + +#define HCI_OP_READ_BD_ADDR 0x1009 +struct hci_rp_read_bd_addr { + __u8 status; + bdaddr_t bdaddr; +} __packed; + +#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a +struct hci_rp_read_data_block_size { + __u8 status; + __le16 max_acl_len; + __le16 block_len; + __le16 num_blocks; +} __packed; + +#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c +struct hci_cp_write_page_scan_activity { + __le16 interval; + __le16 window; +} __packed; + +#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 + #define PAGE_SCAN_TYPE_STANDARD 0x00 + #define PAGE_SCAN_TYPE_INTERLACED 0x01 + +#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 +struct hci_rp_read_local_amp_info { + __u8 status; + __u8 amp_status; + __le32 total_bw; + __le32 max_bw; + __le32 min_latency; + __le32 max_pdu; + __u8 amp_type; + __le16 pal_cap; + __le16 max_assoc_size; + __le32 max_flush_to; + __le32 be_flush_to; +} __packed; + +#define HCI_OP_LE_SET_EVENT_MASK 0x2001 +struct hci_cp_le_set_event_mask { + __u8 mask[8]; +} __packed; + +#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 +struct hci_rp_le_read_buffer_size { + __u8 status; + __le16 le_mtu; + __u8 le_max_pkt; +} __packed; + +#define HCI_OP_LE_SET_SCAN_PARAM 0x200b +struct hci_cp_le_set_scan_param { + __u8 type; + __le16 interval; + __le16 window; + __u8 own_address_type; + __u8 filter_policy; +} __packed; + +#define LE_SCANNING_DISABLED 0x00 +#define LE_SCANNING_ENABLED 0x01 + +#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c +struct hci_cp_le_set_scan_enable { + __u8 enable; + __u8 filter_dup; +} __packed; + +#define HCI_OP_LE_CREATE_CONN 0x200d +struct hci_cp_le_create_conn { + __le16 scan_interval; + __le16 scan_window; + __u8 filter_policy; + __u8 peer_addr_type; + bdaddr_t peer_addr; + __u8 own_address_type; + __le16 conn_interval_min; + __le16 conn_interval_max; + __le16 conn_latency; + __le16 supervision_timeout; + __le16 min_ce_len; + __le16 max_ce_len; +} __packed; + +#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e + +#define HCI_OP_LE_CONN_UPDATE 0x2013 +struct hci_cp_le_conn_update { + __le16 handle; + __le16 conn_interval_min; + __le16 conn_interval_max; + __le16 conn_latency; + __le16 supervision_timeout; + __le16 min_ce_len; + __le16 max_ce_len; +} __packed; + +#define HCI_OP_LE_START_ENC 0x2019 +struct hci_cp_le_start_enc { + __le16 handle; + __u8 rand[8]; + __le16 ediv; + __u8 ltk[16]; +} __packed; + +#define HCI_OP_LE_LTK_REPLY 0x201a +struct hci_cp_le_ltk_reply { + __le16 handle; + __u8 ltk[16]; +} __packed; +struct hci_rp_le_ltk_reply { + __u8 status; + __le16 handle; +} __packed; + +#define HCI_OP_LE_LTK_NEG_REPLY 0x201b +struct hci_cp_le_ltk_neg_reply { + __le16 handle; +} __packed; +struct hci_rp_le_ltk_neg_reply { + __u8 status; + __le16 handle; +} __packed; + +/* ---- HCI Events ---- */ +#define HCI_EV_INQUIRY_COMPLETE 0x01 + +#define HCI_EV_INQUIRY_RESULT 0x02 +struct inquiry_info { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 pscan_mode; + __u8 dev_class[3]; + __le16 clock_offset; +} __packed; + +#define HCI_EV_CONN_COMPLETE 0x03 +struct hci_ev_conn_complete { + __u8 status; + __le16 handle; + bdaddr_t bdaddr; + __u8 link_type; + __u8 encr_mode; +} __packed; + +#define HCI_EV_CONN_REQUEST 0x04 +struct hci_ev_conn_request { + bdaddr_t bdaddr; + __u8 dev_class[3]; + __u8 link_type; +} __packed; + +#define HCI_EV_DISCONN_COMPLETE 0x05 +struct hci_ev_disconn_complete { + __u8 status; + __le16 handle; + __u8 reason; +} __packed; + +#define HCI_EV_AUTH_COMPLETE 0x06 +struct hci_ev_auth_complete { + __u8 status; + __le16 handle; +} __packed; + +#define HCI_EV_REMOTE_NAME 0x07 +struct hci_ev_remote_name { + __u8 status; + bdaddr_t bdaddr; + __u8 name[HCI_MAX_NAME_LENGTH]; +} __packed; + +#define HCI_EV_ENCRYPT_CHANGE 0x08 +struct hci_ev_encrypt_change { + __u8 status; + __le16 handle; + __u8 encrypt; +} __packed; + +#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 +struct hci_ev_change_link_key_complete { + __u8 status; + __le16 handle; +} __packed; + +#define HCI_EV_REMOTE_FEATURES 0x0b +struct hci_ev_remote_features { + __u8 status; + __le16 handle; + __u8 features[8]; +} __packed; + +#define HCI_EV_REMOTE_VERSION 0x0c +struct hci_ev_remote_version { + __u8 status; + __le16 handle; + __u8 lmp_ver; + __le16 manufacturer; + __le16 lmp_subver; +} __packed; + +#define HCI_EV_QOS_SETUP_COMPLETE 0x0d +struct hci_qos { + __u8 service_type; + __u32 token_rate; + __u32 peak_bandwidth; + __u32 latency; + __u32 delay_variation; +} __packed; +struct hci_ev_qos_setup_complete { + __u8 status; + __le16 handle; + struct hci_qos qos; +} __packed; + +#define HCI_EV_CMD_COMPLETE 0x0e +struct hci_ev_cmd_complete { + __u8 ncmd; + __le16 opcode; +} __packed; + +#define HCI_EV_CMD_STATUS 0x0f +struct hci_ev_cmd_status { + __u8 status; + __u8 ncmd; + __le16 opcode; +} __packed; + +#define HCI_EV_ROLE_CHANGE 0x12 +struct hci_ev_role_change { + __u8 status; + bdaddr_t bdaddr; + __u8 role; +} __packed; + +#define HCI_EV_NUM_COMP_PKTS 0x13 +struct hci_comp_pkts_info { + __le16 handle; + __le16 count; +} __packed; + +struct hci_ev_num_comp_pkts { + __u8 num_hndl; + struct hci_comp_pkts_info handles[0]; +} __packed; + +#define HCI_EV_MODE_CHANGE 0x14 +struct hci_ev_mode_change { + __u8 status; + __le16 handle; + __u8 mode; + __le16 interval; +} __packed; + +#define HCI_EV_PIN_CODE_REQ 0x16 +struct hci_ev_pin_code_req { + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_LINK_KEY_REQ 0x17 +struct hci_ev_link_key_req { + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_LINK_KEY_NOTIFY 0x18 +struct hci_ev_link_key_notify { + bdaddr_t bdaddr; + __u8 link_key[16]; + __u8 key_type; +} __packed; + +#define HCI_EV_CLOCK_OFFSET 0x1c +struct hci_ev_clock_offset { + __u8 status; + __le16 handle; + __le16 clock_offset; +} __packed; + +#define HCI_EV_PKT_TYPE_CHANGE 0x1d +struct hci_ev_pkt_type_change { + __u8 status; + __le16 handle; + __le16 pkt_type; +} __packed; + +#define HCI_EV_PSCAN_REP_MODE 0x20 +struct hci_ev_pscan_rep_mode { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; +} __packed; + +#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 +struct inquiry_info_with_rssi { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 dev_class[3]; + __le16 clock_offset; + __s8 rssi; +} __packed; +struct inquiry_info_with_rssi_and_pscan_mode { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 pscan_mode; + __u8 dev_class[3]; + __le16 clock_offset; + __s8 rssi; +} __packed; + +#define HCI_EV_REMOTE_EXT_FEATURES 0x23 +struct hci_ev_remote_ext_features { + __u8 status; + __le16 handle; + __u8 page; + __u8 max_page; + __u8 features[8]; +} __packed; + +#define HCI_EV_SYNC_CONN_COMPLETE 0x2c +struct hci_ev_sync_conn_complete { + __u8 status; + __le16 handle; + bdaddr_t bdaddr; + __u8 link_type; + __u8 tx_interval; + __u8 retrans_window; + __le16 rx_pkt_len; + __le16 tx_pkt_len; + __u8 air_mode; +} __packed; + +#define HCI_EV_SYNC_CONN_CHANGED 0x2d +struct hci_ev_sync_conn_changed { + __u8 status; + __le16 handle; + __u8 tx_interval; + __u8 retrans_window; + __le16 rx_pkt_len; + __le16 tx_pkt_len; +} __packed; + +#define HCI_EV_SNIFF_SUBRATE 0x2e +struct hci_ev_sniff_subrate { + __u8 status; + __le16 handle; + __le16 max_tx_latency; + __le16 max_rx_latency; + __le16 max_remote_timeout; + __le16 max_local_timeout; +} __packed; + +#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f +struct extended_inquiry_info { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 dev_class[3]; + __le16 clock_offset; + __s8 rssi; + __u8 data[240]; +} __packed; + +#define HCI_EV_IO_CAPA_REQUEST 0x31 +struct hci_ev_io_capa_request { + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_IO_CAPA_REPLY 0x32 +struct hci_ev_io_capa_reply { + bdaddr_t bdaddr; + __u8 capability; + __u8 oob_data; + __u8 authentication; +} __packed; + +#define HCI_EV_USER_CONFIRM_REQUEST 0x33 +struct hci_ev_user_confirm_req { + bdaddr_t bdaddr; + __le32 passkey; +} __packed; + +#define HCI_EV_USER_PASSKEY_REQUEST 0x34 +struct hci_ev_user_passkey_req { + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 +struct hci_ev_remote_oob_data_request { + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 +struct hci_ev_simple_pair_complete { + __u8 status; + bdaddr_t bdaddr; +} __packed; + +#define HCI_EV_REMOTE_HOST_FEATURES 0x3d +struct hci_ev_remote_host_features { + bdaddr_t bdaddr; + __u8 features[8]; +} __packed; + +#define HCI_EV_LE_META 0x3e +struct hci_ev_le_meta { + __u8 subevent; +} __packed; + +#define HCI_EV_NUM_COMP_BLOCKS 0x48 +struct hci_comp_blocks_info { + __le16 handle; + __le16 pkts; + __le16 blocks; +} __packed; + +struct hci_ev_num_comp_blocks { + __le16 num_blocks; + __u8 num_hndl; + struct hci_comp_blocks_info handles[0]; +} __packed; + +/* Low energy meta events */ +#define HCI_EV_LE_CONN_COMPLETE 0x01 +struct hci_ev_le_conn_complete { + __u8 status; + __le16 handle; + __u8 role; + __u8 bdaddr_type; + bdaddr_t bdaddr; + __le16 interval; + __le16 latency; + __le16 supervision_timeout; + __u8 clk_accurancy; +} __packed; + +#define HCI_EV_LE_LTK_REQ 0x05 +struct hci_ev_le_ltk_req { + __le16 handle; + __u8 random[8]; + __le16 ediv; +} __packed; + +/* Advertising report event types */ +#define ADV_IND 0x00 +#define ADV_DIRECT_IND 0x01 +#define ADV_SCAN_IND 0x02 +#define ADV_NONCONN_IND 0x03 +#define ADV_SCAN_RSP 0x04 + +#define ADDR_LE_DEV_PUBLIC 0x00 +#define ADDR_LE_DEV_RANDOM 0x01 + +#define HCI_EV_LE_ADVERTISING_REPORT 0x02 +struct hci_ev_le_advertising_info { + __u8 evt_type; + __u8 bdaddr_type; + bdaddr_t bdaddr; + __u8 length; + __u8 data[0]; +} __packed; + +/* Internal events generated by Bluetooth stack */ +#define HCI_EV_STACK_INTERNAL 0xfd +struct hci_ev_stack_internal { + __u16 type; + __u8 data[0]; +} __packed; + +#define HCI_EV_SI_DEVICE 0x01 +struct hci_ev_si_device { + __u16 event; + __u16 dev_id; +} __packed; + +#define HCI_EV_SI_SECURITY 0x02 +struct hci_ev_si_security { + __u16 event; + __u16 proto; + __u16 subproto; + __u8 incoming; +} __packed; + +/* ---- HCI Packet structures ---- */ +#define HCI_COMMAND_HDR_SIZE 3 +#define HCI_EVENT_HDR_SIZE 2 +#define HCI_ACL_HDR_SIZE 4 +#define HCI_SCO_HDR_SIZE 3 + +struct hci_command_hdr { + __le16 opcode; /* OCF & OGF */ + __u8 plen; +} __packed; + +struct hci_event_hdr { + __u8 evt; + __u8 plen; +} __packed; + +struct hci_acl_hdr { + __le16 handle; /* Handle & Flags(PB, BC) */ + __le16 dlen; +} __packed; + +struct hci_sco_hdr { + __le16 handle; + __u8 dlen; +} __packed; + +#include <linux/skbuff.h> +static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) +{ + return (struct hci_event_hdr *) skb->data; +} + +static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) +{ + return (struct hci_acl_hdr *) skb->data; +} + +static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) +{ + return (struct hci_sco_hdr *) skb->data; +} + +/* Command opcode pack/unpack */ +#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) +#define hci_opcode_ogf(op) (op >> 10) +#define hci_opcode_ocf(op) (op & 0x03ff) + +/* ACL handle and flags pack/unpack */ +#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12)) +#define hci_handle(h) (h & 0x0fff) +#define hci_flags(h) (h >> 12) + +/* ---- HCI Sockets ---- */ + +/* Socket options */ +#define HCI_DATA_DIR 1 +#define HCI_FILTER 2 +#define HCI_TIME_STAMP 3 + +/* CMSG flags */ +#define HCI_CMSG_DIR 0x0001 +#define HCI_CMSG_TSTAMP 0x0002 + +struct sockaddr_hci { + sa_family_t hci_family; + unsigned short hci_dev; + unsigned short hci_channel; +}; +#define HCI_DEV_NONE 0xffff + +#define HCI_CHANNEL_RAW 0 +#define HCI_CHANNEL_MONITOR 2 +#define HCI_CHANNEL_CONTROL 3 + +struct hci_filter { + unsigned long type_mask; + unsigned long event_mask[2]; + __le16 opcode; +}; + +struct hci_ufilter { + __u32 type_mask; + __u32 event_mask[2]; + __le16 opcode; +}; + +#define HCI_FLT_TYPE_BITS 31 +#define HCI_FLT_EVENT_BITS 63 +#define HCI_FLT_OGF_BITS 63 +#define HCI_FLT_OCF_BITS 127 + +/* ---- HCI Ioctl requests structures ---- */ +struct hci_dev_stats { + __u32 err_rx; + __u32 err_tx; + __u32 cmd_tx; + __u32 evt_rx; + __u32 acl_tx; + __u32 acl_rx; + __u32 sco_tx; + __u32 sco_rx; + __u32 byte_rx; + __u32 byte_tx; +}; + +struct hci_dev_info { + __u16 dev_id; + char name[8]; + + bdaddr_t bdaddr; + + __u32 flags; + __u8 type; + + __u8 features[8]; + + __u32 pkt_type; + __u32 link_policy; + __u32 link_mode; + + __u16 acl_mtu; + __u16 acl_pkts; + __u16 sco_mtu; + __u16 sco_pkts; + + struct hci_dev_stats stat; +}; + +struct hci_conn_info { + __u16 handle; + bdaddr_t bdaddr; + __u8 type; + __u8 out; + __u16 state; + __u32 link_mode; +}; + +struct hci_dev_req { + __u16 dev_id; + __u32 dev_opt; +}; + +struct hci_dev_list_req { + __u16 dev_num; + struct hci_dev_req dev_req[0]; /* hci_dev_req structures */ +}; + +struct hci_conn_list_req { + __u16 dev_id; + __u16 conn_num; + struct hci_conn_info conn_info[0]; +}; + +struct hci_conn_info_req { + bdaddr_t bdaddr; + __u8 type; + struct hci_conn_info conn_info[0]; +}; + +struct hci_auth_info_req { + bdaddr_t bdaddr; + __u8 type; +}; + +struct hci_inquiry_req { + __u16 dev_id; + __u16 flags; + __u8 lap[3]; + __u8 length; + __u8 num_rsp; +}; +#define IREQ_CACHE_FLUSH 0x0001 + +extern bool enable_hs; +extern bool enable_le; + +#endif /* __HCI_H */ diff --git a/include/net/bluetooth/tizen/hci_core.h b/include/net/bluetooth/tizen/hci_core.h new file mode 100644 index 0000000..1ef1e1b --- /dev/null +++ b/include/net/bluetooth/tizen/hci_core.h @@ -0,0 +1,1101 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. + + Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __HCI_CORE_H +#define __HCI_CORE_H + +#include <linux/interrupt.h> +#include <net/bluetooth/hci.h> + +/* HCI priority */ +#define HCI_PRIO_MAX 7 + +/* HCI Core structures */ +struct inquiry_data { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 pscan_mode; + __u8 dev_class[3]; + __le16 clock_offset; + __s8 rssi; + __u8 ssp_mode; +}; + +struct inquiry_entry { + struct list_head all; /* inq_cache.all */ + struct list_head list; /* unknown or resolve */ + enum { + NAME_NOT_KNOWN, + NAME_NEEDED, + NAME_PENDING, + NAME_KNOWN, + } name_state; + __u32 timestamp; + struct inquiry_data data; +}; + +struct discovery_state { + int type; + enum { + DISCOVERY_STOPPED, + DISCOVERY_STARTING, + DISCOVERY_FINDING, + DISCOVERY_RESOLVING, + DISCOVERY_STOPPING, + } state; + struct list_head all; /* All devices found during inquiry */ + struct list_head unknown; /* Name state not known */ + struct list_head resolve; /* Name needs to be resolved */ + __u32 timestamp; +}; + +struct hci_conn_hash { + struct list_head list; + unsigned int acl_num; + unsigned int sco_num; + unsigned int le_num; +}; + +struct bdaddr_list { + struct list_head list; + bdaddr_t bdaddr; +}; + +struct bt_uuid { + struct list_head list; + u8 uuid[16]; + u8 svc_hint; +}; + +struct smp_ltk { + struct list_head list; + bdaddr_t bdaddr; + u8 bdaddr_type; + u8 authenticated; + u8 type; + u8 enc_size; + __le16 ediv; + u8 rand[8]; + u8 val[16]; +} __packed; + +struct link_key { + struct list_head list; + bdaddr_t bdaddr; + u8 type; + u8 val[16]; + u8 pin_len; +}; + +struct oob_data { + struct list_head list; + bdaddr_t bdaddr; + u8 hash[16]; + u8 randomizer[16]; +}; + +struct adv_entry { + struct list_head list; + bdaddr_t bdaddr; + u8 bdaddr_type; +}; + +struct le_scan_params { + u8 type; + u16 interval; + u16 window; + int timeout; +}; + +#define HCI_MAX_SHORT_NAME_LENGTH 10 + +#define NUM_REASSEMBLY 4 +struct hci_dev { + struct list_head list; + struct mutex lock; + + char name[8]; + unsigned long flags; + __u16 id; + __u8 bus; + __u8 dev_type; + bdaddr_t bdaddr; + __u8 dev_name[HCI_MAX_NAME_LENGTH]; + __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; + __u8 eir[HCI_MAX_EIR_LENGTH]; + __u8 dev_class[3]; + __u8 major_class; + __u8 minor_class; + __u8 features[8]; + __u8 host_features[8]; + __u8 commands[64]; + __u8 hci_ver; + __u16 hci_rev; + __u8 lmp_ver; + __u16 manufacturer; + __le16 lmp_subver; + __u16 voice_setting; + __u8 io_capability; + + __u16 pkt_type; + __u16 esco_type; + __u16 link_policy; + __u16 link_mode; + + __u32 idle_timeout; + __u16 sniff_min_interval; + __u16 sniff_max_interval; + + __u8 amp_status; + __u32 amp_total_bw; + __u32 amp_max_bw; + __u32 amp_min_latency; + __u32 amp_max_pdu; + __u8 amp_type; + __u16 amp_pal_cap; + __u16 amp_assoc_size; + __u32 amp_max_flush_to; + __u32 amp_be_flush_to; + + __u8 flow_ctl_mode; + + unsigned int auto_accept_delay; + + unsigned long quirks; + + atomic_t cmd_cnt; + unsigned int acl_cnt; + unsigned int sco_cnt; + unsigned int le_cnt; + + unsigned int acl_mtu; + unsigned int sco_mtu; + unsigned int le_mtu; + unsigned int acl_pkts; + unsigned int sco_pkts; + unsigned int le_pkts; + + __u16 block_len; + __u16 block_mtu; + __u16 num_blocks; + __u16 block_cnt; + + unsigned long acl_last_tx; + unsigned long sco_last_tx; + unsigned long le_last_tx; + + struct workqueue_struct *workqueue; + + struct work_struct power_on; + struct delayed_work power_off; + + __u16 discov_timeout; + struct delayed_work discov_off; + + struct delayed_work service_cache; + + struct timer_list cmd_timer; + + struct work_struct rx_work; + struct work_struct cmd_work; + struct work_struct tx_work; + + struct sk_buff_head rx_q; + struct sk_buff_head raw_q; + struct sk_buff_head cmd_q; + + struct sk_buff *sent_cmd; + struct sk_buff *reassembly[NUM_REASSEMBLY]; + + struct mutex req_lock; + wait_queue_head_t req_wait_q; + __u32 req_status; + __u32 req_result; + + __u16 init_last_cmd; + + struct list_head mgmt_pending; + + struct discovery_state discovery; + struct hci_conn_hash conn_hash; + struct list_head blacklist; + + struct list_head uuids; + + struct list_head link_keys; + + struct list_head long_term_keys; + + struct list_head remote_oob_data; + + struct list_head adv_entries; + struct delayed_work adv_work; + + struct hci_dev_stats stat; + + struct sk_buff_head driver_init; + + void *core_data; + + atomic_t promisc; + + struct dentry *debugfs; + + struct device *parent; + struct device dev; + + struct rfkill *rfkill; + + unsigned long dev_flags; + + struct delayed_work le_scan_disable; + + struct work_struct le_scan; + struct le_scan_params le_scan_params; + + int (*open)(struct hci_dev *hdev); + int (*close)(struct hci_dev *hdev); + int (*flush)(struct hci_dev *hdev); + int (*send)(struct sk_buff *skb); + void (*notify)(struct hci_dev *hdev, unsigned int evt); + int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); + + /* Samsung Bluetooth Feature.2012.01.19 + Add wake_peer uart operation which is called before starting UART TX */ + void (*wake_peer)(struct hci_dev *); +}; + +struct hci_conn { + struct list_head list; + + atomic_t refcnt; + + bdaddr_t dst; + __u8 dst_type; + __u16 handle; + __u16 state; + __u8 mode; + __u8 type; + bool out; + __u8 attempt; + __u8 dev_class[3]; + __u8 features[8]; + __u16 interval; + __u16 pkt_type; + __u16 link_policy; + __u32 link_mode; + __u8 key_type; + __u8 auth_type; + __u8 sec_level; + __u8 pending_sec_level; + __u8 pin_length; + __u8 enc_key_size; + __u8 io_capability; + __u16 disc_timeout; + unsigned long flags; + + __u8 remote_cap; + __u8 remote_auth; + bool flush_key; + + unsigned int sent; + + struct sk_buff_head data_q; + struct list_head chan_list; + + struct delayed_work disc_work; + struct timer_list idle_timer; + struct timer_list auto_accept_timer; + + struct device dev; + atomic_t devref; + + struct hci_dev *hdev; + void *l2cap_data; + void *sco_data; + void *smp_conn; + + struct hci_conn *link; + + void (*connect_cfm_cb) (struct hci_conn *conn, u8 status); + void (*security_cfm_cb) (struct hci_conn *conn, u8 status); + void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason); +}; + +struct hci_chan { + struct list_head list; + + struct hci_conn *conn; + struct sk_buff_head data_q; + unsigned int sent; +}; + +extern struct list_head hci_dev_list; +extern struct list_head hci_cb_list; +extern rwlock_t hci_dev_list_lock; +extern rwlock_t hci_cb_list_lock; + +/* ----- HCI interface to upper protocols ----- */ +extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); +extern int l2cap_connect_cfm(struct hci_conn *hcon, u8 status); +extern int l2cap_disconn_ind(struct hci_conn *hcon); +extern int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); +extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); +extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); + +extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); +extern int sco_connect_cfm(struct hci_conn *hcon, __u8 status); +extern int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); +extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); + +/* ----- Inquiry cache ----- */ +#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ +#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ + +static inline void discovery_init(struct hci_dev *hdev) +{ + hdev->discovery.state = DISCOVERY_STOPPED; + INIT_LIST_HEAD(&hdev->discovery.all); + INIT_LIST_HEAD(&hdev->discovery.unknown); + INIT_LIST_HEAD(&hdev->discovery.resolve); +} + +bool hci_discovery_active(struct hci_dev *hdev); + +void hci_discovery_set_state(struct hci_dev *hdev, int state); + +static inline int inquiry_cache_empty(struct hci_dev *hdev) +{ + return list_empty(&hdev->discovery.all); +} + +static inline long inquiry_cache_age(struct hci_dev *hdev) +{ + struct discovery_state *c = &hdev->discovery; + return jiffies - c->timestamp; +} + +static inline long inquiry_entry_age(struct inquiry_entry *e) +{ + return jiffies - e->timestamp; +} + +struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, + bdaddr_t *bdaddr); +struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, + bdaddr_t *bdaddr); +struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, + bdaddr_t *bdaddr, + int state); +void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, + struct inquiry_entry *ie); +bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, + bool name_known, bool *ssp); + +/* ----- HCI Connections ----- */ +enum { + HCI_CONN_AUTH_PEND, + HCI_CONN_REAUTH_PEND, + HCI_CONN_ENCRYPT_PEND, + HCI_CONN_RSWITCH_PEND, + HCI_CONN_MODE_CHANGE_PEND, + HCI_CONN_SCO_SETUP_PEND, + HCI_CONN_LE_SMP_PEND, + HCI_CONN_MGMT_CONNECTED, + HCI_CONN_SSP_ENABLED, + HCI_CONN_POWER_SAVE, + HCI_CONN_REMOTE_OOB, +}; + +static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) +{ + struct hci_dev *hdev = conn->hdev; + return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && + test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)); +} + +static inline void hci_conn_hash_init(struct hci_dev *hdev) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + INIT_LIST_HEAD(&h->list); + h->acl_num = 0; + h->sco_num = 0; + h->le_num = 0; +} + +static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + list_add_rcu(&c->list, &h->list); + switch (c->type) { + case ACL_LINK: + h->acl_num++; + break; + case LE_LINK: + h->le_num++; + break; + case SCO_LINK: + case ESCO_LINK: + h->sco_num++; + break; + } +} + +static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + + list_del_rcu(&c->list); + synchronize_rcu(); + + switch (c->type) { + case ACL_LINK: + h->acl_num--; + break; + case LE_LINK: + h->le_num--; + break; + case SCO_LINK: + case ESCO_LINK: + h->sco_num--; + break; + } +} + +static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + switch (type) { + case ACL_LINK: + return h->acl_num; + case LE_LINK: + return h->le_num; + case SCO_LINK: + case ESCO_LINK: + return h->sco_num; + default: + return 0; + } +} + +static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, + __u16 handle) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + struct hci_conn *c; + + rcu_read_lock(); + + list_for_each_entry_rcu(c, &h->list, list) { + if (c->handle == handle) { + rcu_read_unlock(); + return c; + } + } + rcu_read_unlock(); + + return NULL; +} + +static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, + __u8 type, bdaddr_t *ba) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + struct hci_conn *c; + + rcu_read_lock(); + + list_for_each_entry_rcu(c, &h->list, list) { + if (c->type == type && !bacmp(&c->dst, ba)) { + rcu_read_unlock(); + return c; + } + } + + rcu_read_unlock(); + + return NULL; +} + +static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, + __u8 type, __u16 state) +{ + struct hci_conn_hash *h = &hdev->conn_hash; + struct hci_conn *c; + + rcu_read_lock(); + + list_for_each_entry_rcu(c, &h->list, list) { + if (c->type == type && c->state == state) { + rcu_read_unlock(); + return c; + } + } + + rcu_read_unlock(); + + return NULL; +} + +void hci_acl_connect(struct hci_conn *conn); +void hci_acl_disconn(struct hci_conn *conn, __u8 reason); +void hci_add_sco(struct hci_conn *conn, __u16 handle); +void hci_setup_sync(struct hci_conn *conn, __u16 handle); +void hci_sco_setup(struct hci_conn *conn, __u8 status); + +struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); +int hci_conn_del(struct hci_conn *conn); +void hci_conn_hash_flush(struct hci_dev *hdev); +void hci_conn_check_pending(struct hci_dev *hdev); + +struct hci_chan *hci_chan_create(struct hci_conn *conn); +int hci_chan_del(struct hci_chan *chan); +void hci_chan_list_flush(struct hci_conn *conn); + +struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, + __u8 sec_level, __u8 auth_type); +int hci_conn_check_link_mode(struct hci_conn *conn); +int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); +int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); +int hci_conn_change_link_key(struct hci_conn *conn); +int hci_conn_switch_role(struct hci_conn *conn, __u8 role); + +void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); + +void hci_conn_hold_device(struct hci_conn *conn); +void hci_conn_put_device(struct hci_conn *conn); + +static inline void hci_conn_hold(struct hci_conn *conn) +{ + atomic_inc(&conn->refcnt); + cancel_delayed_work(&conn->disc_work); +} + +static inline void hci_conn_put(struct hci_conn *conn) +{ + if (atomic_dec_and_test(&conn->refcnt)) { + unsigned long timeo; + if (conn->type == ACL_LINK || conn->type == LE_LINK) { + del_timer(&conn->idle_timer); + if (conn->state == BT_CONNECTED) { + timeo = msecs_to_jiffies(conn->disc_timeout); + if (!conn->out) + timeo *= 2; + } else { + timeo = msecs_to_jiffies(10); + } + } else { + timeo = msecs_to_jiffies(10); + } + cancel_delayed_work(&conn->disc_work); + queue_delayed_work(conn->hdev->workqueue, + &conn->disc_work, timeo); + } +} + +/* ----- HCI Devices ----- */ +static inline void hci_dev_put(struct hci_dev *d) +{ + put_device(&d->dev); +} + +static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) +{ + get_device(&d->dev); + return d; +} + +#define hci_dev_lock(d) mutex_lock(&d->lock) +#define hci_dev_unlock(d) mutex_unlock(&d->lock) + +#define to_hci_dev(d) container_of(d, struct hci_dev, dev) +#define to_hci_conn(c) container_of(c, struct hci_conn, dev) + +static inline void *hci_get_drvdata(struct hci_dev *hdev) +{ + return dev_get_drvdata(&hdev->dev); +} + +static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) +{ + dev_set_drvdata(&hdev->dev, data); +} + +struct hci_dev *hci_dev_get(int index); +struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); + +struct hci_dev *hci_alloc_dev(void); +void hci_free_dev(struct hci_dev *hdev); +int hci_register_dev(struct hci_dev *hdev); +void hci_unregister_dev(struct hci_dev *hdev); +int hci_suspend_dev(struct hci_dev *hdev); +int hci_resume_dev(struct hci_dev *hdev); +int hci_dev_open(__u16 dev); +int hci_dev_close(__u16 dev); +int hci_dev_reset(__u16 dev); +int hci_dev_reset_stat(__u16 dev); +int hci_dev_cmd(unsigned int cmd, void __user *arg); +int hci_get_dev_list(void __user *arg); +int hci_get_dev_info(void __user *arg); +int hci_get_conn_list(void __user *arg); +int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); +int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); +int hci_inquiry(void __user *arg); + +struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); +int hci_blacklist_clear(struct hci_dev *hdev); +int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); +int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); + +int hci_uuids_clear(struct hci_dev *hdev); + +int hci_link_keys_clear(struct hci_dev *hdev); +struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); +int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, + bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); +struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); +int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, + int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, + u8 rand[8]); +struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 addr_type); +int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); +int hci_smp_ltks_clear(struct hci_dev *hdev); +int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); + +int hci_remote_oob_data_clear(struct hci_dev *hdev); +struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, + bdaddr_t *bdaddr); +int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, + u8 *randomizer); +int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); + +#define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */ +int hci_adv_entries_clear(struct hci_dev *hdev); +struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr); +int hci_add_adv_entry(struct hci_dev *hdev, + struct hci_ev_le_advertising_info *ev); + +void hci_del_off_timer(struct hci_dev *hdev); + +void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); + +int hci_recv_frame(struct sk_buff *skb); +int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); +int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); + +void hci_init_sysfs(struct hci_dev *hdev); +int hci_add_sysfs(struct hci_dev *hdev); +void hci_del_sysfs(struct hci_dev *hdev); +void hci_conn_init_sysfs(struct hci_conn *conn); +void hci_conn_add_sysfs(struct hci_conn *conn); +void hci_conn_del_sysfs(struct hci_conn *conn); + +#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) + +/* ----- LMP capabilities ----- */ +#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) +#define lmp_encrypt_capable(dev) ((dev)->features[0] & LMP_ENCRYPT) +#define lmp_sniff_capable(dev) ((dev)->features[0] & LMP_SNIFF) +#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) +#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) +#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) +#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) +#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) +#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR)) + +/* ----- Extended LMP capabilities ----- */ +#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) + +/* ----- HCI protocols ----- */ +static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, + __u8 type) +{ + switch (type) { + case ACL_LINK: + return l2cap_connect_ind(hdev, bdaddr); + + case SCO_LINK: + case ESCO_LINK: + return sco_connect_ind(hdev, bdaddr); + + default: + BT_ERR("unknown link type %d", type); + return -EINVAL; + } +} + +static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) +{ + switch (conn->type) { + case ACL_LINK: + case LE_LINK: + l2cap_connect_cfm(conn, status); + break; + + case SCO_LINK: + case ESCO_LINK: + sco_connect_cfm(conn, status); + break; + + default: + BT_ERR("unknown link type %d", conn->type); + break; + } + + if (conn->connect_cfm_cb) + conn->connect_cfm_cb(conn, status); +} + +static inline int hci_proto_disconn_ind(struct hci_conn *conn) +{ + if (conn->type != ACL_LINK && conn->type != LE_LINK) + return HCI_ERROR_REMOTE_USER_TERM; + + return l2cap_disconn_ind(conn); +} + +static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) +{ + switch (conn->type) { + case ACL_LINK: + case LE_LINK: + l2cap_disconn_cfm(conn, reason); + break; + + case SCO_LINK: + case ESCO_LINK: + sco_disconn_cfm(conn, reason); + break; + + default: + BT_ERR("unknown link type %d", conn->type); + break; + } + + if (conn->disconn_cfm_cb) + conn->disconn_cfm_cb(conn, reason); +} + +static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) +{ + __u8 encrypt; + + if (conn->type != ACL_LINK && conn->type != LE_LINK) + return; + + if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) + return; + + encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; + l2cap_security_cfm(conn, status, encrypt); + + if (conn->security_cfm_cb) + conn->security_cfm_cb(conn, status); +} + +static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, + __u8 encrypt) +{ + if (conn->type != ACL_LINK && conn->type != LE_LINK) + return; + + l2cap_security_cfm(conn, status, encrypt); + + if (conn->security_cfm_cb) + conn->security_cfm_cb(conn, status); +} + +/* ----- HCI callbacks ----- */ +struct hci_cb { + struct list_head list; + + char *name; + + void (*security_cfm) (struct hci_conn *conn, __u8 status, + __u8 encrypt); + void (*key_change_cfm) (struct hci_conn *conn, __u8 status); + void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); +}; + +static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) +{ + struct list_head *p; + __u8 encrypt; + + hci_proto_auth_cfm(conn, status); + + if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) + return; + + encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; + + read_lock(&hci_cb_list_lock); + list_for_each(p, &hci_cb_list) { + struct hci_cb *cb = list_entry(p, struct hci_cb, list); + if (cb->security_cfm) + cb->security_cfm(conn, status, encrypt); + } + read_unlock(&hci_cb_list_lock); +} + +static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, + __u8 encrypt) +{ + struct list_head *p; + + if (conn->sec_level == BT_SECURITY_SDP) + conn->sec_level = BT_SECURITY_LOW; + + if (conn->pending_sec_level > conn->sec_level) + conn->sec_level = conn->pending_sec_level; + + hci_proto_encrypt_cfm(conn, status, encrypt); + + read_lock(&hci_cb_list_lock); + list_for_each(p, &hci_cb_list) { + struct hci_cb *cb = list_entry(p, struct hci_cb, list); + if (cb->security_cfm) + cb->security_cfm(conn, status, encrypt); + } + read_unlock(&hci_cb_list_lock); +} + +static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) +{ + struct list_head *p; + + read_lock(&hci_cb_list_lock); + list_for_each(p, &hci_cb_list) { + struct hci_cb *cb = list_entry(p, struct hci_cb, list); + if (cb->key_change_cfm) + cb->key_change_cfm(conn, status); + } + read_unlock(&hci_cb_list_lock); +} + +static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, + __u8 role) +{ + struct list_head *p; + + read_lock(&hci_cb_list_lock); + list_for_each(p, &hci_cb_list) { + struct hci_cb *cb = list_entry(p, struct hci_cb, list); + if (cb->role_switch_cfm) + cb->role_switch_cfm(conn, status, role); + } + read_unlock(&hci_cb_list_lock); +} + +static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) +{ + size_t parsed = 0; + + if (data_len < 2) + return false; + + while (parsed < data_len - 1) { + u8 field_len = data[0]; + + if (field_len == 0) + break; + + parsed += field_len + 1; + + if (parsed > data_len) + break; + + if (data[1] == type) + return true; + + data += field_len + 1; + } + + return false; +} + +static inline size_t eir_get_length(u8 *eir, size_t eir_len) +{ + size_t parsed = 0; + + while (parsed < eir_len) { + u8 field_len = eir[0]; + + if (field_len == 0) + return parsed; + + parsed += field_len + 1; + eir += field_len + 1; + } + + return eir_len; +} + +static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, + u8 data_len) +{ + eir[eir_len++] = sizeof(type) + data_len; + eir[eir_len++] = type; + memcpy(&eir[eir_len], data, data_len); + eir_len += data_len; + + return eir_len; +} + +int hci_register_cb(struct hci_cb *hcb); +int hci_unregister_cb(struct hci_cb *hcb); + +int hci_register_notifier(struct notifier_block *nb); +int hci_unregister_notifier(struct notifier_block *nb); + +int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); +void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); +void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); + +void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); +void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); + +/* ----- HCI Sockets ----- */ +void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); +void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk); +void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); + +/* Management interface */ +#define MGMT_ADDR_BREDR 0x00 +#define MGMT_ADDR_LE_PUBLIC 0x01 +#define MGMT_ADDR_LE_RANDOM 0x02 +#define MGMT_ADDR_INVALID 0xff + +#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) +#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \ + BIT(MGMT_ADDR_LE_RANDOM)) +#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \ + BIT(MGMT_ADDR_LE_PUBLIC) | \ + BIT(MGMT_ADDR_LE_RANDOM)) + +int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); +int mgmt_index_added(struct hci_dev *hdev); +int mgmt_index_removed(struct hci_dev *hdev); +int mgmt_powered(struct hci_dev *hdev, u8 powered); +int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); +int mgmt_connectable(struct hci_dev *hdev, u8 connectable); +int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); +int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, + bool persistent); +int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, + u8 addr_type, u32 flags, u8 *name, u8 name_len, + u8 *dev_class); +int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type); +int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, u8 status); +int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, + u8 addr_type, u8 status); +int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); +int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 status); +int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 status); +int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, __le32 value, + u8 confirm_hint); +int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, u8 status); +int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, u8 status); +int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type); +int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, u8 status); +int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, + u8 link_type, u8 addr_type, u8 status); +int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, + u8 addr_type, u8 status); +int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); +int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); +int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, + u8 status); +int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); +int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, + u8 *randomizer, u8 status); +int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); +int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, + u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, + u8 ssp, u8 *eir, u16 eir_len); +int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, + u8 addr_type, s8 rssi, u8 *name, u8 name_len); +int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); +int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); +int mgmt_discovering(struct hci_dev *hdev, u8 discovering); +int mgmt_interleaved_discovery(struct hci_dev *hdev); +int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); +int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); + +int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); + +/* HCI info for socket */ +#define hci_pi(sk) ((struct hci_pinfo *) sk) + +struct hci_pinfo { + struct bt_sock bt; + struct hci_dev *hdev; + struct hci_filter filter; + __u32 cmsg_mask; + unsigned short channel; +}; + +/* HCI security filter */ +#define HCI_SFLT_MAX_OGF 5 + +struct hci_sec_filter { + __u32 type_mask; + __u32 event_mask[2]; + __u32 ocf_mask[HCI_SFLT_MAX_OGF + 1][4]; +}; + +/* ----- HCI requests ----- */ +#define HCI_REQ_DONE 0 +#define HCI_REQ_PEND 1 +#define HCI_REQ_CANCELED 2 + +#define hci_req_lock(d) mutex_lock(&d->req_lock) +#define hci_req_unlock(d) mutex_unlock(&d->req_lock) + +void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); + +void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, + u16 latency, u16 to_multiplier); +void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], + __u8 ltk[16]); +void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]); +void hci_le_ltk_neg_reply(struct hci_conn *conn); + +int hci_do_inquiry(struct hci_dev *hdev, u8 length); +int hci_cancel_inquiry(struct hci_dev *hdev); +int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, + int timeout); + +#endif /* __HCI_CORE_H */ diff --git a/include/net/bluetooth/tizen/hci_mon.h b/include/net/bluetooth/tizen/hci_mon.h new file mode 100644 index 0000000..77d1e57 --- /dev/null +++ b/include/net/bluetooth/tizen/hci_mon.h @@ -0,0 +1,51 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + + Copyright (C) 2011-2012 Intel Corporation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __HCI_MON_H +#define __HCI_MON_H + +struct hci_mon_hdr { + __le16 opcode; + __le16 index; + __le16 len; +} __packed; +#define HCI_MON_HDR_SIZE 6 + +#define HCI_MON_NEW_INDEX 0 +#define HCI_MON_DEL_INDEX 1 +#define HCI_MON_COMMAND_PKT 2 +#define HCI_MON_EVENT_PKT 3 +#define HCI_MON_ACL_TX_PKT 4 +#define HCI_MON_ACL_RX_PKT 5 +#define HCI_MON_SCO_TX_PKT 6 +#define HCI_MON_SCO_RX_PKT 7 + +struct hci_mon_new_index { + __u8 type; + __u8 bus; + bdaddr_t bdaddr; + char name[8]; +} __packed; +#define HCI_MON_NEW_INDEX_SIZE 16 + +#endif /* __HCI_MON_H */ diff --git a/include/net/bluetooth/tizen/l2cap.h b/include/net/bluetooth/tizen/l2cap.h new file mode 100644 index 0000000..9b242c6 --- /dev/null +++ b/include/net/bluetooth/tizen/l2cap.h @@ -0,0 +1,865 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> + Copyright (C) 2010 Google Inc. + + Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __L2CAP_H +#define __L2CAP_H + +#include <asm/unaligned.h> + +/* L2CAP defaults */ +#define L2CAP_DEFAULT_MTU 672 +#define L2CAP_DEFAULT_MIN_MTU 48 +#define L2CAP_DEFAULT_FLUSH_TO 0xffff +#define L2CAP_DEFAULT_TX_WINDOW 63 +#define L2CAP_DEFAULT_EXT_WINDOW 0x3FFF +#define L2CAP_DEFAULT_MAX_TX 3 +#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */ +#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ +#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ +#define L2CAP_DEFAULT_ACK_TO 200 +#define L2CAP_LE_DEFAULT_MTU 23 +#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF +#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF +#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF + +#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) +#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) +#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) +#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) +#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) + +/* L2CAP socket address */ +struct sockaddr_l2 { + sa_family_t l2_family; + __le16 l2_psm; + bdaddr_t l2_bdaddr; + __le16 l2_cid; +}; + +/* L2CAP socket options */ +#define L2CAP_OPTIONS 0x01 +struct l2cap_options { + __u16 omtu; + __u16 imtu; + __u16 flush_to; + __u8 mode; + __u8 fcs; + __u8 max_tx; + __u16 txwin_size; +}; + +#define L2CAP_CONNINFO 0x02 +struct l2cap_conninfo { + __u16 hci_handle; + __u8 dev_class[3]; +}; + +#define L2CAP_LM 0x03 +#define L2CAP_LM_MASTER 0x0001 +#define L2CAP_LM_AUTH 0x0002 +#define L2CAP_LM_ENCRYPT 0x0004 +#define L2CAP_LM_TRUSTED 0x0008 +#define L2CAP_LM_RELIABLE 0x0010 +#define L2CAP_LM_SECURE 0x0020 + +/* L2CAP command codes */ +#define L2CAP_COMMAND_REJ 0x01 +#define L2CAP_CONN_REQ 0x02 +#define L2CAP_CONN_RSP 0x03 +#define L2CAP_CONF_REQ 0x04 +#define L2CAP_CONF_RSP 0x05 +#define L2CAP_DISCONN_REQ 0x06 +#define L2CAP_DISCONN_RSP 0x07 +#define L2CAP_ECHO_REQ 0x08 +#define L2CAP_ECHO_RSP 0x09 +#define L2CAP_INFO_REQ 0x0a +#define L2CAP_INFO_RSP 0x0b +#define L2CAP_CREATE_CHAN_REQ 0x0c +#define L2CAP_CREATE_CHAN_RSP 0x0d +#define L2CAP_MOVE_CHAN_REQ 0x0e +#define L2CAP_MOVE_CHAN_RSP 0x0f +#define L2CAP_MOVE_CHAN_CFM 0x10 +#define L2CAP_MOVE_CHAN_CFM_RSP 0x11 +#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12 +#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13 + +/* L2CAP extended feature mask */ +#define L2CAP_FEAT_FLOWCTL 0x00000001 +#define L2CAP_FEAT_RETRANS 0x00000002 +#define L2CAP_FEAT_BIDIR_QOS 0x00000004 +#define L2CAP_FEAT_ERTM 0x00000008 +#define L2CAP_FEAT_STREAMING 0x00000010 +#define L2CAP_FEAT_FCS 0x00000020 +#define L2CAP_FEAT_EXT_FLOW 0x00000040 +#define L2CAP_FEAT_FIXED_CHAN 0x00000080 +#define L2CAP_FEAT_EXT_WINDOW 0x00000100 +#define L2CAP_FEAT_UCD 0x00000200 + +/* L2CAP checksum option */ +#define L2CAP_FCS_NONE 0x00 +#define L2CAP_FCS_CRC16 0x01 + +/* L2CAP fixed channels */ +#define L2CAP_FC_L2CAP 0x02 +#define L2CAP_FC_A2MP 0x08 + +/* L2CAP Control Field bit masks */ +#define L2CAP_CTRL_SAR 0xC000 +#define L2CAP_CTRL_REQSEQ 0x3F00 +#define L2CAP_CTRL_TXSEQ 0x007E +#define L2CAP_CTRL_SUPERVISE 0x000C + +#define L2CAP_CTRL_RETRANS 0x0080 +#define L2CAP_CTRL_FINAL 0x0080 +#define L2CAP_CTRL_POLL 0x0010 +#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */ + +#define L2CAP_CTRL_TXSEQ_SHIFT 1 +#define L2CAP_CTRL_SUPER_SHIFT 2 +#define L2CAP_CTRL_REQSEQ_SHIFT 8 +#define L2CAP_CTRL_SAR_SHIFT 14 + +/* L2CAP Extended Control Field bit mask */ +#define L2CAP_EXT_CTRL_TXSEQ 0xFFFC0000 +#define L2CAP_EXT_CTRL_SAR 0x00030000 +#define L2CAP_EXT_CTRL_SUPERVISE 0x00030000 +#define L2CAP_EXT_CTRL_REQSEQ 0x0000FFFC + +#define L2CAP_EXT_CTRL_POLL 0x00040000 +#define L2CAP_EXT_CTRL_FINAL 0x00000002 +#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ + +#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 +#define L2CAP_EXT_CTRL_SAR_SHIFT 16 +#define L2CAP_EXT_CTRL_SUPER_SHIFT 16 +#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 + +/* L2CAP Supervisory Function */ +#define L2CAP_SUPER_RR 0x00 +#define L2CAP_SUPER_REJ 0x01 +#define L2CAP_SUPER_RNR 0x02 +#define L2CAP_SUPER_SREJ 0x03 + +/* L2CAP Segmentation and Reassembly */ +#define L2CAP_SAR_UNSEGMENTED 0x00 +#define L2CAP_SAR_START 0x01 +#define L2CAP_SAR_END 0x02 +#define L2CAP_SAR_CONTINUE 0x03 + +/* L2CAP Command rej. reasons */ +#define L2CAP_REJ_NOT_UNDERSTOOD 0x0000 +#define L2CAP_REJ_MTU_EXCEEDED 0x0001 +#define L2CAP_REJ_INVALID_CID 0x0002 + +/* L2CAP structures */ +struct l2cap_hdr { + __le16 len; + __le16 cid; +} __packed; +#define L2CAP_HDR_SIZE 4 +#define L2CAP_ENH_HDR_SIZE 6 +#define L2CAP_EXT_HDR_SIZE 8 + +#define L2CAP_FCS_SIZE 2 +#define L2CAP_SDULEN_SIZE 2 +#define L2CAP_PSMLEN_SIZE 2 + +struct l2cap_cmd_hdr { + __u8 code; + __u8 ident; + __le16 len; +} __packed; +#define L2CAP_CMD_HDR_SIZE 4 + +struct l2cap_cmd_rej_unk { + __le16 reason; +} __packed; + +struct l2cap_cmd_rej_mtu { + __le16 reason; + __le16 max_mtu; +} __packed; + +struct l2cap_cmd_rej_cid { + __le16 reason; + __le16 scid; + __le16 dcid; +} __packed; + +struct l2cap_conn_req { + __le16 psm; + __le16 scid; +} __packed; + +struct l2cap_conn_rsp { + __le16 dcid; + __le16 scid; + __le16 result; + __le16 status; +} __packed; + +/* channel indentifier */ +#define L2CAP_CID_SIGNALING 0x0001 +#define L2CAP_CID_CONN_LESS 0x0002 +#define L2CAP_CID_LE_DATA 0x0004 +#define L2CAP_CID_LE_SIGNALING 0x0005 +#define L2CAP_CID_SMP 0x0006 +#define L2CAP_CID_DYN_START 0x0040 +#define L2CAP_CID_DYN_END 0xffff + +/* connect/create channel results */ +#define L2CAP_CR_SUCCESS 0x0000 +#define L2CAP_CR_PEND 0x0001 +#define L2CAP_CR_BAD_PSM 0x0002 +#define L2CAP_CR_SEC_BLOCK 0x0003 +#define L2CAP_CR_NO_MEM 0x0004 +#define L2CAP_CR_BAD_AMP 0x0005 + +/* connect/create channel status */ +#define L2CAP_CS_NO_INFO 0x0000 +#define L2CAP_CS_AUTHEN_PEND 0x0001 +#define L2CAP_CS_AUTHOR_PEND 0x0002 + +struct l2cap_conf_req { + __le16 dcid; + __le16 flags; + __u8 data[0]; +} __packed; + +struct l2cap_conf_rsp { + __le16 scid; + __le16 flags; + __le16 result; + __u8 data[0]; +} __packed; + +#define L2CAP_CONF_SUCCESS 0x0000 +#define L2CAP_CONF_UNACCEPT 0x0001 +#define L2CAP_CONF_REJECT 0x0002 +#define L2CAP_CONF_UNKNOWN 0x0003 +#define L2CAP_CONF_PENDING 0x0004 +#define L2CAP_CONF_EFS_REJECT 0x0005 + +struct l2cap_conf_opt { + __u8 type; + __u8 len; + __u8 val[0]; +} __packed; +#define L2CAP_CONF_OPT_SIZE 2 + +#define L2CAP_CONF_HINT 0x80 +#define L2CAP_CONF_MASK 0x7f + +#define L2CAP_CONF_MTU 0x01 +#define L2CAP_CONF_FLUSH_TO 0x02 +#define L2CAP_CONF_QOS 0x03 +#define L2CAP_CONF_RFC 0x04 +#define L2CAP_CONF_FCS 0x05 +#define L2CAP_CONF_EFS 0x06 +#define L2CAP_CONF_EWS 0x07 + +#define L2CAP_CONF_MAX_SIZE 22 + +struct l2cap_conf_rfc { + __u8 mode; + __u8 txwin_size; + __u8 max_transmit; + __le16 retrans_timeout; + __le16 monitor_timeout; + __le16 max_pdu_size; +} __packed; + +#define L2CAP_MODE_BASIC 0x00 +#define L2CAP_MODE_RETRANS 0x01 +#define L2CAP_MODE_FLOWCTL 0x02 +#define L2CAP_MODE_ERTM 0x03 +#define L2CAP_MODE_STREAMING 0x04 + +struct l2cap_conf_efs { + __u8 id; + __u8 stype; + __le16 msdu; + __le32 sdu_itime; + __le32 acc_lat; + __le32 flush_to; +} __packed; + +#define L2CAP_SERV_NOTRAFIC 0x00 +#define L2CAP_SERV_BESTEFFORT 0x01 +#define L2CAP_SERV_GUARANTEED 0x02 + +#define L2CAP_BESTEFFORT_ID 0x01 + +struct l2cap_disconn_req { + __le16 dcid; + __le16 scid; +} __packed; + +struct l2cap_disconn_rsp { + __le16 dcid; + __le16 scid; +} __packed; + +struct l2cap_info_req { + __le16 type; +} __packed; + +struct l2cap_info_rsp { + __le16 type; + __le16 result; + __u8 data[0]; +} __packed; + +struct l2cap_create_chan_req { + __le16 psm; + __le16 scid; + __u8 amp_id; +} __packed; + +struct l2cap_create_chan_rsp { + __le16 dcid; + __le16 scid; + __le16 result; + __le16 status; +} __packed; + +struct l2cap_move_chan_req { + __le16 icid; + __u8 dest_amp_id; +} __packed; + +struct l2cap_move_chan_rsp { + __le16 icid; + __le16 result; +} __packed; + +#define L2CAP_MR_SUCCESS 0x0000 +#define L2CAP_MR_PEND 0x0001 +#define L2CAP_MR_BAD_ID 0x0002 +#define L2CAP_MR_SAME_ID 0x0003 +#define L2CAP_MR_NOT_SUPP 0x0004 +#define L2CAP_MR_COLLISION 0x0005 +#define L2CAP_MR_NOT_ALLOWED 0x0006 + +struct l2cap_move_chan_cfm { + __le16 icid; + __le16 result; +} __packed; + +#define L2CAP_MC_CONFIRMED 0x0000 +#define L2CAP_MC_UNCONFIRMED 0x0001 + +struct l2cap_move_chan_cfm_rsp { + __le16 icid; +} __packed; + +/* info type */ +#define L2CAP_IT_CL_MTU 0x0001 +#define L2CAP_IT_FEAT_MASK 0x0002 +#define L2CAP_IT_FIXED_CHAN 0x0003 + +/* info result */ +#define L2CAP_IR_SUCCESS 0x0000 +#define L2CAP_IR_NOTSUPP 0x0001 + +struct l2cap_conn_param_update_req { + __le16 min; + __le16 max; + __le16 latency; + __le16 to_multiplier; +} __packed; + +struct l2cap_conn_param_update_rsp { + __le16 result; +} __packed; + +/* Connection Parameters result */ +#define L2CAP_CONN_PARAM_ACCEPTED 0x0000 +#define L2CAP_CONN_PARAM_REJECTED 0x0001 + +/* ----- L2CAP channels and connections ----- */ +struct srej_list { + __u16 tx_seq; + struct list_head list; +}; + +struct l2cap_chan { + struct sock *sk; + + struct l2cap_conn *conn; + + __u8 state; + + atomic_t refcnt; + + __le16 psm; + __u16 dcid; + __u16 scid; + + __u16 imtu; + __u16 omtu; + __u16 flush_to; + __u8 mode; + __u8 chan_type; + __u8 chan_policy; + + __le16 sport; + + __u8 sec_level; + + __u8 ident; + + __u8 conf_req[64]; + __u8 conf_len; + __u8 num_conf_req; + __u8 num_conf_rsp; + + __u8 fcs; + + __u16 tx_win; + __u16 tx_win_max; + __u8 max_tx; + __u16 retrans_timeout; + __u16 monitor_timeout; + __u16 mps; + + unsigned long conf_state; + unsigned long conn_state; + unsigned long flags; + + __u16 next_tx_seq; + __u16 expected_ack_seq; + __u16 expected_tx_seq; + __u16 buffer_seq; + __u16 buffer_seq_srej; + __u16 srej_save_reqseq; + __u16 frames_sent; + __u16 unacked_frames; + __u8 retry_count; + __u8 num_acked; + __u16 sdu_len; + struct sk_buff *sdu; + struct sk_buff *sdu_last_frag; + + __u16 remote_tx_win; + __u8 remote_max_tx; + __u16 remote_mps; + + __u8 local_id; + __u8 local_stype; + __u16 local_msdu; + __u32 local_sdu_itime; + __u32 local_acc_lat; + __u32 local_flush_to; + + __u8 remote_id; + __u8 remote_stype; + __u16 remote_msdu; + __u32 remote_sdu_itime; + __u32 remote_acc_lat; + __u32 remote_flush_to; + + struct delayed_work chan_timer; + struct delayed_work retrans_timer; + struct delayed_work monitor_timer; + struct delayed_work ack_timer; + + struct sk_buff *tx_send_head; + struct sk_buff_head tx_q; + struct sk_buff_head srej_q; + struct list_head srej_l; + + struct list_head list; + struct list_head global_l; + + void *data; + struct l2cap_ops *ops; + struct mutex lock; +}; + +struct l2cap_ops { + char *name; + + struct l2cap_chan *(*new_connection) (void *data); + int (*recv) (void *data, struct sk_buff *skb); + void (*close) (void *data); + void (*state_change) (void *data, int state); + struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, + unsigned long len, int nb, int *err); + +}; + +struct l2cap_conn { + struct hci_conn *hcon; + struct hci_chan *hchan; + + bdaddr_t *dst; + bdaddr_t *src; + + unsigned int mtu; + + __u32 feat_mask; + __u8 fixed_chan_mask; + + __u8 info_state; + __u8 info_ident; + + struct delayed_work info_timer; + + spinlock_t lock; + + struct sk_buff *rx_skb; + __u32 rx_len; + __u8 tx_ident; + + __u8 disc_reason; + + struct delayed_work security_timer; + struct smp_chan *smp_chan; + + struct list_head chan_l; + struct mutex chan_lock; +}; + +#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 +#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 +#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 + +#define L2CAP_CHAN_RAW 1 +#define L2CAP_CHAN_CONN_LESS 2 +#define L2CAP_CHAN_CONN_ORIENTED 3 + +/* ----- L2CAP socket info ----- */ +#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) + +struct l2cap_pinfo { + struct bt_sock bt; + struct l2cap_chan *chan; + struct sk_buff *rx_busy_skb; +}; + +enum { + CONF_REQ_SENT, + CONF_INPUT_DONE, + CONF_OUTPUT_DONE, + CONF_MTU_DONE, + CONF_MODE_DONE, + CONF_CONNECT_PEND, + CONF_NO_FCS_RECV, + CONF_STATE2_DEVICE, + CONF_EWS_RECV, + CONF_LOC_CONF_PEND, + CONF_REM_CONF_PEND, +}; + +#define L2CAP_CONF_MAX_CONF_REQ 2 +#define L2CAP_CONF_MAX_CONF_RSP 2 + +enum { + CONN_SREJ_SENT, + CONN_WAIT_F, + CONN_SREJ_ACT, + CONN_SEND_PBIT, + CONN_REMOTE_BUSY, + CONN_LOCAL_BUSY, + CONN_REJ_ACT, + CONN_SEND_FBIT, + CONN_RNR_SENT, +}; + +/* Definitions for flags in l2cap_chan */ +enum { + FLAG_ROLE_SWITCH, + FLAG_FORCE_ACTIVE, + FLAG_FORCE_RELIABLE, + FLAG_FLUSHABLE, + FLAG_EXT_CTRL, + FLAG_EFS_ENABLE, +}; + +static inline void l2cap_chan_hold(struct l2cap_chan *c) +{ + atomic_inc(&c->refcnt); +} + +static inline void l2cap_chan_put(struct l2cap_chan *c) +{ + if (atomic_dec_and_test(&c->refcnt)) + kfree(c); +} + +static inline void l2cap_chan_lock(struct l2cap_chan *chan) +{ + mutex_lock(&chan->lock); +} + +static inline void l2cap_chan_unlock(struct l2cap_chan *chan) +{ + mutex_unlock(&chan->lock); +} + +static inline void l2cap_set_timer(struct l2cap_chan *chan, + struct delayed_work *work, long timeout) +{ + BT_DBG("chan %p state %s timeout %ld", chan, + state_to_string(chan->state), timeout); + + if (!cancel_delayed_work(work)) + l2cap_chan_hold(chan); + schedule_delayed_work(work, timeout); +} + +static inline bool l2cap_clear_timer(struct l2cap_chan *chan, + struct delayed_work *work) +{ + bool ret; + + ret = cancel_delayed_work(work); + if (ret) + l2cap_chan_put(chan); + + return ret; +} + +#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) +#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) +#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); +#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) +#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); +#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) +#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); +#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) + +static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) +{ + int offset; + + offset = (seq1 - seq2) % (chan->tx_win_max + 1); + if (offset < 0) + offset += (chan->tx_win_max + 1); + + return offset; +} + +static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq) +{ + return (seq + 1) % (chan->tx_win_max + 1); +} + +static inline int l2cap_tx_window_full(struct l2cap_chan *ch) +{ + int sub; + + sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64; + + if (sub < 0) + sub += 64; + + return sub == ch->remote_tx_win; +} + +static inline __u16 __get_reqseq(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (ctrl & L2CAP_EXT_CTRL_REQSEQ) >> + L2CAP_EXT_CTRL_REQSEQ_SHIFT; + else + return (ctrl & L2CAP_CTRL_REQSEQ) >> L2CAP_CTRL_REQSEQ_SHIFT; +} + +static inline __u32 __set_reqseq(struct l2cap_chan *chan, __u32 reqseq) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (reqseq << L2CAP_EXT_CTRL_REQSEQ_SHIFT) & + L2CAP_EXT_CTRL_REQSEQ; + else + return (reqseq << L2CAP_CTRL_REQSEQ_SHIFT) & L2CAP_CTRL_REQSEQ; +} + +static inline __u16 __get_txseq(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (ctrl & L2CAP_EXT_CTRL_TXSEQ) >> + L2CAP_EXT_CTRL_TXSEQ_SHIFT; + else + return (ctrl & L2CAP_CTRL_TXSEQ) >> L2CAP_CTRL_TXSEQ_SHIFT; +} + +static inline __u32 __set_txseq(struct l2cap_chan *chan, __u32 txseq) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (txseq << L2CAP_EXT_CTRL_TXSEQ_SHIFT) & + L2CAP_EXT_CTRL_TXSEQ; + else + return (txseq << L2CAP_CTRL_TXSEQ_SHIFT) & L2CAP_CTRL_TXSEQ; +} + +static inline bool __is_sframe(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return ctrl & L2CAP_EXT_CTRL_FRAME_TYPE; + else + return ctrl & L2CAP_CTRL_FRAME_TYPE; +} + +static inline __u32 __set_sframe(struct l2cap_chan *chan) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return L2CAP_EXT_CTRL_FRAME_TYPE; + else + return L2CAP_CTRL_FRAME_TYPE; +} + +static inline __u8 __get_ctrl_sar(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (ctrl & L2CAP_EXT_CTRL_SAR) >> L2CAP_EXT_CTRL_SAR_SHIFT; + else + return (ctrl & L2CAP_CTRL_SAR) >> L2CAP_CTRL_SAR_SHIFT; +} + +static inline __u32 __set_ctrl_sar(struct l2cap_chan *chan, __u32 sar) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (sar << L2CAP_EXT_CTRL_SAR_SHIFT) & L2CAP_EXT_CTRL_SAR; + else + return (sar << L2CAP_CTRL_SAR_SHIFT) & L2CAP_CTRL_SAR; +} + +static inline bool __is_sar_start(struct l2cap_chan *chan, __u32 ctrl) +{ + return __get_ctrl_sar(chan, ctrl) == L2CAP_SAR_START; +} + +static inline __u32 __get_sar_mask(struct l2cap_chan *chan) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return L2CAP_EXT_CTRL_SAR; + else + return L2CAP_CTRL_SAR; +} + +static inline __u8 __get_ctrl_super(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (ctrl & L2CAP_EXT_CTRL_SUPERVISE) >> + L2CAP_EXT_CTRL_SUPER_SHIFT; + else + return (ctrl & L2CAP_CTRL_SUPERVISE) >> L2CAP_CTRL_SUPER_SHIFT; +} + +static inline __u32 __set_ctrl_super(struct l2cap_chan *chan, __u32 super) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return (super << L2CAP_EXT_CTRL_SUPER_SHIFT) & + L2CAP_EXT_CTRL_SUPERVISE; + else + return (super << L2CAP_CTRL_SUPER_SHIFT) & + L2CAP_CTRL_SUPERVISE; +} + +static inline __u32 __set_ctrl_final(struct l2cap_chan *chan) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return L2CAP_EXT_CTRL_FINAL; + else + return L2CAP_CTRL_FINAL; +} + +static inline bool __is_ctrl_final(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return ctrl & L2CAP_EXT_CTRL_FINAL; + else + return ctrl & L2CAP_CTRL_FINAL; +} + +static inline __u32 __set_ctrl_poll(struct l2cap_chan *chan) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return L2CAP_EXT_CTRL_POLL; + else + return L2CAP_CTRL_POLL; +} + +static inline bool __is_ctrl_poll(struct l2cap_chan *chan, __u32 ctrl) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return ctrl & L2CAP_EXT_CTRL_POLL; + else + return ctrl & L2CAP_CTRL_POLL; +} + +static inline __u32 __get_control(struct l2cap_chan *chan, void *p) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return get_unaligned_le32(p); + else + return get_unaligned_le16(p); +} + +static inline void __put_control(struct l2cap_chan *chan, __u32 control, + void *p) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return put_unaligned_le32(control, p); + else + return put_unaligned_le16(control, p); +} + +static inline __u8 __ctrl_size(struct l2cap_chan *chan) +{ + if (test_bit(FLAG_EXT_CTRL, &chan->flags)) + return L2CAP_EXT_HDR_SIZE - L2CAP_HDR_SIZE; + else + return L2CAP_ENH_HDR_SIZE - L2CAP_HDR_SIZE; +} + +extern bool disable_ertm; + +int l2cap_init_sockets(void); +void l2cap_cleanup_sockets(void); + +void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); +int __l2cap_wait_ack(struct sock *sk); + +int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); +int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); + +struct l2cap_chan *l2cap_chan_create(struct sock *sk); +void l2cap_chan_close(struct l2cap_chan *chan, int reason); +void l2cap_chan_destroy(struct l2cap_chan *chan); +int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, + bdaddr_t *dst); +int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, + u32 priority); +void l2cap_chan_busy(struct l2cap_chan *chan, int busy); +int l2cap_chan_check_security(struct l2cap_chan *chan); + +#endif /* __L2CAP_H */ diff --git a/include/net/bluetooth/tizen/mgmt.h b/include/net/bluetooth/tizen/mgmt.h new file mode 100644 index 0000000..ebfd91f --- /dev/null +++ b/include/net/bluetooth/tizen/mgmt.h @@ -0,0 +1,462 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + + Copyright (C) 2010 Nokia Corporation + Copyright (C) 2011-2012 Intel Corporation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#define MGMT_INDEX_NONE 0xFFFF + +#define MGMT_STATUS_SUCCESS 0x00 +#define MGMT_STATUS_UNKNOWN_COMMAND 0x01 +#define MGMT_STATUS_NOT_CONNECTED 0x02 +#define MGMT_STATUS_FAILED 0x03 +#define MGMT_STATUS_CONNECT_FAILED 0x04 +#define MGMT_STATUS_AUTH_FAILED 0x05 +#define MGMT_STATUS_NOT_PAIRED 0x06 +#define MGMT_STATUS_NO_RESOURCES 0x07 +#define MGMT_STATUS_TIMEOUT 0x08 +#define MGMT_STATUS_ALREADY_CONNECTED 0x09 +#define MGMT_STATUS_BUSY 0x0a +#define MGMT_STATUS_REJECTED 0x0b +#define MGMT_STATUS_NOT_SUPPORTED 0x0c +#define MGMT_STATUS_INVALID_PARAMS 0x0d +#define MGMT_STATUS_DISCONNECTED 0x0e +#define MGMT_STATUS_NOT_POWERED 0x0f +#define MGMT_STATUS_CANCELLED 0x10 +#define MGMT_STATUS_INVALID_INDEX 0x11 + +struct mgmt_hdr { + __le16 opcode; + __le16 index; + __le16 len; +} __packed; + +struct mgmt_addr_info { + bdaddr_t bdaddr; + __u8 type; +} __packed; +#define MGMT_ADDR_INFO_SIZE 7 + +#define MGMT_OP_READ_VERSION 0x0001 +#define MGMT_READ_VERSION_SIZE 0 +struct mgmt_rp_read_version { + __u8 version; + __le16 revision; +} __packed; + +#define MGMT_OP_READ_COMMANDS 0x0002 +#define MGMT_READ_COMMANDS_SIZE 0 +struct mgmt_rp_read_commands { + __le16 num_commands; + __le16 num_events; + __le16 opcodes[0]; +} __packed; + +#define MGMT_OP_READ_INDEX_LIST 0x0003 +#define MGMT_READ_INDEX_LIST_SIZE 0 +struct mgmt_rp_read_index_list { + __le16 num_controllers; + __le16 index[0]; +} __packed; + +/* Reserve one extra byte for names in management messages so that they + * are always guaranteed to be nul-terminated */ +#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) +#define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1) + +#define MGMT_SETTING_POWERED 0x00000001 +#define MGMT_SETTING_CONNECTABLE 0x00000002 +#define MGMT_SETTING_FAST_CONNECTABLE 0x00000004 +#define MGMT_SETTING_DISCOVERABLE 0x00000008 +#define MGMT_SETTING_PAIRABLE 0x00000010 +#define MGMT_SETTING_LINK_SECURITY 0x00000020 +#define MGMT_SETTING_SSP 0x00000040 +#define MGMT_SETTING_BREDR 0x00000080 +#define MGMT_SETTING_HS 0x00000100 +#define MGMT_SETTING_LE 0x00000200 + +#define MGMT_OP_READ_INFO 0x0004 +#define MGMT_READ_INFO_SIZE 0 +struct mgmt_rp_read_info { + bdaddr_t bdaddr; + __u8 version; + __le16 manufacturer; + __le32 supported_settings; + __le32 current_settings; + __u8 dev_class[3]; + __u8 name[MGMT_MAX_NAME_LENGTH]; + __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; +} __packed; + +struct mgmt_mode { + __u8 val; +} __packed; + +#define MGMT_SETTING_SIZE 1 + +#define MGMT_OP_SET_POWERED 0x0005 + +#define MGMT_OP_SET_DISCOVERABLE 0x0006 +struct mgmt_cp_set_discoverable { + __u8 val; + __le16 timeout; +} __packed; +#define MGMT_SET_DISCOVERABLE_SIZE 3 + +#define MGMT_OP_SET_CONNECTABLE 0x0007 + +#define MGMT_OP_SET_FAST_CONNECTABLE 0x0008 + +#define MGMT_OP_SET_PAIRABLE 0x0009 + +#define MGMT_OP_SET_LINK_SECURITY 0x000A + +#define MGMT_OP_SET_SSP 0x000B + +#define MGMT_OP_SET_HS 0x000C + +#define MGMT_OP_SET_LE 0x000D +#define MGMT_OP_SET_DEV_CLASS 0x000E +struct mgmt_cp_set_dev_class { + __u8 major; + __u8 minor; +} __packed; +#define MGMT_SET_DEV_CLASS_SIZE 2 + +#define MGMT_OP_SET_LOCAL_NAME 0x000F +struct mgmt_cp_set_local_name { + __u8 name[MGMT_MAX_NAME_LENGTH]; + __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; +} __packed; +#define MGMT_SET_LOCAL_NAME_SIZE 260 + +#define MGMT_OP_ADD_UUID 0x0010 +struct mgmt_cp_add_uuid { + __u8 uuid[16]; + __u8 svc_hint; +} __packed; +#define MGMT_ADD_UUID_SIZE 17 + +#define MGMT_OP_REMOVE_UUID 0x0011 +struct mgmt_cp_remove_uuid { + __u8 uuid[16]; +} __packed; +#define MGMT_REMOVE_UUID_SIZE 16 + +struct mgmt_link_key_info { + struct mgmt_addr_info addr; + __u8 type; + __u8 val[16]; + __u8 pin_len; +} __packed; + +#define MGMT_OP_LOAD_LINK_KEYS 0x0012 +struct mgmt_cp_load_link_keys { + __u8 debug_keys; + __le16 key_count; + struct mgmt_link_key_info keys[0]; +} __packed; +#define MGMT_LOAD_LINK_KEYS_SIZE 3 + +struct mgmt_ltk_info { + struct mgmt_addr_info addr; + __u8 authenticated; + __u8 master; + __u8 enc_size; + __le16 ediv; + __u8 rand[8]; + __u8 val[16]; +} __packed; + +#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013 +struct mgmt_cp_load_long_term_keys { + __le16 key_count; + struct mgmt_ltk_info keys[0]; +} __packed; +#define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2 + +#define MGMT_OP_DISCONNECT 0x0014 +struct mgmt_cp_disconnect { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE +struct mgmt_rp_disconnect { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_GET_CONNECTIONS 0x0015 +#define MGMT_GET_CONNECTIONS_SIZE 0 +struct mgmt_rp_get_connections { + __le16 conn_count; + struct mgmt_addr_info addr[0]; +} __packed; + +#define MGMT_OP_PIN_CODE_REPLY 0x0016 +struct mgmt_cp_pin_code_reply { + struct mgmt_addr_info addr; + __u8 pin_len; + __u8 pin_code[16]; +} __packed; +#define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17) +struct mgmt_rp_pin_code_reply { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 +struct mgmt_cp_pin_code_neg_reply { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_SET_IO_CAPABILITY 0x0018 +struct mgmt_cp_set_io_capability { + __u8 io_capability; +} __packed; +#define MGMT_SET_IO_CAPABILITY_SIZE 1 + +#define MGMT_OP_PAIR_DEVICE 0x0019 +struct mgmt_cp_pair_device { + struct mgmt_addr_info addr; + __u8 io_cap; +} __packed; +#define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) +struct mgmt_rp_pair_device { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A +#define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_UNPAIR_DEVICE 0x001B +struct mgmt_cp_unpair_device { + struct mgmt_addr_info addr; + __u8 disconnect; +} __packed; +#define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1) +struct mgmt_rp_unpair_device { + struct mgmt_addr_info addr; +}; + +#define MGMT_OP_USER_CONFIRM_REPLY 0x001C +struct mgmt_cp_user_confirm_reply { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE +struct mgmt_rp_user_confirm_reply { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D +struct mgmt_cp_user_confirm_neg_reply { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_USER_PASSKEY_REPLY 0x001E +struct mgmt_cp_user_passkey_reply { + struct mgmt_addr_info addr; + __le32 passkey; +} __packed; +#define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4) +struct mgmt_rp_user_passkey_reply { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F +struct mgmt_cp_user_passkey_neg_reply { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020 +#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 +struct mgmt_rp_read_local_oob_data { + __u8 hash[16]; + __u8 randomizer[16]; +} __packed; + +#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 +struct mgmt_cp_add_remote_oob_data { + struct mgmt_addr_info addr; + __u8 hash[16]; + __u8 randomizer[16]; +} __packed; +#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) + +#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 +struct mgmt_cp_remove_remote_oob_data { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_START_DISCOVERY 0x0023 +struct mgmt_cp_start_discovery { + __u8 type; +} __packed; +#define MGMT_START_DISCOVERY_SIZE 1 + +#define MGMT_OP_STOP_DISCOVERY 0x0024 +struct mgmt_cp_stop_discovery { + __u8 type; +} __packed; +#define MGMT_STOP_DISCOVERY_SIZE 1 + +#define MGMT_OP_CONFIRM_NAME 0x0025 +struct mgmt_cp_confirm_name { + struct mgmt_addr_info addr; + __u8 name_known; +} __packed; +#define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1) +struct mgmt_rp_confirm_name { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_OP_BLOCK_DEVICE 0x0026 +struct mgmt_cp_block_device { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_OP_UNBLOCK_DEVICE 0x0027 +struct mgmt_cp_unblock_device { + struct mgmt_addr_info addr; +} __packed; +#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE + +#define MGMT_EV_CMD_COMPLETE 0x0001 +struct mgmt_ev_cmd_complete { + __le16 opcode; + __u8 status; + __u8 data[0]; +} __packed; + +#define MGMT_EV_CMD_STATUS 0x0002 +struct mgmt_ev_cmd_status { + __le16 opcode; + __u8 status; +} __packed; + +#define MGMT_EV_CONTROLLER_ERROR 0x0003 +struct mgmt_ev_controller_error { + __u8 error_code; +} __packed; + +#define MGMT_EV_INDEX_ADDED 0x0004 + +#define MGMT_EV_INDEX_REMOVED 0x0005 + +#define MGMT_EV_NEW_SETTINGS 0x0006 + +#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 +struct mgmt_ev_class_of_dev_changed { + __u8 dev_class[3]; +}; + +#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 +struct mgmt_ev_local_name_changed { + __u8 name[MGMT_MAX_NAME_LENGTH]; + __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; +} __packed; + +#define MGMT_EV_NEW_LINK_KEY 0x0009 +struct mgmt_ev_new_link_key { + __u8 store_hint; + struct mgmt_link_key_info key; +} __packed; + +#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A +struct mgmt_ev_new_long_term_key { + __u8 store_hint; + struct mgmt_ltk_info key; +} __packed; + +#define MGMT_EV_DEVICE_CONNECTED 0x000B +struct mgmt_ev_device_connected { + struct mgmt_addr_info addr; + __le32 flags; + __le16 eir_len; + __u8 eir[0]; +} __packed; + +#define MGMT_EV_DEVICE_DISCONNECTED 0x000C + +#define MGMT_EV_CONNECT_FAILED 0x000D +struct mgmt_ev_connect_failed { + struct mgmt_addr_info addr; + __u8 status; +} __packed; + +#define MGMT_EV_PIN_CODE_REQUEST 0x000E +struct mgmt_ev_pin_code_request { + struct mgmt_addr_info addr; + __u8 secure; +} __packed; + +#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F +struct mgmt_ev_user_confirm_request { + struct mgmt_addr_info addr; + __u8 confirm_hint; + __le32 value; +} __packed; + +#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010 +struct mgmt_ev_user_passkey_request { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_EV_AUTH_FAILED 0x0011 +struct mgmt_ev_auth_failed { + struct mgmt_addr_info addr; + __u8 status; +} __packed; + +#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 +#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 + +#define MGMT_EV_DEVICE_FOUND 0x0012 +struct mgmt_ev_device_found { + struct mgmt_addr_info addr; + __s8 rssi; + __u8 flags[4]; + __le16 eir_len; + __u8 eir[0]; +} __packed; + +#define MGMT_EV_DISCOVERING 0x0013 +struct mgmt_ev_discovering { + __u8 type; + __u8 discovering; +} __packed; + +#define MGMT_EV_DEVICE_BLOCKED 0x0014 +struct mgmt_ev_device_blocked { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_EV_DEVICE_UNBLOCKED 0x0015 +struct mgmt_ev_device_unblocked { + struct mgmt_addr_info addr; +} __packed; + +#define MGMT_EV_DEVICE_UNPAIRED 0x0016 +struct mgmt_ev_device_unpaired { + struct mgmt_addr_info addr; +} __packed; diff --git a/include/net/bluetooth/tizen/rfcomm.h b/include/net/bluetooth/tizen/rfcomm.h new file mode 100644 index 0000000..e2e3eca --- /dev/null +++ b/include/net/bluetooth/tizen/rfcomm.h @@ -0,0 +1,372 @@ +/* + RFCOMM implementation for Linux Bluetooth stack (BlueZ) + Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> + Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __RFCOMM_H +#define __RFCOMM_H + +#define RFCOMM_PSM 3 + +#define RFCOMM_CONN_TIMEOUT (HZ * 30) +#define RFCOMM_DISC_TIMEOUT (HZ * 20) +#define RFCOMM_AUTH_TIMEOUT (HZ * 25) +#define RFCOMM_IDLE_TIMEOUT (HZ * 2) + +#define RFCOMM_DEFAULT_MTU 127 +#define RFCOMM_DEFAULT_CREDITS 7 + +#define RFCOMM_MAX_L2CAP_MTU 1013 +#define RFCOMM_MAX_CREDITS 40 + +#define RFCOMM_SKB_HEAD_RESERVE 8 +#define RFCOMM_SKB_TAIL_RESERVE 2 +#define RFCOMM_SKB_RESERVE (RFCOMM_SKB_HEAD_RESERVE + RFCOMM_SKB_TAIL_RESERVE) + +#define RFCOMM_SABM 0x2f +#define RFCOMM_DISC 0x43 +#define RFCOMM_UA 0x63 +#define RFCOMM_DM 0x0f +#define RFCOMM_UIH 0xef + +#define RFCOMM_TEST 0x08 +#define RFCOMM_FCON 0x28 +#define RFCOMM_FCOFF 0x18 +#define RFCOMM_MSC 0x38 +#define RFCOMM_RPN 0x24 +#define RFCOMM_RLS 0x14 +#define RFCOMM_PN 0x20 +#define RFCOMM_NSC 0x04 + +#define RFCOMM_V24_FC 0x02 +#define RFCOMM_V24_RTC 0x04 +#define RFCOMM_V24_RTR 0x08 +#define RFCOMM_V24_IC 0x40 +#define RFCOMM_V24_DV 0x80 + +#define RFCOMM_RPN_BR_2400 0x0 +#define RFCOMM_RPN_BR_4800 0x1 +#define RFCOMM_RPN_BR_7200 0x2 +#define RFCOMM_RPN_BR_9600 0x3 +#define RFCOMM_RPN_BR_19200 0x4 +#define RFCOMM_RPN_BR_38400 0x5 +#define RFCOMM_RPN_BR_57600 0x6 +#define RFCOMM_RPN_BR_115200 0x7 +#define RFCOMM_RPN_BR_230400 0x8 + +#define RFCOMM_RPN_DATA_5 0x0 +#define RFCOMM_RPN_DATA_6 0x1 +#define RFCOMM_RPN_DATA_7 0x2 +#define RFCOMM_RPN_DATA_8 0x3 + +#define RFCOMM_RPN_STOP_1 0 +#define RFCOMM_RPN_STOP_15 1 + +#define RFCOMM_RPN_PARITY_NONE 0x0 +#define RFCOMM_RPN_PARITY_ODD 0x1 +#define RFCOMM_RPN_PARITY_EVEN 0x3 +#define RFCOMM_RPN_PARITY_MARK 0x5 +#define RFCOMM_RPN_PARITY_SPACE 0x7 + +#define RFCOMM_RPN_FLOW_NONE 0x00 + +#define RFCOMM_RPN_XON_CHAR 0x11 +#define RFCOMM_RPN_XOFF_CHAR 0x13 + +#define RFCOMM_RPN_PM_BITRATE 0x0001 +#define RFCOMM_RPN_PM_DATA 0x0002 +#define RFCOMM_RPN_PM_STOP 0x0004 +#define RFCOMM_RPN_PM_PARITY 0x0008 +#define RFCOMM_RPN_PM_PARITY_TYPE 0x0010 +#define RFCOMM_RPN_PM_XON 0x0020 +#define RFCOMM_RPN_PM_XOFF 0x0040 +#define RFCOMM_RPN_PM_FLOW 0x3F00 + +#define RFCOMM_RPN_PM_ALL 0x3F7F + +struct rfcomm_hdr { + u8 addr; + u8 ctrl; + u8 len; /* Actual size can be 2 bytes */ +} __packed; + +struct rfcomm_cmd { + u8 addr; + u8 ctrl; + u8 len; + u8 fcs; +} __packed; + +struct rfcomm_mcc { + u8 type; + u8 len; +} __packed; + +struct rfcomm_pn { + u8 dlci; + u8 flow_ctrl; + u8 priority; + u8 ack_timer; + __le16 mtu; + u8 max_retrans; + u8 credits; +} __packed; + +struct rfcomm_rpn { + u8 dlci; + u8 bit_rate; + u8 line_settings; + u8 flow_ctrl; + u8 xon_char; + u8 xoff_char; + __le16 param_mask; +} __packed; + +struct rfcomm_rls { + u8 dlci; + u8 status; +} __packed; + +struct rfcomm_msc { + u8 dlci; + u8 v24_sig; +} __packed; + +/* ---- Core structures, flags etc ---- */ + +struct rfcomm_session { + struct list_head list; + struct socket *sock; + struct timer_list timer; + unsigned long state; + unsigned long flags; + atomic_t refcnt; + int initiator; + + /* Default DLC parameters */ + int cfc; + uint mtu; + + struct list_head dlcs; +}; + +struct rfcomm_dlc { + struct list_head list; + struct rfcomm_session *session; + struct sk_buff_head tx_queue; + struct timer_list timer; + + spinlock_t lock; + unsigned long state; + unsigned long flags; + atomic_t refcnt; + u8 dlci; + u8 addr; + u8 priority; + u8 v24_sig; + u8 remote_v24_sig; + u8 mscex; + u8 out; + u8 sec_level; + u8 role_switch; + u32 defer_setup; + + uint mtu; + uint cfc; + uint rx_credits; + uint tx_credits; + + void *owner; + + void (*data_ready)(struct rfcomm_dlc *d, struct sk_buff *skb); + void (*state_change)(struct rfcomm_dlc *d, int err); + void (*modem_status)(struct rfcomm_dlc *d, u8 v24_sig); +}; + +/* DLC and session flags */ +#define RFCOMM_RX_THROTTLED 0 +#define RFCOMM_TX_THROTTLED 1 +#define RFCOMM_TIMED_OUT 2 +#define RFCOMM_MSC_PENDING 3 +#define RFCOMM_SEC_PENDING 4 +#define RFCOMM_AUTH_PENDING 5 +#define RFCOMM_AUTH_ACCEPT 6 +#define RFCOMM_AUTH_REJECT 7 +#define RFCOMM_DEFER_SETUP 8 +#define RFCOMM_ENC_DROP 9 + +/* Scheduling flags and events */ +#define RFCOMM_SCHED_WAKEUP 31 + +/* MSC exchange flags */ +#define RFCOMM_MSCEX_TX 1 +#define RFCOMM_MSCEX_RX 2 +#define RFCOMM_MSCEX_OK (RFCOMM_MSCEX_TX + RFCOMM_MSCEX_RX) + +/* CFC states */ +#define RFCOMM_CFC_UNKNOWN -1 +#define RFCOMM_CFC_DISABLED 0 +#define RFCOMM_CFC_ENABLED RFCOMM_MAX_CREDITS + +/* ---- RFCOMM SEND RPN ---- */ +int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, + u8 bit_rate, u8 data_bits, u8 stop_bits, + u8 parity, u8 flow_ctrl_settings, + u8 xon_char, u8 xoff_char, u16 param_mask); + +/* ---- RFCOMM DLCs (channels) ---- */ +struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio); +void rfcomm_dlc_free(struct rfcomm_dlc *d); +int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, + u8 channel); +int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); +int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); +int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); +int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); +void rfcomm_dlc_accept(struct rfcomm_dlc *d); + +#define rfcomm_dlc_lock(d) spin_lock(&d->lock) +#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) + +static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) +{ + atomic_inc(&d->refcnt); +} + +static inline void rfcomm_dlc_put(struct rfcomm_dlc *d) +{ + if (atomic_dec_and_test(&d->refcnt)) + rfcomm_dlc_free(d); +} + +extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); +extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); + +static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) +{ + if (!test_and_set_bit(RFCOMM_RX_THROTTLED, &d->flags)) + __rfcomm_dlc_throttle(d); +} + +static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) +{ + if (test_and_clear_bit(RFCOMM_RX_THROTTLED, &d->flags)) + __rfcomm_dlc_unthrottle(d); +} + +/* ---- RFCOMM sessions ---- */ +void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, + bdaddr_t *dst); + +static inline void rfcomm_session_hold(struct rfcomm_session *s) +{ + atomic_inc(&s->refcnt); +} + +/* ---- RFCOMM sockets ---- */ +struct sockaddr_rc { + sa_family_t rc_family; + bdaddr_t rc_bdaddr; + u8 rc_channel; +}; + +#define RFCOMM_CONNINFO 0x02 +struct rfcomm_conninfo { + __u16 hci_handle; + __u8 dev_class[3]; +}; + +#define RFCOMM_LM 0x03 +#define RFCOMM_LM_MASTER 0x0001 +#define RFCOMM_LM_AUTH 0x0002 +#define RFCOMM_LM_ENCRYPT 0x0004 +#define RFCOMM_LM_TRUSTED 0x0008 +#define RFCOMM_LM_RELIABLE 0x0010 +#define RFCOMM_LM_SECURE 0x0020 + +#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) + +struct rfcomm_pinfo { + struct bt_sock bt; + struct rfcomm_dlc *dlc; + u8 channel; + u8 sec_level; + u8 role_switch; +}; + +int rfcomm_init_sockets(void); +void rfcomm_cleanup_sockets(void); + +int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, + struct rfcomm_dlc **d); + +/* ---- RFCOMM TTY ---- */ +#define RFCOMM_MAX_DEV 256 + +#define RFCOMMCREATEDEV _IOW('R', 200, int) +#define RFCOMMRELEASEDEV _IOW('R', 201, int) +#define RFCOMMGETDEVLIST _IOR('R', 210, int) +#define RFCOMMGETDEVINFO _IOR('R', 211, int) +#define RFCOMMSTEALDLC _IOW('R', 220, int) + +#define RFCOMM_REUSE_DLC 0 +#define RFCOMM_RELEASE_ONHUP 1 +#define RFCOMM_HANGUP_NOW 2 +#define RFCOMM_TTY_ATTACHED 3 +#define RFCOMM_TTY_RELEASED 4 + +struct rfcomm_dev_req { + s16 dev_id; + u32 flags; + bdaddr_t src; + bdaddr_t dst; + u8 channel; +}; + +struct rfcomm_dev_info { + s16 id; + u32 flags; + u16 state; + bdaddr_t src; + bdaddr_t dst; + u8 channel; +}; + +struct rfcomm_dev_list_req { + u16 dev_num; + struct rfcomm_dev_info dev_info[0]; +}; + +int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); + +#ifdef CONFIG_BT_RFCOMM_TTY +int rfcomm_init_ttys(void); +void rfcomm_cleanup_ttys(void); +#else +static inline int rfcomm_init_ttys(void) +{ + return 0; +} +static inline void rfcomm_cleanup_ttys(void) +{ +} +#endif +#endif /* __RFCOMM_H */ diff --git a/include/net/bluetooth/tizen/sco.h b/include/net/bluetooth/tizen/sco.h new file mode 100644 index 0000000..1e35c43 --- /dev/null +++ b/include/net/bluetooth/tizen/sco.h @@ -0,0 +1,79 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2000-2001 Qualcomm Incorporated + + Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __SCO_H +#define __SCO_H + +/* SCO defaults */ +#define SCO_DEFAULT_MTU 500 +#define SCO_DEFAULT_FLUSH_TO 0xFFFF + +#define SCO_CONN_TIMEOUT (HZ * 40) +#define SCO_DISCONN_TIMEOUT (HZ * 2) +#define SCO_CONN_IDLE_TIMEOUT (HZ * 60) + +/* SCO socket address */ +struct sockaddr_sco { + sa_family_t sco_family; + bdaddr_t sco_bdaddr; +}; + +/* SCO socket options */ +#define SCO_OPTIONS 0x01 +struct sco_options { + __u16 mtu; +}; + +#define SCO_CONNINFO 0x02 +struct sco_conninfo { + __u16 hci_handle; + __u8 dev_class[3]; +}; + +/* ---- SCO connections ---- */ +struct sco_conn { + struct hci_conn *hcon; + + bdaddr_t *dst; + bdaddr_t *src; + + spinlock_t lock; + struct sock *sk; + + unsigned int mtu; +}; + +#define sco_conn_lock(c) spin_lock(&c->lock); +#define sco_conn_unlock(c) spin_unlock(&c->lock); + +/* ----- SCO socket info ----- */ +#define sco_pi(sk) ((struct sco_pinfo *) sk) + +struct sco_pinfo { + struct bt_sock bt; + __u32 flags; + struct sco_conn *conn; +}; + +#endif /* __SCO_H */ diff --git a/include/net/bluetooth/tizen/smp.h b/include/net/bluetooth/tizen/smp.h new file mode 100644 index 0000000..7b3acdd --- /dev/null +++ b/include/net/bluetooth/tizen/smp.h @@ -0,0 +1,146 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#ifndef __SMP_H +#define __SMP_H + +struct smp_command_hdr { + __u8 code; +} __packed; + +#define SMP_CMD_PAIRING_REQ 0x01 +#define SMP_CMD_PAIRING_RSP 0x02 +struct smp_cmd_pairing { + __u8 io_capability; + __u8 oob_flag; + __u8 auth_req; + __u8 max_key_size; + __u8 init_key_dist; + __u8 resp_key_dist; +} __packed; + +#define SMP_IO_DISPLAY_ONLY 0x00 +#define SMP_IO_DISPLAY_YESNO 0x01 +#define SMP_IO_KEYBOARD_ONLY 0x02 +#define SMP_IO_NO_INPUT_OUTPUT 0x03 +#define SMP_IO_KEYBOARD_DISPLAY 0x04 + +#define SMP_OOB_NOT_PRESENT 0x00 +#define SMP_OOB_PRESENT 0x01 + +#define SMP_DIST_ENC_KEY 0x01 +#define SMP_DIST_ID_KEY 0x02 +#define SMP_DIST_SIGN 0x04 + +#define SMP_AUTH_NONE 0x00 +#define SMP_AUTH_BONDING 0x01 +#define SMP_AUTH_MITM 0x04 + +#define SMP_CMD_PAIRING_CONFIRM 0x03 +struct smp_cmd_pairing_confirm { + __u8 confirm_val[16]; +} __packed; + +#define SMP_CMD_PAIRING_RANDOM 0x04 +struct smp_cmd_pairing_random { + __u8 rand_val[16]; +} __packed; + +#define SMP_CMD_PAIRING_FAIL 0x05 +struct smp_cmd_pairing_fail { + __u8 reason; +} __packed; + +#define SMP_CMD_ENCRYPT_INFO 0x06 +struct smp_cmd_encrypt_info { + __u8 ltk[16]; +} __packed; + +#define SMP_CMD_MASTER_IDENT 0x07 +struct smp_cmd_master_ident { + __u16 ediv; + __u8 rand[8]; +} __packed; + +#define SMP_CMD_IDENT_INFO 0x08 +struct smp_cmd_ident_info { + __u8 irk[16]; +} __packed; + +#define SMP_CMD_IDENT_ADDR_INFO 0x09 +struct smp_cmd_ident_addr_info { + __u8 addr_type; + bdaddr_t bdaddr; +} __packed; + +#define SMP_CMD_SIGN_INFO 0x0a +struct smp_cmd_sign_info { + __u8 csrk[16]; +} __packed; + +#define SMP_CMD_SECURITY_REQ 0x0b +struct smp_cmd_security_req { + __u8 auth_req; +} __packed; + +#define SMP_PASSKEY_ENTRY_FAILED 0x01 +#define SMP_OOB_NOT_AVAIL 0x02 +#define SMP_AUTH_REQUIREMENTS 0x03 +#define SMP_CONFIRM_FAILED 0x04 +#define SMP_PAIRING_NOTSUPP 0x05 +#define SMP_ENC_KEY_SIZE 0x06 +#define SMP_CMD_NOTSUPP 0x07 +#define SMP_UNSPECIFIED 0x08 +#define SMP_REPEATED_ATTEMPTS 0x09 + +#define SMP_MIN_ENC_KEY_SIZE 7 +#define SMP_MAX_ENC_KEY_SIZE 16 + +#define SMP_FLAG_TK_VALID 1 +#define SMP_FLAG_CFM_PENDING 2 +#define SMP_FLAG_MITM_AUTH 3 + +struct smp_chan { + struct l2cap_conn *conn; + u8 preq[7]; /* SMP Pairing Request */ + u8 prsp[7]; /* SMP Pairing Response */ + u8 prnd[16]; /* SMP Pairing Random (local) */ + u8 rrnd[16]; /* SMP Pairing Random (remote) */ + u8 pcnf[16]; /* SMP Pairing Confirm */ + u8 tk[16]; /* SMP Temporary Key */ + u8 enc_key_size; + unsigned long smp_flags; + struct crypto_blkcipher *tfm; + struct work_struct confirm; + struct work_struct random; + +}; + +/* SMP Commands */ +int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); +int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); +int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); +int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey); + +void smp_chan_destroy(struct l2cap_conn *conn); + +#endif /* __SMP_H */ diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f93ec48..4014ddc 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -426,6 +426,7 @@ struct station_parameters { * @STATION_INFO_RX_BITRATE: @rxrate fields are filled * @STATION_INFO_BSS_PARAM: @bss_param filled * @STATION_INFO_CONNECTED_TIME: @connected_time filled + * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled */ enum station_info_flags { STATION_INFO_INACTIVE_TIME = 1<<0, @@ -444,7 +445,8 @@ enum station_info_flags { STATION_INFO_SIGNAL_AVG = 1<<13, STATION_INFO_RX_BITRATE = 1<<14, STATION_INFO_BSS_PARAM = 1<<15, - STATION_INFO_CONNECTED_TIME = 1<<16 + STATION_INFO_CONNECTED_TIME = 1<<16, + STATION_INFO_ASSOC_REQ_IES = 1<<17 }; /** @@ -811,6 +813,15 @@ struct cfg80211_scan_request { }; /** + * struct cfg80211_match_set - sets of attributes to match + * + * @ssid: SSID to be matched + */ +struct cfg80211_match_set { + struct cfg80211_ssid ssid; +}; + +/** * struct cfg80211_sched_scan_request - scheduled scan request description * * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) @@ -819,6 +830,11 @@ struct cfg80211_scan_request { * @interval: interval between each scheduled scan cycle * @ie: optional information element(s) to add into Probe Request or %NULL * @ie_len: length of ie in octets + * @match_sets: sets of parameters to be matched for a scan result + * entry to be considered valid and to be passed to the host + * (others are filtered out). + * If ommited, all results are passed. + * @n_match_sets: number of match sets * @wiphy: the wiphy this was for * @dev: the interface * @channels: channels to scan @@ -830,6 +846,8 @@ struct cfg80211_sched_scan_request { u32 interval; const u8 *ie; size_t ie_len; + struct cfg80211_match_set *match_sets; + int n_match_sets; /* internal */ struct wiphy *wiphy; @@ -1729,9 +1747,16 @@ struct wiphy_wowlan_support { * this variable determines its size * @max_scan_ssids: maximum number of SSIDs the device can scan for in * any given scan + * @max_sched_scan_ssids: maximum number of SSIDs the device can scan + * for in any given scheduled scan + * @max_match_sets: maximum number of match sets the device can handle + * when performing a scheduled scan, 0 if filtering is not + * supported. * @max_scan_ie_len: maximum length of user-controlled IEs device can * add to probe request frames transmitted during a scan, must not * include fixed IEs like supported rates + * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled + * scans * @coverage_class: current coverage class * @fw_version: firmware version for ethtool reporting * @hw_version: hardware version for ethtool reporting @@ -1783,7 +1808,10 @@ struct wiphy { int bss_priv_size; u8 max_scan_ssids; + u8 max_sched_scan_ssids; + u8 max_match_sets; u16 max_scan_ie_len; + u16 max_sched_scan_ie_len; int n_cipher_suites; const u32 *cipher_suites; diff --git a/include/sec_feature/CustFeature.h b/include/sec_feature/CustFeature.h deleted file mode 100644 index 3c1933b..0000000 --- a/include/sec_feature/CustFeature.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Auto generated file (target: m0xx)*/ -/* DO NOT EDIT THIS FILE */ -#define CUSTFEATURE_APPFW_DEFAULT_HARDWAREACCEL 1; -#define CUSTFEATURE_APPFW_LOCKSCREEN_MEDIA_WIDGET 1; -#define CUSTFEATURE_APPFW_LOCKSCREEN_TICKER 1; -#define CUSTFEATURE_WLAN_DEFAULT_AP 1; -#define CUSTFEATURE_WLAN_DEFAULT_HOTSPOT_PASSWORD "SamsungDefault"; -#define CUSTFEATURE_WLAN_DEFAULT_HOTSPOT_SSID "Default"; -/* END OF FILE */ diff --git a/include/sec_feature/GlobalConfig.h b/include/sec_feature/GlobalConfig.h deleted file mode 100644 index 742e782..0000000 --- a/include/sec_feature/GlobalConfig.h +++ /dev/null @@ -1,160 +0,0 @@ -/* Auto generated file (target: m0xx)*/ -/* DO NOT EDIT THIS FILE */ -#define GLOBALCONFIG_ALLSHARE_FRAMEWORK 1 -#define GLOBALCONFIG_AUDIO_AUDIENCE_TWOMIC 1 -#define GLOBALCONFIG_AUDIO_BOOTSOUND 1 -#define GLOBALCONFIG_AUDIO_COMMON 1 -#define GLOBALCONFIG_AUDIO_CONTROL_CSC 1 -#define GLOBALCONFIG_AUDIO_DHA_SOL_MAL2 1 -#define GLOBALCONFIG_AUDIO_EARJACK_WATERPROOF 1 -#define GLOBALCONFIG_AUDIO_EAR_SEPARATION 1 -#define GLOBALCONFIG_AUDIO_ENFORCED_AUDIBLE 1 -#define GLOBALCONFIG_AUDIO_EXTERNAL_DEVICE 1 -#define GLOBALCONFIG_AUDIO_EXTERNAL_TMS 1 -#define GLOBALCONFIG_AUDIO_FMRADIO 1 -#define GLOBALCONFIG_AUDIO_FMRECORDING 1 -#define GLOBALCONFIG_AUDIO_HAS_BACKMIC 1 -#define GLOBALCONFIG_AUDIO_HAS_RECEIVER 1 -#define GLOBALCONFIG_AUDIO_HAS_THIRDMIC 1 -#define GLOBALCONFIG_AUDIO_IMMERSION_REVERB 1 -#define GLOBALCONFIG_AUDIO_LVVIL 1 -#define GLOBALCONFIG_AUDIO_QC_STAGEFRIGHT 1 -#define GLOBALCONFIG_AUDIO_RESAMPLER 1 -#define GLOBALCONFIG_AUDIO_RESAMPLER_PLAYBACK 1 -#define GLOBALCONFIG_AUDIO_RESAMPLER_RECORD 1 -#define GLOBALCONFIG_AUDIO_SAMSUNGRECORD 1 -#define GLOBALCONFIG_AUDIO_SLAVE_CODEC_CLOCK 1 -#define GLOBALCONFIG_AUDIO_SOUNDALIVE 1 -#define GLOBALCONFIG_AUDIO_SOUNDBOOSTER 1 -#define GLOBALCONFIG_AUDIO_SOUNDSPEED 1 -#define GLOBALCONFIG_AUDIO_STEREO_TO_MONO 1 -#define GLOBALCONFIG_AUDIO_USE_2MIC_FOR_CAMCORDER 1 -#define GLOBALCONFIG_BLUETOOTH_APT_X_SUPPORT 1 -#define GLOBALCONFIG_BLUETOOTH_OPP_VCARD_AUTO_IMPORT 1 -#define GLOBALCONFIG_BLUETOOTH_PHONEBOOK_SIM_SUPPORT 1 -#define GLOBALCONFIG_BT_NO_LEN_TRANSFER_ALL 1 -#define GLOBALCONFIG_CALL_VT_SUPPORT 1 -#define GLOBALCONFIG_CAMERA_ENABLE_FACE_SERVICE 1 -#define GLOBALCONFIG_COMMON_MODEL "" -#define GLOBALCONFIG_COMMON_OPERATOR "" -#define GLOBALCONFIG_COMMON_REGION "" -#define GLOBALCONFIG_GPS_SENSORAIDING_ENABLE 1 -#define GLOBALCONFIG_LCD_AMOLED_DISPLAY 1 -#define GLOBALCONFIG_LCD_MDNIE_FUNCTION 1 -#define GLOBALCONFIG_NFC_ESE_SUPPORT 1 -#define GLOBALCONFIG_NFC_GGSM_UICC 1 -#define GLOBALCONFIG_NFC_SUPPORT 1 -#define GLOBALCONFIG_NFC_USES_EXTERNAL_RF_FIELD 1 -#define GLOBALCONFIG_RIL_AUTO_REDIAL 1 -#define GLOBALCONFIG_RIL_CALL_BARRING_API 1 -#define GLOBALCONFIG_RIL_CHECK_MCC 1 -#define GLOBALCONFIG_RIL_CHECK_PLMN_WHEN_MANUAL_SELECTION 1 -#define GLOBALCONFIG_RIL_CNAP 1 -#define GLOBALCONFIG_RIL_DATA_ALLOW_1x_DATA_CALL 1 -#define GLOBALCONFIG_RIL_DATA_RETRY_POLICY 1 -#define GLOBALCONFIG_RIL_DIAL_FOR_SHORTCODE 1 -#define GLOBALCONFIG_RIL_DISPLAY_CNAP 1 -#define GLOBALCONFIG_RIL_DISPLAY_EMERGENCYCALLONLY 1 -#define GLOBALCONFIG_RIL_DISPLAY_RESTRICT_NOTI 1 -#define GLOBALCONFIG_RIL_DR_NO_INTERFACE 1 -#define GLOBALCONFIG_RIL_EMERGENCY_CALL 1 -#define GLOBALCONFIG_RIL_ENABLE_CHANGE_DEFAULT_PDN_RECONNECT_SAME_PDN 1 -#define GLOBALCONFIG_RIL_ENABLE_ECCLIST_WITH_PLMN 1 -#define GLOBALCONFIG_RIL_ERI_POLICY "0" -#define GLOBALCONFIG_RIL_GCF_SS 1 -#define GLOBALCONFIG_RIL_HOTSPOT_MSISDN_RESET 1 -#define GLOBALCONFIG_RIL_MMS_SUPPORT_CONTENT_DISPOSITION 1 -#define GLOBALCONFIG_RIL_PHONEBOOK_SUPPORT_EMAIL 1 -#define GLOBALCONFIG_RIL_RESET_CURRENT_DATA_TECH 1 -#define GLOBALCONFIG_RIL_SAMSUNG_LIBRIL_INTF_EXTENSION 1 -#define GLOBALCONFIG_RIL_SET_ISO_USING_MCC 1 -#define GLOBALCONFIG_RIL_SIM_PHONEBOOKAPI 1 -#define GLOBALCONFIG_RIL_SPLIT_SIGNAL_BARS_AND_RSSI 1 -#define GLOBALCONFIG_RIL_SS_BARRING_PASSWORD 1 -#define GLOBALCONFIG_RIL_SS_FORWARDING_ICON 1 -#define GLOBALCONFIG_RIL_STK_SETUP_IDLE_MODE_TEXT_SUPPORT 1 -#define GLOBALCONFIG_RIL_SUPPORT_SAMSUNG_OEMHOOKRAW 1 -#define GLOBALCONFIG_RIL_TCP_SETTING_WHEN_NW_TYPE_CHANGED 1 -#define GLOBALCONFIG_RIL_UPDATE_PROPERTY_FOR_PLMN 1 -#define GLOBALCONFIG_SAMSUNG_CLOUD_DATASYNC 1 -#define GLOBALCONFIG_SETTINGS_SBEAM_DEFAULT 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_AUTOHAPTIC 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_DNIE 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_DOCK 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_FLASH 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_GPS 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_GYRO_SENSOR 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_HW_HOME_KEY 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_LED_INDICATOR 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_LOCK_SCREEN_SHORTCUT 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_LOCK_SCREEN_SHORTCUT_APP_LIST 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_ACTIVATION 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_CAMERA_SHORT_CUT 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_DOUBLE_TAP 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PALM_SWIPE 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PALM_TOUCH 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PAN 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PAN_TO_BROWSE_IMAGE 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PICK_UP 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_PICK_UP_TO_CALL_OUT 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_SHAKE 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_TILT 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_TILT_TO_UNLOCK 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_MOTION_TRUN_OVER 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_SBEAM 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_SIM_CHECK 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_SURFACE 1 -#define GLOBALCONFIG_SETTINGS_SUPPORT_VIBRATION_INTENSITY 1 -#define GLOBALCONFIG_SIP_RESOLUTION "" -#define GLOBALCONFIG_SIP_TYPE "" -#define GLOBALCONFIG_SMEMO_CHECK 1 -#define GLOBALCONFIG_VIEWSYSTEM_ENABLE_TRANSITION_ANIMATION 1 -#define GLOBALCONFIG_VIEWSYSTEM_USE_VIBETONZ 1 -#define GLOBALCONFIG_WFD_COMMON 1 -#define GLOBALCONFIG_WLAN_ACCESS_POINT_SORT_BASE "ssid" -#define GLOBALCONFIG_WLAN_BOOSTER_BTCOEX_THRESHOLD "128" -#define GLOBALCONFIG_WLAN_BOOSTER_FULLMODE_THRESHOLD "1024" -#define GLOBALCONFIG_WLAN_BOOSTER_HOTSPOT3GMODE_THRESHOLD "128" -#define GLOBALCONFIG_WLAN_BOOSTER_MAX_CLOCK "MAX" -#define GLOBALCONFIG_WLAN_CHANGEABLE_SCAN_TIME 1 -#define GLOBALCONFIG_WLAN_CHECK_DEEPSLEEP 1 -#define GLOBALCONFIG_WLAN_CHECK_FWTYPE 1 -#define GLOBALCONFIG_WLAN_CONCURRENT_MODE 1 -#define GLOBALCONFIG_WLAN_DATA_ACTIVITY_BOOSTER 1 -#define GLOBALCONFIG_WLAN_DIRECT_SKIP_DHCP 1 -#define GLOBALCONFIG_WLAN_DPM 1 -#define GLOBALCONFIG_WLAN_DUAL_BAND_SUPPORT 1 -#define GLOBALCONFIG_WLAN_EAP_AKA 1 -#define GLOBALCONFIG_WLAN_EAP_FAST 1 -#define GLOBALCONFIG_WLAN_EAP_SIM 1 -#define GLOBALCONFIG_WLAN_ENABLE_TO_SET_AMPDU 1 -#define GLOBALCONFIG_WLAN_ENABLE_TO_SET_MINIMIZE_RETRY 1 -#define GLOBALCONFIG_WLAN_GET_FREQUENCY 1 -#define GLOBALCONFIG_WLAN_KIES_VIA_WIFI_AUTO_CONNECTION 1 -#define GLOBALCONFIG_WLAN_MDM 1 -#define GLOBALCONFIG_WLAN_MOBILEAP_IFACE "wlan0" -#define GLOBALCONFIG_WLAN_P2P_CHECK_GC_LIST 1 -#define GLOBALCONFIG_WLAN_P2P_THEME_STRING "@android:style/Theme.DeviceDefault" -#define GLOBALCONFIG_WLAN_PMKSA_CACHE_CLEAR_ALL 1 -#define GLOBALCONFIG_WLAN_PREVENT_EXCESSIVE_SCANNING 1 -#define GLOBALCONFIG_WLAN_SEC_AP_SUMMARY 1 -#define GLOBALCONFIG_WLAN_SEC_CONNECTION_FAILURE_UX 1 -#define GLOBALCONFIG_WLAN_SEC_CONNECTION_TOAST_AP_COLOR "#59D0F3" -#define GLOBALCONFIG_WLAN_SEC_CONNECTIVITY_CHECK 1 -#define GLOBALCONFIG_WLAN_SEC_FIRST5G_SCAN 1 -#define GLOBALCONFIG_WLAN_SEC_HIDDEN_AP_DEFAULT_SCAN_COUNT 1 -#define GLOBALCONFIG_WLAN_SEC_HIDE_SECURED_AP_INFO 1 -#define GLOBALCONFIG_WLAN_SEC_IGNORE_DELAYED_DRIVER_STOP 1 -#define GLOBALCONFIG_WLAN_SEC_MOBILEAP 1 -#define GLOBALCONFIG_WLAN_SEC_RETRY_POPUP 1 -#define GLOBALCONFIG_WLAN_SEC_SETTINGS_UX 1 -#define GLOBALCONFIG_WLAN_SEC_WIFI_AFTER_BOOTCOMPLETE 1 -#define GLOBALCONFIG_WLAN_SEC_WIFION_CSC 1 -#define GLOBALCONFIG_WLAN_SEC_WPS_POPUP 1 -#define GLOBALCONFIG_WLAN_SHAKE_RESCAN_MOTION 1 -#define GLOBALCONFIG_WLAN_SHOW_APLIST_POPUP 1 -#define GLOBALCONFIG_WLAN_WIFIDISPLAY 1 -#define GLOBALCONFIG_WLAN_WMM 1 -#define GLOBALCONFIG_WLAN_WMM_UAPSD 1 -/* END OF FILE */ diff --git a/include/trace/events/cpufreq_interactive.h b/include/trace/events/cpufreq_interactive.h new file mode 100644 index 0000000..ea83664 --- /dev/null +++ b/include/trace/events/cpufreq_interactive.h @@ -0,0 +1,112 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cpufreq_interactive + +#if !defined(_TRACE_CPUFREQ_INTERACTIVE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_CPUFREQ_INTERACTIVE_H + +#include <linux/tracepoint.h> + +DECLARE_EVENT_CLASS(set, + TP_PROTO(u32 cpu_id, unsigned long targfreq, + unsigned long actualfreq), + TP_ARGS(cpu_id, targfreq, actualfreq), + + TP_STRUCT__entry( + __field( u32, cpu_id ) + __field(unsigned long, targfreq ) + __field(unsigned long, actualfreq ) + ), + + TP_fast_assign( + __entry->cpu_id = (u32) cpu_id; + __entry->targfreq = targfreq; + __entry->actualfreq = actualfreq; + ), + + TP_printk("cpu=%u targ=%lu actual=%lu", + __entry->cpu_id, __entry->targfreq, + __entry->actualfreq) +); + +DEFINE_EVENT(set, cpufreq_interactive_up, + TP_PROTO(u32 cpu_id, unsigned long targfreq, + unsigned long actualfreq), + TP_ARGS(cpu_id, targfreq, actualfreq) +); + +DEFINE_EVENT(set, cpufreq_interactive_down, + TP_PROTO(u32 cpu_id, unsigned long targfreq, + unsigned long actualfreq), + TP_ARGS(cpu_id, targfreq, actualfreq) +); + +DECLARE_EVENT_CLASS(loadeval, + TP_PROTO(unsigned long cpu_id, unsigned long load, + unsigned long curfreq, unsigned long targfreq), + TP_ARGS(cpu_id, load, curfreq, targfreq), + + TP_STRUCT__entry( + __field(unsigned long, cpu_id ) + __field(unsigned long, load ) + __field(unsigned long, curfreq ) + __field(unsigned long, targfreq ) + ), + + TP_fast_assign( + __entry->cpu_id = cpu_id; + __entry->load = load; + __entry->curfreq = curfreq; + __entry->targfreq = targfreq; + ), + + TP_printk("cpu=%lu load=%lu cur=%lu targ=%lu", + __entry->cpu_id, __entry->load, __entry->curfreq, + __entry->targfreq) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_target, + TP_PROTO(unsigned long cpu_id, unsigned long load, + unsigned long curfreq, unsigned long targfreq), + TP_ARGS(cpu_id, load, curfreq, targfreq) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_already, + TP_PROTO(unsigned long cpu_id, unsigned long load, + unsigned long curfreq, unsigned long targfreq), + TP_ARGS(cpu_id, load, curfreq, targfreq) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_notyet, + TP_PROTO(unsigned long cpu_id, unsigned long load, + unsigned long curfreq, unsigned long targfreq), + TP_ARGS(cpu_id, load, curfreq, targfreq) +); + +TRACE_EVENT(cpufreq_interactive_boost, + TP_PROTO(const char *s), + TP_ARGS(s), + TP_STRUCT__entry( + __string(s, s) + ), + TP_fast_assign( + __assign_str(s, s); + ), + TP_printk("%s", __get_str(s)) +); + +TRACE_EVENT(cpufreq_interactive_unboost, + TP_PROTO(const char *s), + TP_ARGS(s), + TP_STRUCT__entry( + __string(s, s) + ), + TP_fast_assign( + __assign_str(s, s); + ), + TP_printk("%s", __get_str(s)) +); + +#endif /* _TRACE_CPUFREQ_INTERACTIVE_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> |