diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/cpu_pm.h | 109 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 12 | ||||
-rw-r--r-- | include/linux/fb.h | 9 | ||||
-rw-r--r-- | include/linux/hsi_char.h | 71 | ||||
-rw-r--r-- | include/linux/hsi_driver_if.h | 181 | ||||
-rw-r--r-- | include/linux/i2c-omap.h | 2 | ||||
-rw-r--r-- | include/linux/i2c.h | 7 | ||||
-rw-r--r-- | include/linux/i2c/twl.h | 72 | ||||
-rw-r--r-- | include/linux/i2c/twl6030-madc.h | 86 | ||||
-rw-r--r-- | include/linux/mfd/twl6040-codec.h | 269 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 10 | ||||
-rw-r--r-- | include/linux/omap_ion.h | 88 | ||||
-rw-r--r-- | include/linux/omap_v4l2_gfx.h | 177 | ||||
-rw-r--r-- | include/linux/omapfb.h | 11 | ||||
-rw-r--r-- | include/linux/opp.h | 8 | ||||
-rw-r--r-- | include/linux/remoteproc.h | 311 | ||||
-rw-r--r-- | include/linux/rpmsg.h | 191 | ||||
-rw-r--r-- | include/linux/rpmsg_omx.h | 144 | ||||
-rw-r--r-- | include/linux/rpmsg_resmgr.h | 131 | ||||
-rw-r--r-- | include/linux/virtio_ids.h | 1 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 2 |
21 files changed, 1888 insertions, 4 deletions
diff --git a/include/linux/cpu_pm.h b/include/linux/cpu_pm.h new file mode 100644 index 0000000..455b233 --- /dev/null +++ b/include/linux/cpu_pm.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011 Google, Inc. + * + * Author: + * Colin Cross <ccross@android.com> + * + * 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_CPU_PM_H +#define _LINUX_CPU_PM_H + +#include <linux/kernel.h> +#include <linux/notifier.h> + +/* + * When a CPU goes to a low power state that turns off power to the CPU's + * power domain, the contents of some blocks (floating point coprocessors, + * interrupt controllers, caches, timers) in the same power domain can + * be lost. The cpm_pm notifiers provide a method for platform idle, suspend, + * and hotplug implementations to notify the drivers for these blocks that + * they may be reset. + * + * All cpu_pm notifications must be called with interrupts disabled. + * + * The notifications are split into two classes: CPU notifications and CPU + * cluster notifications. + * + * CPU notifications apply to a single CPU and must be called on the affected + * CPU. They are used to save per-cpu context for affected blocks. + * + * CPU cluster notifications apply to all CPUs in a single power domain. They + * are used to save any global context for affected blocks, and must be called + * after all the CPUs in the power domain have been notified of the low power + * state. + */ + +/* + * Event codes passed as unsigned long val to notifier calls + */ +enum cpu_pm_event { + /* A single cpu is entering a low power state */ + CPU_PM_ENTER, + + /* A single cpu failed to enter a low power state */ + CPU_PM_ENTER_FAILED, + + /* A single cpu is exiting a low power state */ + CPU_PM_EXIT, + + /* A cpu power domain is entering a low power state */ + CPU_CLUSTER_PM_ENTER, + + /* A cpu power domain failed to enter a low power state */ + CPU_CLUSTER_PM_ENTER_FAILED, + + /* A cpu power domain is exiting a low power state */ + CPU_CLUSTER_PM_EXIT, +}; + +#ifdef CONFIG_CPU_PM +int cpu_pm_register_notifier(struct notifier_block *nb); +int cpu_pm_unregister_notifier(struct notifier_block *nb); +int cpu_pm_enter(void); +int cpu_pm_exit(void); +int cpu_cluster_pm_enter(void); +int cpu_cluster_pm_exit(void); + +#else + +static inline int cpu_pm_register_notifier(struct notifier_block *nb) +{ + return 0; +} + +static inline int cpu_pm_unregister_notifier(struct notifier_block *nb) +{ + return 0; +} + +static inline int cpu_pm_enter(void) +{ + return 0; +} + +static inline int cpu_pm_exit(void) +{ + return 0; +} + +static inline int cpu_cluster_pm_enter(void) +{ + return 0; +} + +static inline int cpu_cluster_pm_exit(void) +{ + return 0; +} +#endif +#endif diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ae06dc9..905ea72 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -361,6 +361,9 @@ extern struct cpufreq_governor cpufreq_gov_conservative; #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE) extern struct cpufreq_governor cpufreq_gov_interactive; #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_interactive) +#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_HOTPLUG) +extern struct cpufreq_governor cpufreq_gov_hotplug; +#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_hotplug) #endif @@ -402,5 +405,14 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, void cpufreq_frequency_table_put_attr(unsigned int cpu); +/* the following are for use in governors, or anywhere else */ +extern int cpufreq_frequency_table_next_lowest(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table, + int *index); + +extern int cpufreq_frequency_table_next_highest(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table, + int *index); + #endif /* _LINUX_CPUFREQ_H */ diff --git a/include/linux/fb.h b/include/linux/fb.h index f9d013d..e8cc747 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -226,6 +226,10 @@ struct fb_bitfield { #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ +#define FB_FLAG_RATIO_4_3 64 +#define FB_FLAG_RATIO_16_9 128 +#define FB_FLAG_PIXEL_REPEAT 256 + /* * Display rotation support */ @@ -439,6 +443,8 @@ struct file; #define FB_MISC_PRIM_COLOR 1 #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ +#define FB_MISC_HDMI 4 /* display supports HDMI signaling */ + struct fb_chroma { __u32 redx; /* in fraction of 1024 */ __u32 greenx; @@ -1104,6 +1110,7 @@ extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); /* drivers/video/modedb.c */ #define VESA_MODEDB_SIZE 34 +#define CEA_MODEDB_SIZE 65 extern void fb_var_to_videomode(struct fb_videomode *mode, const struct fb_var_screeninfo *var); extern void fb_videomode_to_var(struct fb_var_screeninfo *var, @@ -1156,7 +1163,7 @@ struct fb_videomode { extern const char *fb_mode_option; extern const struct fb_videomode vesa_modes[]; -extern const struct fb_videomode cea_modes[64]; +extern const struct fb_videomode cea_modes[]; struct fb_modelist { struct list_head list; diff --git a/include/linux/hsi_char.h b/include/linux/hsi_char.h new file mode 100644 index 0000000..cfa6580 --- /dev/null +++ b/include/linux/hsi_char.h @@ -0,0 +1,71 @@ +/* + * hsi_char.h + * + * HSI character driver public declaration header file. + * + * Copyright (C) 2009 Nokia Corporation. All rights reserved. + * Copyright (C) 2009 Texas Instruments, Inc. + * + * Author: Andras Domokos <andras.domokos@nokia.com> + * Author: Sebastien JAN <s-jan@ti.com> + * + * This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef HSI_CHAR_H +#define HSI_CHAR_H + +#define HSI_CHAR_BASE 'S' +#define CS_IOW(num, dtype) _IOW(HSI_CHAR_BASE, num, dtype) +#define CS_IOR(num, dtype) _IOR(HSI_CHAR_BASE, num, dtype) +#define CS_IOWR(num, dtype) _IOWR(HSI_CHAR_BASE, num, dtype) +#define CS_IO(num) _IO(HSI_CHAR_BASE, num) + +#define CS_SEND_BREAK CS_IO(1) +#define CS_FLUSH_RX CS_IO(2) +#define CS_FLUSH_TX CS_IO(3) +#define CS_BOOTSTRAP CS_IO(4) +#define CS_SET_ACWAKELINE CS_IOW(5, unsigned int) +#define CS_GET_ACWAKELINE CS_IOR(6, unsigned int) +#define CS_SET_RX CS_IOW(7, struct hsi_rx_config) +#define CS_GET_RX CS_IOW(8, struct hsi_rx_config) +#define CS_SET_TX CS_IOW(9, struct hsi_tx_config) +#define CS_GET_TX CS_IOW(10, struct hsi_tx_config) +#define CS_SW_RESET CS_IO(11) +#define CS_GET_FIFO_OCCUPANCY CS_IOR(12, size_t) + +#define HSI_MODE_SLEEP 0 +#define HSI_MODE_STREAM 1 +#define HSI_MODE_FRAME 2 + +#define HSI_ARBMODE_RR 0 +#define HSI_ARBMODE_PRIO 1 + +#define WAKE_UP 1 +#define WAKE_DOWN 0 + +struct hsi_tx_config { + __u32 mode; + __u32 flow; + __u32 frame_size; + __u32 channels; + __u32 divisor; + __u32 arb_mode; +}; + +struct hsi_rx_config { + __u32 mode; + __u32 flow; + __u32 frame_size; + __u32 channels; + __u32 divisor; /* not used for SSI */ + __u32 counters; +}; + +#endif /* HSI_CHAR_H */ diff --git a/include/linux/hsi_driver_if.h b/include/linux/hsi_driver_if.h new file mode 100644 index 0000000..547b30e --- /dev/null +++ b/include/linux/hsi_driver_if.h @@ -0,0 +1,181 @@ +/* + * hsi_driver_if.h + * + * Header for the HSI driver low level interface. + * + * Copyright (C) 2007-2008 Nokia Corporation. All rights reserved. + * Copyright (C) 2009 Texas Instruments, Inc. + * + * Author: Carlos Chinea <carlos.chinea@nokia.com> + * Author: Sebastien JAN <s-jan@ti.com> + * + * This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef __HSI_DRIVER_IF_H__ +#define __HSI_DRIVER_IF_H__ + +#include <linux/platform_device.h> +#include <linux/device.h> +#include <linux/clk.h> +#include <linux/notifier.h> + +/* The number of ports handled by the driver (MAX:2). Reducing this value + * optimizes the driver memory footprint. + */ +#define HSI_MAX_PORTS 1 + +/* bit-field definition for allowed controller IDs and channels */ +#define ANY_HSI_CONTROLLER -1 + +/* HSR special divisor values set to control the auto-divisor Rx mode */ +#define HSI_HSR_DIVISOR_AUTO 0x1000 /* Activate auto Rx */ +#define HSI_SSR_DIVISOR_USE_TIMEOUT 0x1001 /* De-activate auto-Rx (SSI) */ + +enum { + HSI_EVENT_BREAK_DETECTED = 0, + HSI_EVENT_ERROR, + HSI_EVENT_PRE_SPEED_CHANGE, + HSI_EVENT_POST_SPEED_CHANGE, + HSI_EVENT_CAWAKE_UP, + HSI_EVENT_CAWAKE_DOWN, + HSI_EVENT_HSR_DATAAVAILABLE, +}; + +enum { + HSI_IOCTL_ACWAKE_DOWN = 0, /* Unset HST ACWAKE line for channel */ + HSI_IOCTL_ACWAKE_UP, /* Set HSI wakeup line (acwake) for channel */ + HSI_IOCTL_SEND_BREAK, /* Send a HW BREAK frame in FRAME mode */ + HSI_IOCTL_GET_ACWAKE, /* Get HST CAWAKE line status */ + HSI_IOCTL_FLUSH_RX, /* Force the HSR to idle state */ + HSI_IOCTL_FLUSH_TX, /* Force the HST to idle state */ + HSI_IOCTL_GET_CAWAKE, /* Get CAWAKE (HSR) line status */ + HSI_IOCTL_SET_RX, /* Set HSR configuration */ + HSI_IOCTL_GET_RX, /* Get HSR configuration */ + HSI_IOCTL_SET_TX, /* Set HST configuration */ + HSI_IOCTL_GET_TX, /* Get HST configuration */ + HSI_IOCTL_SW_RESET, /* Force a HSI SW RESET */ + HSI_IOCTL_GET_FIFO_OCCUPANCY, /* Get amount of words in RX FIFO */ + HSI_IOCTL_SET_ACREADY_SAFEMODE, + HSI_IOCTL_SET_ACREADY_NORMAL, + HSI_IOCTL_SET_3WIRE_MODE, + HSI_IOCTL_SET_4WIRE_MODE, +}; + +/* Forward references */ +struct hsi_device; +struct hsi_channel; + +/* DPS */ +struct hst_ctx { + u32 mode; + u32 flow; + u32 frame_size; + u32 divisor; + u32 arb_mode; + u32 channels; +}; + +struct hsr_ctx { + u32 mode; + u32 flow; + u32 frame_size; + u32 divisor; + u32 counters; + u32 channels; +}; + +struct port_ctx { + u32 sys_mpu_enable[2]; + struct hst_ctx hst; + struct hsr_ctx hsr; +}; + +/** + * struct ctrl_ctx - hsi controller regs context + * @sysconfig: keeps HSI_SYSCONFIG reg state + * @gdd_gcr: keeps DMA_GCR reg state + * @dll: keeps HSR_DLL state + * @pctx: array of port context + */ +struct ctrl_ctx { + u32 sysconfig; + u32 gdd_gcr; + u32 dll; + struct port_ctx *pctx; +}; +/* END DPS */ + + +/** + * struct hsi_device - HSI device object (Virtual) + * @n_ctrl: associated HSI controller platform id number + * @n_p: port number + * @n_ch: channel number + * @ch: channel descriptor + * @device: associated device +*/ +struct hsi_device { + int n_ctrl; + unsigned int n_p; + unsigned int n_ch; + struct hsi_channel *ch; + struct device device; +}; + +#define to_hsi_device(dev) container_of(dev, struct hsi_device, device) + +/** + * struct hsi_device_driver - HSI driver instance container + * @ctrl_mask: bit-field indicating the supported HSI device ids + * @ch_mask: bit-field indicating enabled channels for this port + * @probe: probe callback (driver registering) + * @remove: remove callback (driver un-registering) + * @suspend: suspend callback + * @resume: resume callback + * @driver: associated device_driver object +*/ +struct hsi_device_driver { + unsigned long ctrl_mask; + unsigned long ch_mask[HSI_MAX_PORTS]; + int (*probe) (struct hsi_device *dev); + int (*remove) (struct hsi_device *dev); + int (*suspend) (struct hsi_device *dev, pm_message_t mesg); + int (*resume) (struct hsi_device *dev); + struct device_driver driver; + void *priv_data; + +}; + +#define to_hsi_device_driver(drv) container_of(drv, \ + struct hsi_device_driver, \ + driver) + +int hsi_register_driver(struct hsi_device_driver *driver); +void hsi_unregister_driver(struct hsi_device_driver *driver); +int hsi_open(struct hsi_device *dev); +int hsi_write(struct hsi_device *dev, u32 * addr, unsigned int size); +int hsi_write_cancel(struct hsi_device *dev); +int hsi_read(struct hsi_device *dev, u32 * addr, unsigned int size); +int hsi_read_cancel(struct hsi_device *dev); +int hsi_poll(struct hsi_device *dev); +int hsi_unpoll(struct hsi_device *dev); +int hsi_ioctl(struct hsi_device *dev, unsigned int command, void *arg); +void hsi_close(struct hsi_device *dev); +void hsi_set_read_cb(struct hsi_device *dev, + void (*read_cb) (struct hsi_device *dev, + unsigned int size)); +void hsi_set_write_cb(struct hsi_device *dev, + void (*write_cb) (struct hsi_device *dev, + unsigned int size)); +void hsi_set_port_event_cb(struct hsi_device *dev, + void (*port_event_cb) (struct hsi_device *dev, + unsigned int event, + void *arg)); +#endif /* __HSI_DRIVER_IF_H__ */ diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h index 7472449..3beb390 100644 --- a/include/linux/i2c-omap.h +++ b/include/linux/i2c-omap.h @@ -5,7 +5,7 @@ struct omap_i2c_bus_platform_data { u32 clkrate; - void (*set_mpu_wkup_lat)(struct device *dev, long set); + bool needs_wakeup_latency; int (*device_enable) (struct platform_device *pdev); int (*device_shutdown) (struct platform_device *pdev); int (*device_idle) (struct platform_device *pdev); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a6c652e..fd8fcf0 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -208,6 +208,7 @@ struct i2c_client { struct i2c_driver *driver; /* and our access routines */ struct device dev; /* the device structure */ int irq; /* irq issued by device */ + bool ext_master; /* determine if the dev has a master outside mpu */ struct list_head detected; }; #define to_i2c_client(d) container_of(d, struct i2c_client, dev) @@ -239,6 +240,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) * @archdata: copied into i2c_client.dev.archdata * @of_node: pointer to OpenFirmware device node * @irq: stored in i2c_client.irq + * @ext_master: determine if the dev has a master outside mpu * * I2C doesn't actually support hardware probing, although controllers and * devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's @@ -259,6 +261,7 @@ struct i2c_board_info { struct dev_archdata *archdata; struct device_node *of_node; int irq; + bool ext_master; }; /** @@ -370,6 +373,9 @@ struct i2c_adapter { struct mutex userspace_clients_lock; struct list_head userspace_clients; + + struct mutex ext_clients_lock; /* Lock for external clients list */ + struct list_head ext_clients; /* Clients with master from external proc */ }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) @@ -429,6 +435,7 @@ void i2c_unlock_adapter(struct i2c_adapter *); #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) extern int i2c_add_adapter(struct i2c_adapter *); extern int i2c_del_adapter(struct i2c_adapter *); +extern void i2c_detect_ext_master(struct i2c_adapter *); extern int i2c_add_numbered_adapter(struct i2c_adapter *); extern int i2c_register_driver(struct module *, struct i2c_driver *); diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index ba4f886..3c6e9a0 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -71,6 +71,7 @@ #define TWL4030_MODULE_PM_RECEIVER 0x15 #define TWL4030_MODULE_RTC 0x16 #define TWL4030_MODULE_SECURED_REG 0x17 +#define TWL6030_MODULE_SLAVE_RES 0x19 #define TWL_MODULE_USB TWL4030_MODULE_USB #define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE @@ -81,6 +82,7 @@ #define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER #define TWL_MODULE_RTC TWL4030_MODULE_RTC #define TWL_MODULE_PWM TWL4030_MODULE_PWM0 +#define TWL_MODULE_PM_SLAVE_RES TWL6030_MODULE_SLAVE_RES #define TWL6030_MODULE_ID0 0x0D #define TWL6030_MODULE_ID1 0x0E @@ -100,6 +102,7 @@ * Offset from TWL6030_IRQ_BASE / pdata->irq_base */ #define PWR_INTR_OFFSET 0 +#define TWL_VLOW_INTR_OFFSET 6 #define HOTDIE_INTR_OFFSET 12 #define SMPSLDO_INTR_OFFSET 13 #define BATDETECT_INTR_OFFSET 14 @@ -151,6 +154,8 @@ #define MMC_PU (0x1 << 3) #define MMC_PD (0x1 << 2) +#define VLOW_INT_MASK (0x1 << 2) + #define TWL_SIL_TYPE(rev) ((rev) & 0x00FFFFFF) #define TWL_SIL_REV(rev) ((rev) >> 24) #define TWL_SIL_5030 0x09002F @@ -450,6 +455,16 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot) #define TWL4030_PM_MASTER_GLOBAL_TST 0xb6 +#define TWL6030_PHOENIX_DEV_ON 0x06 + +/* + * PM Slave resource module register offsets (use TWL6030_MODULE_SLAVE_RES) + */ + +#define REG_VBATMIN_HI_CFG_STATE 0x1D + +#define VBATMIN_VLOW_EN 0x21 + /*----------------------------------------------------------------------*/ /* Power bus message definitions */ @@ -522,6 +537,26 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot) #define RES_MAIN_REF 28 #define TOTAL_RESOURCES 28 +/* 6030 extra resources */ +#define RES_V1V29 29 +#define RES_V1V8 30 +#define RES_V2V1 31 +#define RES_VDD3 32 +#define RES_VMEM 33 +#define RES_VANA 34 +#define RES_VUAX1 35 +#define RES_VCXIO 36 +#define RES_VPP 37 +#define RES_VRTC 38 +#define RES_REGEN2 39 +#define RES_32KCLKAO 40 +#define RES_32KCLKG 41 +#define RES_32KCLKAUDIO 42 +#define RES_BIAS 43 +#define RES_VBATMIN_HI 44 +#define RES_RC6MHZ 45 +#define RES_TEMP 46 + /* * Power Bus Message Format ... these can be sent individually by Linux, * but are usually part of downloaded scripts that are run when various @@ -641,21 +676,39 @@ struct twl4030_script { struct twl4030_resconfig { u8 resource; u8 devgroup; /* Processor group that Power resource belongs to */ + /* The following are used by TWL4030 only */ u8 type; /* Power resource addressed, 6 / broadcast message */ u8 type2; /* Power resource addressed, 3 / broadcast message */ u8 remap_off; /* off state remapping */ u8 remap_sleep; /* sleep state remapping */ }; +struct twl4030_system_config { + char *name; + u8 group; +}; + struct twl4030_power_data { - struct twl4030_script **scripts; - unsigned num; + struct twl4030_script **scripts; /* used in TWL4030 only */ + unsigned num; /* used in TWL4030 only */ struct twl4030_resconfig *resource_config; + struct twl4030_system_config *sys_config; /*system resources*/ #define TWL4030_RESCONFIG_UNDEF ((u8)-1) }; +#ifdef CONFIG_TWL4030_POWER extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); extern int twl4030_remove_script(u8 flags); +#else +static inline void twl4030_power_init(struct twl4030_power_data *triton2_scripts) { } +static inline int twl4030_remove_script(u8 flags) { return -EINVAL; } +#endif + +#ifdef CONFIG_TWL6030_POWER +extern void twl6030_power_init(struct twl4030_power_data *power_data); +#else +extern inline void twl6030_power_init(struct twl4030_power_data *power_data) { } +#endif struct twl4030_codec_audio_data { unsigned int digimic_delay; /* in ms */ @@ -664,6 +717,11 @@ struct twl4030_codec_audio_data { unsigned int check_defaults:1; unsigned int reset_registers:1; unsigned int hs_extmute:1; + u16 hs_left_step; + u16 hs_right_step; + u16 hf_left_step; + u16 hf_right_step; + u16 ep_step; void (*set_hs_extmute)(int mute); }; @@ -679,6 +737,10 @@ struct twl4030_codec_data { /* twl6040 */ int audpwron_gpio; /* audio power-on gpio */ int naudint_irq; /* audio interrupt */ + unsigned int irq_base; + int (*get_ext_clk32k)(void); + void (*put_ext_clk32k)(void); + int (*set_ext_clk32k)(bool on); }; struct twl4030_platform_data { @@ -710,6 +772,10 @@ struct twl4030_platform_data { struct regulator_init_data *vintana1; struct regulator_init_data *vintana2; struct regulator_init_data *vintdig; + /* TWL6030 DCDC regulators */ + struct regulator_init_data *vdd3; + struct regulator_init_data *vmem; + struct regulator_init_data *v2v1; /* TWL6030 LDO regulators */ struct regulator_init_data *vmmc; struct regulator_init_data *vpp; @@ -718,6 +784,7 @@ struct twl4030_platform_data { struct regulator_init_data *vcxio; struct regulator_init_data *vusb; struct regulator_init_data *clk32kg; + struct regulator_init_data *clk32kaudio; /* TWL6025 LDO regulators */ struct regulator_init_data *ldo1; struct regulator_init_data *ldo2; @@ -829,5 +896,6 @@ static inline int twl4030charger_usb_en(int enable) { return 0; } #define TWL6025_REG_SMPS4 59 #define TWL6025_REG_VIO 60 +#define TWL6030_REG_CLK32KAUDIO 61 #endif /* End of __TWL4030_H */ diff --git a/include/linux/i2c/twl6030-madc.h b/include/linux/i2c/twl6030-madc.h new file mode 100644 index 0000000..81b9464 --- /dev/null +++ b/include/linux/i2c/twl6030-madc.h @@ -0,0 +1,86 @@ +/* + * twl6030_madc.h - Header for TWL6030 MADC + * + * Copyright (C) 2011 Samsung Telecommunications of America + * + * Based on twl4030-madc.h + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * J Keerthy <j-keerthy@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. + * + * 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 _TWL6030_MADC_H +#define _TWL6030_MADC_H + +#define TWL6030_MADC_MAX_CHANNELS 17 +/* + * twl6030 madc occupies the same offset in the twl6030 map that + * twl4030 madc does in the twl4030 map. + * likewise the charger + */ +#define TWL6030_MODULE_MADC TWL4030_MODULE_MADC +#define TWL6030_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE + +#define TWL6030_MADC_CTRL 0x00 +#define TWL6030_MADC_TEMP1_EN (1 << 0) +#define TWL6030_MADC_TEMP2_EN (1 << 1) +#define TWL6030_MADC_SCALER_EN_CH2 (1 << 2) +#define TWL6030_MADC_VBAT_SCALER_DIV (1 << 3) +#define TWL6030_MADC_SCALER_EN_CH11 (1 << 4) +#define TWL6030_MADC_TMP1_EN_MONITOR (1 << 5) +#define TWL6030_MADC_TMP2_EN_MONITOR (1 << 6) +#define TWL6030_MADC_ISOURCE_EN (1 << 7) + +#define TWL6030_MADC_RTSELECT_LSB 0x02 +#define TWL6030_MADC_ADCIN0 (1 << 0) +#define TWL6030_MADC_ADCIN1 (1 << 1) +#define TWL6030_MADC_ADCIN2 (1 << 2) +#define TWL6030_MADC_ADCIN3 (1 << 3) +#define TWL6030_MADC_ADCIN4 (1 << 4) +#define TWL6030_MADC_ADCIN5 (1 << 5) +#define TWL6030_MADC_ADCIN6 (1 << 6) +#define TWL6030_MADC_ADCIN7 (1 << 7) + +#define TWL6030_MADC_RTSELECT_ISB 0x03 +#define TWL6030_MADC_ADCIN8 (1 << 0) +#define TWL6030_MADC_ADCIN9 (1 << 1) +#define TWL6030_MADC_ADCIN10 (1 << 2) +#define TWL6030_MADC_ADCIN11 (1 << 3) +#define TWL6030_MADC_ADCIN12 (1 << 4) +#define TWL6030_MADC_ADCIN13 (1 << 5) +#define TWL6030_MADC_ADCIN14 (1 << 6) +#define TWL6030_MADC_ADCIN15 (1 << 7) + +#define TWL6030_MADC_RTSELECT_MSB 0x04 +#define TWL6030_MADC_ADCIN16 (1 << 0) + +#define TWL6030_MADC_CTRL_P1 0x05 +#define TWL6030_MADC_BUSY (1 << 0) +#define TWL6030_MADC_EOCP1 (1 << 1) +#define TWL6030_MADC_EOCRT (1 << 2) +#define TWL6030_MADC_SP1 (1 << 3) + +#define TWL6030_MADC_CTRL_P2 0x06 +#define TWL6030_MADC_BUSYB (1 << 0) +#define TWL6030_MADC_EOCP2 (1 << 1) +#define TWL6030_MADC_SP2 (1 << 2) + +#define TWL6030_MADC_RTCH0_LSB 0x07 +#define TWL6030_MADC_GPCH0_LSB 0x29 + +int twl6030_get_madc_conversion(int channel_no); +#endif diff --git a/include/linux/mfd/twl6040-codec.h b/include/linux/mfd/twl6040-codec.h new file mode 100644 index 0000000..13ac335 --- /dev/null +++ b/include/linux/mfd/twl6040-codec.h @@ -0,0 +1,269 @@ +/* + * MFD driver for twl6040 codec submodule + * + * Authors: Jorge Eduardo Candelaria <jorge.candelaria@ti.com> + * Misael Lopez Cruz <misael.lopez@ti.com> + * + * Copyright: (C) 2011 Texas Instruments, Inc. + * + * 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 __TWL6040_CODEC_H__ +#define __TWL6040_CODEC_H__ + +#include <linux/interrupt.h> +#include <linux/mfd/core.h> + +#define TWL6040_NO_SUPPLY 0 +#define TWL6040_VIO_SUPPLY 1 +#define TWL6040_VDD_SUPPLY 2 + + +#define TWL6040_REG_ASICID 0x01 +#define TWL6040_REG_ASICREV 0x02 +#define TWL6040_REG_INTID 0x03 +#define TWL6040_REG_INTMR 0x04 +#define TWL6040_REG_NCPCTL 0x05 +#define TWL6040_REG_LDOCTL 0x06 +#define TWL6040_REG_HPPLLCTL 0x07 +#define TWL6040_REG_LPPLLCTL 0x08 +#define TWL6040_REG_LPPLLDIV 0x09 +#define TWL6040_REG_AMICBCTL 0x0A +#define TWL6040_REG_DMICBCTL 0x0B +#define TWL6040_REG_MICLCTL 0x0C +#define TWL6040_REG_MICRCTL 0x0D +#define TWL6040_REG_MICGAIN 0x0E +#define TWL6040_REG_LINEGAIN 0x0F +#define TWL6040_REG_HSLCTL 0x10 +#define TWL6040_REG_HSRCTL 0x11 +#define TWL6040_REG_HSGAIN 0x12 +#define TWL6040_REG_EARCTL 0x13 +#define TWL6040_REG_HFLCTL 0x14 +#define TWL6040_REG_HFLGAIN 0x15 +#define TWL6040_REG_HFRCTL 0x16 +#define TWL6040_REG_HFRGAIN 0x17 +#define TWL6040_REG_VIBCTLL 0x18 +#define TWL6040_REG_VIBDATL 0x19 +#define TWL6040_REG_VIBCTLR 0x1A +#define TWL6040_REG_VIBDATR 0x1B +#define TWL6040_REG_HKCTL1 0x1C +#define TWL6040_REG_HKCTL2 0x1D +#define TWL6040_REG_GPOCTL 0x1E +#define TWL6040_REG_ALB 0x1F +#define TWL6040_REG_DLB 0x20 +#define TWL6040_REG_TRIM1 0x28 +#define TWL6040_REG_TRIM2 0x29 +#define TWL6040_REG_TRIM3 0x2A +#define TWL6040_REG_HSOTRIM 0x2B +#define TWL6040_REG_HFOTRIM 0x2C +#define TWL6040_REG_ACCCTL 0x2D +#define TWL6040_REG_STATUS 0x2E + +#define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1) + +#define TWL6040_VIOREGNUM 18 +#define TWL6040_VDDREGNUM 21 + +/* ASICREV (0x02) values */ + +#define TWL6040_REV_1_0 0x00 +#define TWL6040_REV_1_1 0x01 +#define TWL6040_REV_1_3 0x02 + +/* INTID (0x03) fields */ + +#define TWL6040_THINT 0x01 +#define TWL6040_PLUGINT 0x02 +#define TWL6040_UNPLUGINT 0x04 +#define TWL6040_HOOKINT 0x08 +#define TWL6040_HFINT 0x10 +#define TWL6040_VIBINT 0x20 +#define TWL6040_READYINT 0x40 + +/* INTMR (0x04) fields */ + +#define TWL6040_THMSK 0x01 +#define TWL6040_PLUGMSK 0x02 +#define TWL6040_HOOKMSK 0x08 +#define TWL6040_HFMSK 0x10 +#define TWL6040_VIBMSK 0x20 +#define TWL6040_READYMSK 0x40 +#define TWL6040_ALLINT_MSK 0x7B + +/* NCPCTL (0x05) fields */ + +#define TWL6040_NCPENA 0x01 +#define TWL6040_NCPOPEN 0x40 +#define TWL6040_TSHUTENA 0x80 + +/* LDOCTL (0x06) fields */ + +#define TWL6040_LSLDOENA 0x01 +#define TWL6040_HSLDOENA 0x04 +#define TWL6040_REFENA 0x40 +#define TWL6040_OSCENA 0x80 + +/* HPPLLCTL (0x07) fields */ + +#define TWL6040_HPLLENA 0x01 +#define TWL6040_HPLLRST 0x02 +#define TWL6040_HPLLBP 0x04 +#define TWL6040_HPLLSQRENA 0x08 +#define TWL6040_HPLLSQRBP 0x10 +#define TWL6040_MCLK_12000KHZ (0 << 5) +#define TWL6040_MCLK_19200KHZ (1 << 5) +#define TWL6040_MCLK_26000KHZ (2 << 5) +#define TWL6040_MCLK_38400KHZ (3 << 5) +#define TWL6040_MCLK_MSK 0x60 + +/* LPPLLCTL (0x08) fields */ + +#define TWL6040_LPLLENA 0x01 +#define TWL6040_LPLLRST 0x02 +#define TWL6040_LPLLSEL 0x04 +#define TWL6040_LPLLFIN 0x08 +#define TWL6040_HPLLSEL 0x10 + +/* HSLCTL (0x10) fields */ + +#define TWL6040_HSDACMODEL 0x02 +#define TWL6040_HSDRVMODEL 0x08 + +/* HSRCTL (0x11) fields */ + +#define TWL6040_HSDACMODER 0x02 +#define TWL6040_HSDRVMODER 0x08 + +/* VIBCTLL (0x18) fields */ + +#define TWL6040_VIBCTRLLN 0x10 +#define TWL6040_VIBCTRLLP 0x04 +#define TWL6040_VIBENAL 0x01 + +/* VIBCTLL (0x19) fields */ + +#define TWL6040_VIBCTRLRN 0x10 +#define TWL6040_VIBCTRLRP 0x04 +#define TWL6040_VIBENAR 0x01 + +/* GPOCTL (0x1E) fields */ + +#define TWL6040_GPO1 0x01 +#define TWL6040_GPO2 0x02 +#define TWL6040_GPO3 0x03 + +/* HSOTRIM (0x2B) fields */ + +#define TWL6040_HSLO 0x0F +#define TWL6040_HSRO 0xF0 +#define TWL6040_HSLO_OFFSET 0 +#define TWL6040_HSRO_OFFSET 4 + +/* HFOTRIM (0x2C) fields */ + +#define TWL6040_HFLO 0x0F +#define TWL6040_HFRO 0xF0 +#define TWL6040_HFLO_OFFSET 0 +#define TWL6040_HFRO_OFFSET 4 + +/* ACCCTL (0x2D) fields */ + +#define TWL6040_I2CSEL 0x01 +#define TWL6040_RESETSPLIT 0x04 +#define TWL6040_INTCLRMODE 0x08 +#define TWL6040_CLK32KSEL 0x40 + +/* STATUS (0x2E) fields */ + +#define TWL6040_PLUGCOMP 0x02 + +#define TWL6040_CELLS 2 + +#define TWL6040_IRQ_TH 0 +#define TWL6040_IRQ_PLUG 1 +#define TWL6040_IRQ_HOOK 2 +#define TWL6040_IRQ_HF 3 +#define TWL6040_IRQ_VIB 4 +#define TWL6040_IRQ_READY 5 + +enum twl6040_pll_id { + TWL6040_NOPLL_ID, + TWL6040_LPPLL_ID, + TWL6040_HPPLL_ID, +}; + +struct twl6040 { + struct device *dev; + struct mutex mutex; + struct mutex io_mutex; + struct mutex irq_mutex; + struct mfd_cell cells[TWL6040_CELLS]; + struct completion ready; + + int audpwron; + int powered; + int power_count; + + enum twl6040_pll_id pll; + unsigned int sysclk; + int icrev; + + unsigned int irq; + unsigned int irq_base; + u8 irq_masks_cur; + u8 irq_masks_cache; +}; + +static inline int twl6040_request_irq(struct twl6040 *twl6040, int irq, + irq_handler_t handler, const char *name, + void *data) +{ + if (!twl6040->irq_base) + return -EINVAL; + + return request_threaded_irq(twl6040->irq_base + irq, NULL, handler, + 0, name, data); +} + +static inline void twl6040_free_irq(struct twl6040 *twl6040, int irq, + void *data) +{ + if (!twl6040->irq_base) + return; + + free_irq(twl6040->irq_base + irq, data); +} + +int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg); +int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, + u8 val); +int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, + u8 mask); +int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, + u8 mask); +int twl6040_enable(struct twl6040 *twl6040); +int twl6040_disable(struct twl6040 *twl6040); +int twl6040_is_enabled(struct twl6040 *twl6040); +int twl6040_set_pll(struct twl6040 *twl6040, enum twl6040_pll_id id, + unsigned int freq_in, unsigned int freq_out); +enum twl6040_pll_id twl6040_get_pll(struct twl6040 *twl6040); +unsigned int twl6040_get_sysclk(struct twl6040 *twl6040); +int twl6040_get_icrev(struct twl6040 *twl6040); +int twl6040_irq_init(struct twl6040 *twl6040); +void twl6040_irq_exit(struct twl6040 *twl6040); + +#endif /* End of __TWL6040_CODEC_H__ */ diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index ae28e93..561567e 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -533,4 +533,14 @@ struct isapnp_device_id { kernel_ulong_t driver_data; /* data private to the driver */ }; +/* rpmsg */ + +#define RPMSG_NAME_SIZE 32 +#define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s" + +struct rpmsg_device_id { + char name[RPMSG_NAME_SIZE]; + kernel_ulong_t driver_data /* Data private to the driver */ + __attribute__((aligned(sizeof(kernel_ulong_t)))); +}; #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/omap_ion.h b/include/linux/omap_ion.h new file mode 100644 index 0000000..f73f127 --- /dev/null +++ b/include/linux/omap_ion.h @@ -0,0 +1,88 @@ +/* + * include/linux/omap_ion.h + * + * Copyright (C) 2011 Google, 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_OMAP_ION_H +#define _LINUX_OMAP_ION_H + +#include <linux/types.h> + +/** + * struct omap_ion_tiler_alloc_data - metadata passed from userspace for allocations + * @w: width of the allocation + * @h: height of the allocation + * @fmt: format of the data (8, 16, 32bit or page) + * @flags: flags passed to heap + * @stride: stride of the allocation, returned to caller from kernel + * @handle: pointer that will be populated with a cookie to use to refer + * to this allocation + * + * Provided by userspace as an argument to the ioctl + */ +struct omap_ion_tiler_alloc_data { + size_t w; + size_t h; + int fmt; + unsigned int flags; + struct ion_handle *handle; + size_t stride; + size_t offset; +}; + +#ifdef __KERNEL__ +int omap_ion_tiler_alloc(struct ion_client *client, + struct omap_ion_tiler_alloc_data *data); +int omap_ion_nonsecure_tiler_alloc(struct ion_client *client, + struct omap_ion_tiler_alloc_data *data); +/* given a handle in the tiler, return a list of tiler pages that back it */ +int omap_tiler_pages(struct ion_client *client, struct ion_handle *handle, + int *n, u32 ** tiler_pages); +#endif /* __KERNEL__ */ + +/* additional heaps used only on omap */ +enum { + OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1, +}; + +#define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER) + +enum { + OMAP_ION_TILER_ALLOC, +}; + +/** + * These should match the defines in the tiler driver + */ +enum { + TILER_PIXEL_FMT_MIN = 0, + TILER_PIXEL_FMT_8BIT = 0, + TILER_PIXEL_FMT_16BIT = 1, + TILER_PIXEL_FMT_32BIT = 2, + TILER_PIXEL_FMT_PAGE = 3, + TILER_PIXEL_FMT_MAX = 3 +}; + +/** + * List of heaps in the system + */ +enum { + OMAP_ION_HEAP_LARGE_SURFACES, + OMAP_ION_HEAP_TILER, + OMAP_ION_HEAP_SECURE_INPUT, + OMAP_ION_HEAP_NONSECURE_TILER, +}; + +#endif /* _LINUX_ION_H */ + diff --git a/include/linux/omap_v4l2_gfx.h b/include/linux/omap_v4l2_gfx.h new file mode 100644 index 0000000..cb175e5 --- /dev/null +++ b/include/linux/omap_v4l2_gfx.h @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + * + * This file specifies the custom ioctl API between a client "consumer" + * process and the V4L2-GFX driver. The consumer process should only use + * these APIs and will typically/ultimately be a GL application. + * + * There will also be a "producer" process which queues multimedia + * content to the driver, however, this will only use standard V4L2 APIs. + */ + +#ifndef _OMAP_V4L2_GFX_H_ +#define _OMAP_V4L2_GFX_H_ + +#include <linux/videodev.h> + +/* + * @see V4L2_GFX_IOC_CONSUMER, struct v4l2_gfx_consumer_params + */ +enum v4l2_gfx_consumer_type { + /* + * Wait for the producer process to activate a video stream + */ + V4L2_GFX_CONSUMER_WAITSTREAM, + }; + +/* + * @see V4L2_GFX_IOC_CONSUMER + */ +struct v4l2_gfx_consumer_params { + /* + * @see v4l2_gfx_consumer_type + */ + int type; /* w */ + /* + * If the consumer process is waiting the ioctl will block until the + * timeout expires or the expected event occurs, see the type field + */ + unsigned int timeout_ms; /* w */ + /* + * If acquire_timeout_ms > 0 and no streaming activity has been detected + * for acquire_timeout_ms milliseconds the V4L2_GFX_IOC_ACQ ioctl will + * return with ETIMEOUT + */ + unsigned int acquire_timeout_ms; /* w */ +}; + +/* + * @see V4L2_GFX_IOC_INFO + */ +struct v4l2_gfx_info_params { + + /* + * Return how many times the device has been opened, this number will + * decrement when the device is closed. + * + * One use for this might be to detect if a consumer or producer is + * active and in the process of setting up a stream. However this could + * be unreliable if the processes are in the process of closing / crashing. + * + * Obviously this value will always be at least one i.e. the process + * issuing the ioctl opens the device. + */ + unsigned int opencnt; /* r */ + +}; + +/* + * @see V4L2_GFX_IOC_PRODUCER + */ +struct v4l2_gfx_producer_params { + /* + * If set mark the producer side as open, if not set mark as closed. + * For Android we need this because the mediaserver won't close the + * driver. + */ + #define V4L2_GFX_PRODUCER_MASK_OPEN 0x1 + unsigned int flags; /* w */ +}; + +struct v4l2_gfx_buf_params { + /* + * Buffer index. + * + * On acquire, when the ioctl returns the bufid field will be filled in + * with the next buffer with data available. + * + * On release, the consumer process just specifies the buffer to release + * which usually is the last acquired buffer index. + */ + int bufid; /* r/w */ + + /* + * Cropping information + * For the acquire ioctl only + */ + int crop_top; /* r */ + int crop_left; /* r */ + int crop_width; /* r */ + int crop_height; /* r */ +}; + +/* + * This ioctl should be issued once by the consumer process before starting + * any rendering loop. It allows the process to wait for the producer process + * to become ready. + * + * @see struct v4l2_gfx_consumer_params + * + * Return value: + * Returns 0 if successful, or -1 on error, in which case errno indicates + * the error. + */ +#define V4L2_GFX_IOC_CONSUMER _IOWR ('v', BASE_VIDIOCPRIVATE+0, \ + struct v4l2_gfx_consumer_params) + +/* + * Acquire the buffer to be rendered and its properties. + * + * @see struct v4l2_gfx_buf_params + * + * Return value: + * Returns 0 if successful, or -1 on error, in which case errno indicates + * the error. + * + * ETIMEDOUT If acquire_timeout_ms is set via V4L2_GFX_IOC_CONSUMER + * this error code can be returned. + * ENODEV If the producer side of the stream stops this error will + * be returned. + */ +#define V4L2_GFX_IOC_ACQ _IOR ('v', BASE_VIDIOCPRIVATE+1, \ + struct v4l2_gfx_buf_params) + +/* + * Release the buffer that was rendered + * + * @see struct v4l2_gfx_buf_params + * + * Return value: + * Returns 0 if successful, or -1 on error, in which case errno indicates + * the error. + * + * ETIMEDOUT It took longer than 16ms for the app to render the frame + * (This will probably go away to avoid render loop stalls) + * EINVAL Attempted to release an invalid buffer index. + */ +#define V4L2_GFX_IOC_REL _IOW ('v', BASE_VIDIOCPRIVATE+2, \ + struct v4l2_gfx_buf_params) + +/* + * Ioctl used to get information about the device + * + * @see struct v4l2_gfx_info_params + * + * Return value: + * Returns 0 if successful, or -1 on error, in which case errno indicates + * the error. + */ +#define V4L2_GFX_IOC_INFO _IOWR ('v', BASE_VIDIOCPRIVATE+3, \ + struct v4l2_gfx_info_params) + +/* + * Ioctl used to set producer params + * + * @see struct v4l2_gfx_producer_params + * + * Return value: + * Returns 0 if successful, or -1 on error, in which case errno indicates + * the error. + */ +#define V4L2_GFX_IOC_PRODUCER _IOWR ('v', BASE_VIDIOCPRIVATE+4, \ + struct v4l2_gfx_producer_params) +#endif // _OMAP_V4L2_GFX_H_ diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h index c0b0187..80c5dc6 100644 --- a/include/linux/omapfb.h +++ b/include/linux/omapfb.h @@ -58,6 +58,7 @@ #define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) #define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info) #define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info) +#define OMAPFB_ENABLEVSYNC OMAP_IOW(64, int) #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 @@ -258,6 +259,16 @@ extern void omapfb_set_platform_data(struct omapfb_platform_data *data); extern void omapfb_set_ctrl_platform_data(void *pdata); extern void omapfb_reserve_sdram_memblock(void); +/* helper methods that may be used by other modules */ +enum omap_color_mode; +struct omap_video_timings; +int omapfb_mode_to_dss_mode(struct fb_var_screeninfo *var, + enum omap_color_mode *mode); +void omapfb_fb2dss_timings(struct fb_videomode *fb_timings, + struct omap_video_timings *dss_timings); +void omapfb_dss2fb_timings(struct omap_video_timings *dss_timings, + struct fb_videomode *fb_timings); + #endif #endif /* __OMAPFB_H */ diff --git a/include/linux/opp.h b/include/linux/opp.h index 5449945..7020e97 100644 --- a/include/linux/opp.h +++ b/include/linux/opp.h @@ -94,12 +94,20 @@ static inline int opp_disable(struct device *dev, unsigned long freq) #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) int opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table); +void opp_free_cpufreq_table(struct device *dev, + struct cpufreq_frequency_table **table); #else static inline int opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table) { return -EINVAL; } + +static inline +void opp_free_cpufreq_table(struct device *dev, + struct cpufreq_frequency_table **table) +{ +} #endif /* CONFIG_CPU_FREQ */ #endif /* __LINUX_OPP_H__ */ diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h new file mode 100644 index 0000000..b7264e1 --- /dev/null +++ b/include/linux/remoteproc.h @@ -0,0 +1,311 @@ +/* + * Remote Processor Framework + * + * Copyright(c) 2011 Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef REMOTEPROC_H +#define REMOTEPROC_H + +#include <linux/mutex.h> +#include <linux/completion.h> +#include <linux/workqueue.h> +#include <linux/notifier.h> +#include <linux/pm_qos_params.h> + +/* Must match the BIOS version embeded in the BIOS firmware image */ +#define RPROC_BIOS_VERSION 2 + +/* Maximum number of entries that can be added for lookup */ +#define RPROC_MAX_MEM_ENTRIES 20 + +/** + * The following enums and structures define the binary format of the images + * we load and run the remote processors with. + * + * The binary format is as follows: + * + * struct { + * char magic[4] = { 'R', 'P', 'R', 'C' }; + * u32 version; + * u32 header_len; + * char header[...] = { header_len bytes of unformatted, textual header }; + * struct section { + * u32 type; + * u64 da; + * u32 len; + * u8 content[...] = { len bytes of binary data }; + * } [ no limit on number of sections ]; + * } __packed; + */ +struct fw_header { + char magic[4]; + u32 version; + u32 header_len; + char header[0]; +} __packed; + +struct fw_section { + u32 type; + u64 da; + u32 len; + char content[0]; +} __packed; + +enum fw_section_type { + FW_RESOURCE = 0, + FW_TEXT = 1, + FW_DATA = 2, + FW_MMU = 3, + FW_SIGNATURE = 4, +}; + +struct fw_resource { + u32 type; + u64 da; + u64 pa; + u32 len; + u32 reserved; + u8 name[48]; +} __packed; + +enum fw_resource_type { + RSC_CARVEOUT = 0, + RSC_DEVMEM = 1, + RSC_DEVICE = 2, + RSC_IRQ = 3, + RSC_TRACE = 4, + RSC_BOOTADDR = 5, + RSC_CRASHDUMP = 6, + RSC_END = 7, +}; + +/** + * struct rproc_mem_pool - descriptor for the rproc's contiguous memory pool data + * + * @mem_base: starting physical address of the dynamic pool + * @mem_size: size of the initial dynamic pool + * @cur_base: current available physical address in the pool + * @cur_size: remaining available memory in the pool + * @st_base: starting physical address of the static pool + * @st_size: size of the static pool + */ +struct rproc_mem_pool { + phys_addr_t mem_base; + u32 mem_size; + phys_addr_t cur_base; + u32 cur_size; + phys_addr_t st_base; + u32 st_size; +}; + +/** + * struct rproc_mem_entry - descriptor of a remote memory region + * + * @da: virtual address as seen by the device (aka device address) + * @pa: physical address + * @size: size of this memory region + */ +struct rproc_mem_entry { + u64 da; + phys_addr_t pa; + u32 size; + bool core; +}; + +enum rproc_constraint { + RPROC_CONSTRAINT_SCALE, + RPROC_CONSTRAINT_LATENCY, + RPROC_CONSTRAINT_BANDWIDTH, +}; + +struct rproc; + +struct rproc_ops { + int (*start)(struct rproc *rproc, u64 bootaddr); + int (*stop)(struct rproc *rproc); + int (*suspend)(struct rproc *rproc, bool force); + int (*resume)(struct rproc *rproc); + int (*iommu_init)(struct rproc *, int (*)(struct rproc *, u64, u32)); + int (*iommu_exit)(struct rproc *); + int (*set_lat)(struct rproc *rproc, long v); + int (*set_bw)(struct rproc *rproc, long v); + int (*scale)(struct rproc *rproc, long v); + int (*watchdog_init)(struct rproc *, int (*)(struct rproc *)); + int (*watchdog_exit)(struct rproc *); + void (*dump_registers)(struct rproc *); +}; + +/* + * enum rproc_state - remote processor states + * + * @RPROC_OFFLINE: needs firmware load and init to exit this state. + * + * @RPROC_SUSPENDED: needs to be woken up to receive a message. + * + * @RPROC_RUNNING: up and running. + * + * @RPROC_LOADING: asynchronous firmware loading has started + * + * @RPROC_CRASHED: needs to be logged, connections torn down, resources + * released, and returned to OFFLINE. + */ +enum rproc_state { + RPROC_OFFLINE, + RPROC_SUSPENDED, + RPROC_RUNNING, + RPROC_LOADING, + RPROC_CRASHED, +}; + +/* + * enum rproc_event - remote processor events + * + * @RPROC_ERROR: Fatal error has happened on the remote processor. + * + * @RPROC_PRE_SUSPEND: users can register for that event in order to cancel + * autosuspend, they just need to return an error in the + * callback function. + * + * @RPROC_POS_SUSPEND: users can register for that event in order to release + * resources not needed when the remote processor is + * sleeping or if they need to save some context. + * + * @RPROC_RESUME: users should use this event to revert what was done in the + * POS_SUSPEND event. + * + * @RPROC_SECURE: remote processor secure mode has changed. + */ +enum rproc_event { + RPROC_ERROR, + RPROC_PRE_SUSPEND, + RPROC_POS_SUSPEND, + RPROC_RESUME, + RPROC_SECURE, +}; + +#define RPROC_MAX_NAME 100 + +/* + * struct rproc - a physical remote processor device + * + * @next: next rproc entry in the list + * @name: human readable name of the rproc, cannot exceed RPROC_MAX_NAME bytes + * @memory_maps: table of da-to-pa memory maps (relevant if device is behind + * an iommu) + * @memory_pool: platform-specific contiguous memory pool data (relevant for + * allocating memory needed for the remote processor image) + * @firmware: name of firmware file to be loaded + * @owner: reference to the platform-specific rproc module + * @priv: private data which belongs to the platform-specific rproc module + * @ops: platform-specific start/stop rproc handlers + * @dev: reference to the platform-specific rproc dev + * @count: usage refcount + * @state: rproc_state enum value representing the state of the device + * @lock: lock which protects concurrent manipulations of the rproc + * @dbg_dir: debugfs directory of this rproc device + * @trace_buf0: main trace buffer of the remote processor + * @trace_buf1: second, optional, trace buffer of the remote processor + * @trace_len0: length of main trace buffer of the remote processor + * @trace_len1: length of the second (and optional) trace buffer + * @cdump_buf0: main exception/crash dump buffer of the remote processor + * @cdump_buf1: second exception/crash dump buffer of the remote processor + * @cdump_len0: length of main crash dump buffer of the remote processor + * @cdump_len1: length of the second (and optional) crash dump buffer + * @firmware_loading_complete: flags e/o asynchronous firmware loading + * @mmufault_work: work in charge of notifing mmufault + * @nb_error: notify block for fatal errors + * @error_comp: completion used when an error happens + * @secure_ttb: private data for configuring iommu in secure mode + * @secure_restart: completion event notifier for the secure restart process + * @secure_mode: flag to dictate whether to enable secure loading + * @secure_ok: restart status flag to be looked up upon the event's completion + */ +struct rproc { + struct list_head next; + const char *name; + struct rproc_mem_entry memory_maps[RPROC_MAX_MEM_ENTRIES]; + struct rproc_mem_pool *memory_pool; + const char *firmware; + struct module *owner; + void *priv; + const struct rproc_ops *ops; + struct device *dev; + int count; + int state; + struct mutex lock; + struct dentry *dbg_dir; + char *trace_buf0, *trace_buf1; + char *last_trace_buf0, *last_trace_buf1; + int trace_len0, trace_len1; + int last_trace_len0, last_trace_len1; + void *cdump_buf0, *cdump_buf1; + int cdump_len0, cdump_len1; + struct mutex tlock; + struct completion firmware_loading_complete; + struct work_struct error_work; + struct blocking_notifier_head nbh; + struct completion error_comp; +#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND + unsigned sus_timeout; + bool force_suspend; + bool need_resume; + struct mutex pm_lock; +#endif + struct pm_qos_request_list *qos_request; + void *secure_ttb; + struct completion secure_restart; + struct mutex secure_lock; + bool secure_mode; + bool secure_ok; + bool halt_on_crash; + char *header; + int header_len; +}; + +int rproc_set_secure(const char *, bool); +struct rproc *rproc_get(const char *); +void rproc_put(struct rproc *); +int rproc_event_register(struct rproc *, struct notifier_block *); +int rproc_event_unregister(struct rproc *, struct notifier_block *); +int rproc_register(struct device *, const char *, const struct rproc_ops *, + const char *, struct rproc_mem_pool *, struct module *, + unsigned int timeout); +int rproc_unregister(const char *); +void rproc_last_busy(struct rproc *); +#ifdef CONFIG_REMOTE_PROC_AUTOSUSPEND +extern const struct dev_pm_ops rproc_gen_pm_ops; +#define GENERIC_RPROC_PM_OPS (&rproc_gen_pm_ops) +#else +#define GENERIC_RPROC_PM_OPS NULL +#endif +int rproc_set_constraints(struct rproc *, enum rproc_constraint type, long v); +int rproc_error_notify(struct rproc *rproc); + +#endif /* REMOTEPROC_H */ diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h new file mode 100644 index 0000000..1f7ba09 --- /dev/null +++ b/include/linux/rpmsg.h @@ -0,0 +1,191 @@ +/* + * Remote processor messaging + * + * Copyright(c) 2011 Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_RPMSG_H +#define _LINUX_RPMSG_H + +#include <linux/types.h> +#include <linux/device.h> +#include <linux/mod_devicetable.h> + +/* The feature bitmap for virtio rpmsg */ +#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ + +/** + * struct rpmsg_hdr - + * + * ... keep documenting ... + */ +struct rpmsg_hdr { + u16 len; + u16 flags; + u32 src; + u32 dst; + u32 unused; + u8 data[0]; +} __packed; + +enum rpmsg_ns_flags { + RPMSG_NS_CREATE = 0, + RPMSG_NS_DESTROY = 1, +}; + +struct rpmsg_ns_msg { + char name[RPMSG_NAME_SIZE]; + u32 addr; + u32 flags; +} __packed; + +/* driver requests */ +enum { + VPROC_BUF_ADDR, + VPROC_BUF_NUM, + VPROC_BUF_SZ, + VPROC_SIM_BASE, + VPROC_STATIC_CHANNELS, +}; + +#define RPMSG_ADDR_ANY 0xFFFFFFFF + +struct virtproc_info; + +/** + * rpmsg_channel - rpmsg channels are the devices of the rpmsg bus + * + * @vrp: the remote processor this channel connects to + * @dev: underlying device + * @id: the device type identification (used to match an rpmsg driver) + * @src: local address of this channel + * @dst: destination address of the remote service + * @priv: private pointer for the driver's use. + * @ept: local rpmsg endpoint of this channel + * @announce: need to tell remoteproc about channel creation/removal + */ +struct rpmsg_channel { + struct virtproc_info *vrp; + struct device dev; + struct rpmsg_device_id id; + u32 src; + u32 dst; + void *priv; + struct rpmsg_endpoint *ept; + bool announce; +}; + +struct rpmsg_channel_info { + char name[RPMSG_NAME_SIZE]; + u32 src; + u32 dst; +}; + +/** + * struct rpmsg_endpoint + * + * @rpdev: + * @cb: + * @src: local rpmsg address + * @priv: + */ +struct rpmsg_endpoint { + struct rpmsg_channel *rpdev; + void (*cb)(struct rpmsg_channel *, void *, int, void *, u32); + u32 addr; + void *priv; +}; + +/** + * rpmsg_driver - operations for a rpmsg I/O driver + * @driver: underlying device driver (populate name and owner). + * @id_table: the ids serviced by this driver. + * @probe: the function to call when a device is found. Returns 0 or -errno. + * @remove: the function when a device is removed. + * @callback: invoked when a message is received on the channel + */ +struct rpmsg_driver { + struct device_driver drv; + const struct rpmsg_device_id *id_table; + int (*probe)(struct rpmsg_channel *dev); + void (*remove)(struct rpmsg_channel *dev); + void (*callback)(struct rpmsg_channel *, void *, int, void *, u32); +}; + +int register_rpmsg_device(struct rpmsg_channel *dev); +void unregister_rpmsg_device(struct rpmsg_channel *dev); +int register_rpmsg_driver(struct rpmsg_driver *drv); +void unregister_rpmsg_driver(struct rpmsg_driver *drv); +void rpmsg_destroy_ept(struct rpmsg_endpoint *); +struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *, + void (*cb)(struct rpmsg_channel *, void *, int, void *, u32), + void *priv, u32 addr); + +int +rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool); + +static inline +int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, + void *data, int len) +{ + return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true); +} + +static inline int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len) +{ + return rpmsg_send_offchannel(rpdev, rpdev->src, rpdev->dst, data, len); +} + +static inline +int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst) +{ + return rpmsg_send_offchannel(rpdev, rpdev->src, dst, data, len); +} + +static inline +int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst, + void *data, int len) +{ + return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false); +} + +static inline +int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len) +{ + return rpmsg_trysend_offchannel(rpdev, rpdev->src, rpdev->dst, + data, len); +} + +static inline +int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst) +{ + return rpmsg_trysend_offchannel(rpdev, rpdev->src, dst, data, len); +} + +#endif /* _LINUX_RPMSG_H */ diff --git a/include/linux/rpmsg_omx.h b/include/linux/rpmsg_omx.h new file mode 100644 index 0000000..15503d5 --- /dev/null +++ b/include/linux/rpmsg_omx.h @@ -0,0 +1,144 @@ +/* + * OMX offloading remote processor driver + * + * Copyright(c) 2011 Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RPMSG_OMX_H +#define RPMSG_OMX_H + +#include <linux/ioctl.h> + +#define OMX_IOC_MAGIC 'X' + +#define OMX_IOCCONNECT _IOW(OMX_IOC_MAGIC, 1, char *) +#define OMX_IOCIONREGISTER _IOWR(OMX_IOC_MAGIC, 2, struct ion_fd_data) +#define OMX_IOCIONUNREGISTER _IOWR(OMX_IOC_MAGIC, 3, struct ion_fd_data) + +#define OMX_IOC_MAXNR (3) + +#ifdef __KERNEL__ + +/** + * enum omx_msg_types - various message types currently supported + * + * @OMX_CONN_REQ: a connection request message type. the message should carry + * the name of the OMX service which we try to connect to. An instance of + * that service will be created remotely, and its address will be sent as + * a reply. + * + * @OMX_CONN_RSP: a response to a connection request. the message will carry + * an error code (success/failure), and if connection established successfully, + * the addr field will carry the address of the newly created OMX instance. + * + * @OMX_DISCONNECT: disconnect remote OMX instance. this message tells + * remote processor to release the resources coupled with this connection + * + * @OMX_RAW_MSG: a message that should be propagated as-is to the user. + * this would immediately enable user space development to start. + * as we progress, most likely this message won't be needed anymore. + */ +enum omx_msg_types { + OMX_CONN_REQ = 0, + OMX_CONN_RSP = 1, + OMX_DISCONNECT = 4, + OMX_RAW_MSG = 5, + /* todo: do we need a disconnect response ? ION refcounts should allow + * asynchronous release of relevant buffers */ +}; + +/** + * enum omx_error_codes - various error codes that will be used + * + * @OMX_SUCCESS: success + * + * @OMX_NOTSUPP: not supported + * + * @OMX_NOMEM: remote processor is out of memory + */ +enum omx_error_codes { + OMX_SUCCESS = 0, + OMX_NOTSUPP = 1, + OMX_NOMEM = 2, +}; + +/* keep documenting... */ +enum omx_state { + OMX_UNCONNECTED, + OMX_CONNECTED, + OMX_FAIL, +}; + +/** + * struct omx_msg_hdr - common header for all OMX messages + * @type: type of message, see enum omx_msg_types + * @flags: currently unused, should be zero + * @len: length of msg payload (in bytes) + * @data: the msg payload (depends on the message type) + * + * All OMX messages will start with this common header (which will begin + * right after the standard rpmsg header ends). + */ +struct omx_msg_hdr { + u32 type; + u32 flags; + u32 len; + char data[0]; +} __packed; + +struct omx_conn_rsp { + u32 status; + u32 addr; +} __packed; + +struct omx_disc_req { + u32 addr; +} __packed; + + +#endif /* __KERNEL__ */ + +/* temporarily exposed to user space too */ +struct omx_conn_req { + char name[48]; +} __packed; + +/* the packet structure (actual message sent to omx service) */ +struct omx_packet { + uint16_t desc; /* descriptor, and omx service status */ + uint16_t msg_id; /* message id */ + uint32_t flags; /* Set to a fixed value for now. */ + uint32_t fxn_idx; /* Index into OMX service's function table.*/ + int32_t result; /* The OMX function status. */ + uint32_t data_size;/* Size of in/out data to/from the function. */ + uint32_t data[0]; /* Payload of data_size char's passed to + function. */ +}; + +#endif /* RPMSG_OMX_H */ diff --git a/include/linux/rpmsg_resmgr.h b/include/linux/rpmsg_resmgr.h new file mode 100644 index 0000000..707809e --- /dev/null +++ b/include/linux/rpmsg_resmgr.h @@ -0,0 +1,131 @@ +/* + * Remote processor messaging + * + * Copyright(c) 2011 Texas Instruments. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_RPMSG_RESMGR_H +#define _LINUX_RPMSG_RESMGR_H + +#define MAX_NUM_SDMA_CHANNELS 16 + +enum { + RPRM_GPTIMER = 0, + RPRM_IVAHD = 1, + RPRM_IVASEQ0 = 2, + RPRM_IVASEQ1 = 3, + RPRM_L3BUS = 4, + RPRM_ISS = 5, + RPRM_FDIF = 6, + RPRM_SL2IF = 7, + RPRM_AUXCLK = 8, + RPRM_REGULATOR = 9, + RPRM_GPIO = 10, + RPRM_SDMA = 11, + RPRM_IPU = 12, + RPRM_DSP = 13, + RPRM_I2C = 14, + RPRM_MAX +}; + +enum { + RPRM_CONNECT = 0, + RPRM_REQ_ALLOC = 1, + RPRM_REQ_FREE = 2, + RPRM_DISCONNECT = 3, + RPRM_REQ_CONSTRAINTS = 4, + RPRM_REL_CONSTRAINTS = 5, +}; + +enum { + RPRM_SCALE = 0x1, + RPRM_LATENCY = 0x2, + RPRM_BANDWIDTH = 0x4, +}; + +struct rprm_request { + u32 res_type; + u32 acquire; + u32 res_id; + char data[]; +} __packed; + +struct rprm_ack { + u32 ret; + u32 res_type; + u32 res_id; + u32 base; + char data[]; +} __packed; + +struct rprm_gpt { + u32 id; + u32 src_clk; +}; + +struct rprm_auxclk { + u32 id; + u32 clk_rate; + u32 parent_src_clk; + u32 parent_src_clk_rate; +}; + +struct rprm_regulator { + u32 id; + u32 min_uv; + u32 max_uv; +}; + +struct rprm_gpio { + u32 id; +}; + +/** + * struct rprm_i2c - resource i2c + * @id: i2c id + * + * meant to store the i2c related information + */ +struct rprm_i2c { + u32 id; +}; + +struct rprm_sdma { + u32 num_chs; + s32 channels[MAX_NUM_SDMA_CHANNELS]; +}; + +struct rprm_constraints_data { + u32 mask; + long frequency; + long bandwidth; + long latency; +}; + +#endif /* _LINUX_RPMSG_RESMGR_H */ diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h index 85bb0bb..1520c06 100644 --- a/include/linux/virtio_ids.h +++ b/include/linux/virtio_ids.h @@ -35,5 +35,6 @@ #define VIRTIO_ID_RNG 4 /* virtio ring */ #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ #define VIRTIO_ID_9P 9 /* 9p virtio console */ +#define VIRTIO_ID_RPMSG 10 /* virtio remote processor messaging */ #endif /* _LINUX_VIRTIO_IDS_H */ diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 4a32cb6..7894a16 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h @@ -177,5 +177,7 @@ void vring_del_virtqueue(struct virtqueue *vq); void vring_transport_features(struct virtio_device *vdev); irqreturn_t vring_interrupt(int irq, void *_vq); +struct vring_virtqueue; +bool virtqueue_more_used(struct virtqueue *vq); #endif /* __KERNEL__ */ #endif /* _LINUX_VIRTIO_RING_H */ |