[PATCH] OMAP: irq: fix bug with a reused loop counter
Bugfix: Two nested for-loops were both using i as loop counter. Signed-off-by: Tapani Utriainen tap...@technexion.com --- arch/arm/mach-omap2/irq.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c @@ -165,8 +165,8 @@ omap_irq_bank_init_one(bank); - for (i = 0, j = 0; i bank-nr_irqs; i += 32, j += 0x20) - omap_alloc_gc(bank-base_reg + j, i, 32); + for (j = 0; j bank-nr_irqs; j += 32) + omap_alloc_gc(bank-base_reg + j, j, 32); nr_of_irqs += bank-nr_irqs; nr_banks++; --- -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5 v4] mfd: omap: usb: Runtime PM support
On Sat, Aug 13, 2011 at 3:00 AM, Todd Poynor toddpoy...@google.com wrote: On Fri, Aug 12, 2011 at 12:20:21PM +0530, Munegowda, Keshava wrote: On Wed, Aug 10, 2011 at 10:01 PM, Todd Poynor toddpoy...@google.com wrote: @@ -913,12 +598,15 @@ static int usbhs_enable(struct device *dev) (pdata-ehci_data-reset_gpio_port[1], 1); } -end_count: - omap-count++; + pm_runtime_put_sync(dev); spin_unlock_irqrestore(omap-lock, flags); Is pm_runtime_irq_safe() needed (else I think runtime PM callbacks may re-enable IRQs... or there's the new *_suspend runtime PM calls that may avoid this)? pm_runtime_irq_safe() is not required; usbhs does not have a parent and it is the parent driver of ehci and ohci drivers. But the above expects IRQs to be disabled during the pm_runtime_put_sync, and synchronous calls can turn IRQs back on in rpm_idle: if (callback) { spin_unlock_irq(dev-power.lock); callback(dev); I see other folks who know this better than me are discussing USB run time PM and might_sleep contexts, so I'll note this concern and let others chime in if they think there's a real problem here. Thanks, I think I should protect the critical section of call backs here. Todd -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Media controller: Define media_entity_init() and media_entity_cleanup() conditionally
From: Vaibhav Hiremath hvaib...@ti.com Defines the two functions only when CONFIG_MEDIA_CONTROLLER is enabled. Signed-off-by: Vaibhav Hiremath hvaib...@ti.com Signed-off-by: Deepthy Ravi deepthy.r...@ti.com --- include/media/media-entity.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index cd8bca6..c90916e 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -121,9 +121,18 @@ struct media_entity_graph { int top; }; +#ifdef CONFIG_MEDIA_CONTROLLER int media_entity_init(struct media_entity *entity, u16 num_pads, struct media_pad *pads, u16 extra_links); void media_entity_cleanup(struct media_entity *entity); +#else +static inline int media_entity_init(struct media_entity *entity, u16 num_pads, + struct media_pad *pads, u16 extra_links) +{ + return 0; +} +static inline void media_entity_cleanup(struct media_entity *entity) {} +#endif int media_entity_create_link(struct media_entity *source, u16 source_pad, struct media_entity *sink, u16 sink_pad, u32 flags); -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] V4L/DVB: Add chip ID of TVP5146 video decoder
From: Vaibhav Hiremath hvaib...@ti.com This patch is to add chip identifier entry for TVP5146 video decoder. Signed-off-by: Vaibhav Hiremath hvaib...@ti.com Signed-off-by: Deepthy Ravi deepthy.r...@ti.com --- include/media/v4l2-chip-ident.h |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 63fd9d3..cd9b66f 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -122,6 +122,9 @@ enum { /* Other via devs could use 3314, 3324, 3327, 3336, 3364, 3353 */ V4L2_IDENT_VIA_VX855 = 3409, + /* module tvp514x */ + V4L2_IDENT_TVP5146 = 5146, + /* module tvp5150 */ V4L2_IDENT_TVP5150 = 5150, -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [lm-sensors] [RFC PATCH 6/6] hwmon: OMAP4: On die temperature sensor driver
On Mon, Aug 15, 2011 at 11:52 AM, J, KEERTHY j-keer...@ti.com wrote: Hi, Thanks for the Review Durga. On Wed, Aug 10, 2011 at 10:05 PM, R, Durgadoss durgados...@intel.com wrote: Hi, -Original Message- From: lm-sensors-boun...@lm-sensors.org [mailto:lm-sensors-bounces@lm- sensors.org] On Behalf Of Keerthy Sent: Wednesday, August 10, 2011 5:55 PM To: lm-sens...@lm-sensors.org Cc: vishwanath...@ti.com; linux-omap@vger.kernel.org; b-cous...@ti.com; rna...@ti.com Subject: [lm-sensors] [RFC PATCH 6/6] hwmon: OMAP4: On die temperature sensor driver On chip temperature sensor driver. The driver monitors the temperature of the MPU subsystem of the OMAP4. It sends notifications to the user space if the temperature crosses user defined thresholds via kobject_uevent interface. The user is allowed to configure the temperature thresholds vis sysfs nodes exposed using hwmon interface. Signed-off-by: Keerthy j-keer...@ti.com --- drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/omap_temp_sensor.c | 950 ++ 3 files changed, 962 insertions(+), 0 deletions(-) create mode 100644 drivers/hwmon/omap_temp_sensor.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 5f888f7..9c9cd8b 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -323,6 +323,17 @@ config SENSORS_F71805F This driver can also be built as a module. If so, the module will be called f71805f. +config SENSORS_OMAP_BANDGAP_TEMP_SENSOR + bool OMAP on-die temperature sensor hwmon driver + depends on HWMON ARCH_OMAP OMAP_TEMP_SENSOR + help + If you say yes here you get support for hardware + monitoring features of the OMAP on die temperature + sensor. + + Continuous conversion programmable delay + mode is used for temperature conversion. + config SENSORS_F71882FG tristate Fintek F71882FG and compatibles help diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 28061cf..d0f89f5 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -91,6 +91,7 @@ obj-$(CONFIG_SENSORS_MAX6639) += max6639.o obj-$(CONFIG_SENSORS_MAX6642) += max6642.o obj-$(CONFIG_SENSORS_MAX6650) += max6650.o obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o +obj-$(CONFIG_SENSORS_OMAP_BANDGAP_TEMP_SENSOR) += omap_temp_sensor.o obj-$(CONFIG_SENSORS_PC87360) += pc87360.o obj-$(CONFIG_SENSORS_PC87427) += pc87427.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o diff --git a/drivers/hwmon/omap_temp_sensor.c b/drivers/hwmon/omap_temp_sensor.c new file mode 100644 index 000..15e2559 --- /dev/null +++ b/drivers/hwmon/omap_temp_sensor.c @@ -0,0 +1,950 @@ +/* + * OMAP4 Temperature sensor driver file + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * Author: J Keerthy j-keer...@ti.com + * Author: Moiz Sonasath m-sonas...@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 + * + */ + +#include linux/interrupt.h +#include linux/clk.h +#include linux/io.h +#include linux/debugfs.h +#include linux/delay.h +#include linux/slab.h +#include linux/platform_device.h +#include linux/init.h +#include plat/omap_device.h +#include linux/module.h +#include linux/kernel.h +#include linux/device.h +#include linux/jiffies.h +#include linux/hwmon.h +#include linux/hwmon-sysfs.h +#include linux/stddef.h +#include linux/sysfs.h +#include linux/err.h +#include linux/types.h +#include linux/mutex.h +#include linux/pm_runtime.h +#include plat/common.h +#include plat/temperature_sensor.h +#include mach/ctrl_module_core_44xx.h +#include mach/gpio.h + +#define TSHUT_THRESHOLD_HOT 122000 /* 122 deg C */ +#define TSHUT_THRESHOLD_COLD 10 /* 100 deg C */ +#define BGAP_THRESHOLD_T_HOT 73000 /* 73 deg C */ +#define BGAP_THRESHOLD_T_COLD 71000 /* 71 deg C */ +#define OMAP_ADC_START_VALUE 530 +#define OMAP_ADC_END_VALUE 923 + +/* + * omap_temp_sensor structure + * @hwmon_dev - device pointer + * @clock - Clock pointer + * @registers - Pointer to structure with register offsets and bitfields + * @sensor_mutex - Mutex for sysfs, irq and PM + * @irq - MPU Irq number for thermal alert +
Re: [PATCH] Media controller: Define media_entity_init() and media_entity_cleanup() conditionally
On Wed, 2011-08-17 at 16:04 +0530, Deepthy Ravi wrote: From: Vaibhav Hiremath hvaib...@ti.com Defines the two functions only when CONFIG_MEDIA_CONTROLLER is enabled. Is it not a driver's option to be dependent on MEDIA_CONTROLLER? -- Andy Shevchenko andriy.shevche...@linux.intel.com Intel Finland Oy -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5 v5] arm: omap: usb: register hwmods of usbhs
The hwmod structure of uhh, ohci, ehci and tll are retrived and registered with omap device Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com --- arch/arm/mach-omap2/usb-host.c | 114 +-- 1 files changed, 50 insertions(+), 64 deletions(-) diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index 89ae298..9c37db9 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c @@ -28,51 +28,30 @@ #include mach/hardware.h #include mach/irqs.h #include plat/usb.h +#include plat/omap_device.h #include mux.h #ifdef CONFIG_MFD_OMAP_USB_HOST -#define OMAP_USBHS_DEVICE usbhs-omap - -static struct resource usbhs_resources[] = { - { - .name = uhh, - .flags = IORESOURCE_MEM, - }, - { - .name = tll, - .flags = IORESOURCE_MEM, - }, - { - .name = ehci, - .flags = IORESOURCE_MEM, - }, - { - .name = ehci-irq, - .flags = IORESOURCE_IRQ, - }, - { - .name = ohci, - .flags = IORESOURCE_MEM, - }, - { - .name = ohci-irq, - .flags = IORESOURCE_IRQ, - } -}; - -static struct platform_device usbhs_device = { - .name = OMAP_USBHS_DEVICE, - .id = 0, - .num_resources = ARRAY_SIZE(usbhs_resources), - .resource = usbhs_resources, -}; +#define OMAP_USBHS_DEVICE usbhs_omap +#defineUSBHS_UHH_HWMODNAME usbhs_uhh +#defineUSBHS_OHCI_HWMODNAMEusbhs_ohci +#define USBHS_EHCI_HWMODNAME usbhs_ehci +#define USBHS_TLL_HWMODNAMEusbhs_tll static struct usbhs_omap_platform_data usbhs_data; static struct ehci_hcd_omap_platform_data ehci_data; static struct ohci_hcd_omap_platform_data ohci_data; +static struct omap_device_pm_latency omap_uhhtll_latency[] = { + { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + /* MUX settings for EHCI pins */ /* * setup_ehci_io_mux - initialize IO pad mux for USBHOST @@ -508,7 +487,10 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) void __init usbhs_init(const struct usbhs_omap_board_data *pdata) { - int i; + struct omap_hwmod *oh[4]; + struct omap_device *od; + int bus_id = -1; + int i; for (i = 0; i OMAP3_HS_USB_PORTS; i++) { usbhs_data.port_mode[i] = pdata-port_mode[i]; @@ -523,44 +505,48 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) usbhs_data.ohci_data = ohci_data; if (cpu_is_omap34xx()) { - usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE; - usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1; - usbhs_resources[1].start = OMAP34XX_USBTLL_BASE; - usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1; - usbhs_resources[2].start= OMAP34XX_EHCI_BASE; - usbhs_resources[2].end = OMAP34XX_EHCI_BASE + SZ_1K - 1; - usbhs_resources[3].start = INT_34XX_EHCI_IRQ; - usbhs_resources[4].start= OMAP34XX_OHCI_BASE; - usbhs_resources[4].end = OMAP34XX_OHCI_BASE + SZ_1K - 1; - usbhs_resources[5].start = INT_34XX_OHCI_IRQ; setup_ehci_io_mux(pdata-port_mode); setup_ohci_io_mux(pdata-port_mode); } else if (cpu_is_omap44xx()) { - usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE; - usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1; - usbhs_resources[1].start = OMAP44XX_USBTLL_BASE; - usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1; - usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE; - usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1; - usbhs_resources[3].start = OMAP44XX_IRQ_EHCI; - usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE; - usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1; - usbhs_resources[5].start = OMAP44XX_IRQ_OHCI; setup_4430ehci_io_mux(pdata-port_mode); setup_4430ohci_io_mux(pdata-port_mode); } - if (platform_device_add_data(usbhs_device, - usbhs_data, sizeof(usbhs_data)) 0) { - printk(KERN_ERR USBHS platform_device_add_data failed\n); - goto init_end; + oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); + if (!oh[0]) { + pr_err(Could not look up %s\n, USBHS_UHH_HWMODNAME); +
[PATCH 1/5 v5] arm: omap: usb: ehci and ohci hwmod structures for omap4
From: Benoit Cousson b-cous...@ti.com Following 4 hwmod strcuture are added: UHH hwmod of usbhs with uhh base address and functional clock, EHCI hwmod with irq and base address, OHCI hwmod with irq and base address, TLL hwmod of usbhs with the TLL base address and irq. Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 244 1 files changed, 244 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 6201422..d8f08fa 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -68,6 +68,10 @@ static struct omap_hwmod omap44xx_mmc2_hwmod; static struct omap_hwmod omap44xx_mpu_hwmod; static struct omap_hwmod omap44xx_mpu_private_hwmod; static struct omap_hwmod omap44xx_usb_otg_hs_hwmod; +static struct omap_hwmod omap44xx_usb_host_hs_hwmod; +static struct omap_hwmod omap44xx_usbhs_ohci_hwmod; +static struct omap_hwmod omap44xx_usbhs_ehci_hwmod; +static struct omap_hwmod omap44xx_usb_tll_hs_hwmod; /* * Interconnects omap_hwmod structures @@ -5336,6 +5340,242 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* + * 'usb_host_hs' class + * high-speed multi-port usb host controller + */ +static struct omap_hwmod_ocp_if omap44xx_usb_host_hs__l3_main_2 = { + .master = omap44xx_usb_host_hs_hwmod, + .slave = omap44xx_l3_main_2_hwmod, + .clk= l3_div_ck, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART | + MSTANDBY_SMART_WKUP), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = { + .name = usbhs_uhh, + .sysc = omap44xx_usb_host_hs_sysc, +}; + +static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_masters[] = { + omap44xx_usb_host_hs__l3_main_2, +}; + +static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = { + { + .name = uhh, + .pa_start = 0x4a064000, + .pa_end = 0x4a0647ff, + .flags = ADDR_TYPE_RT + }, + {} /* Terminating Entry */ +}; + +static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = { + .master = omap44xx_l4_cfg_hwmod, + .slave = omap44xx_usb_host_hs_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_usb_host_hs_addrs, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_slaves[] = { + omap44xx_l4_cfg__usb_host_hs, +}; + +static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { + .name = usbhs_uhh, + .class = omap44xx_usb_host_hs_hwmod_class, + .clkdm_name = l3_init_clkdm, + .main_clk = usb_host_hs_fck, + .prcm = { + .omap4 = { + .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_CLKCTRL_OFFSET, + .context_offs = OMAP4_RM_L3INIT_USB_HOST_CONTEXT_OFFSET, + .modulemode = MODULEMODE_SWCTRL, + }, + }, + .slaves = omap44xx_usb_host_hs_slaves, + .slaves_cnt = ARRAY_SIZE(omap44xx_usb_host_hs_slaves), + .masters= omap44xx_usb_host_hs_masters, + .masters_cnt= ARRAY_SIZE(omap44xx_usb_host_hs_masters), + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), +}; + +/* 'usbhs_ohci' class */ +static struct omap_hwmod_class omap44xx_usbhs_ohci_hwmod_class = { + .name = usbhs_ohci, +}; + +static struct omap_hwmod_irq_info omap44xx_usbhs_ohci_irqs[] = { + { .name = ohci-irq, .irq = 76 + OMAP44XX_IRQ_GIC_START }, + { .irq = -1 } /* Terminating IRQ */ +}; + +static struct omap_hwmod_addr_space omap44xx_usbhs_ohci_addrs[] = { + { + .name = ohci, + .pa_start = 0x4A064800, + .pa_end = 0x4A064BFF, + .flags = ADDR_MAP_ON_INIT + }, + {} +}; + +static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usbhs_ohci = { + .master = omap44xx_l4_cfg_hwmod, + .slave = omap44xx_usbhs_ohci_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_usbhs_ohci_addrs, + .user
[PATCH 0/5 v5] mfd: omap: usb: Runtime PM support for EHCI and OHCI drivers
From: Keshava Munegowda keshava_mgo...@ti.com The Hwmod structures and Runtime PM features are implemented For EHCI and OHCI drivers of OMAP3 and OMAP4. The global suspend/resume of EHCI and OHCI is validated on OMAP3430 sdp board with these patches. these patches are rebased to kevin's pm branch and usbhs latest mainline kernel patches TODO: - Aggressive clock cutting in usb bus suspends - Remote Wakeup implementation using irq-chaing Benoit Cousson (1): arm: omap: usb: ehci and ohci hwmod structures for omap4 Keshava Munegowda (4): arm: omap: usb: ehci and ohci hwmod structures for omap3 arm: omap: usb: register hwmods of usbhs arm: omap: usb: device name change for the clk names of usbhs mfd: omap: usb: Runtime PM support arch/arm/mach-omap2/clock3xxx_data.c | 26 +- arch/arm/mach-omap2/clock44xx_data.c | 10 +- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 279 +++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 244 + arch/arm/mach-omap2/usb-host.c | 114 ++--- arch/arm/plat-omap/include/plat/usb.h |3 - drivers/mfd/omap-usb-host.c| 733 +++- drivers/usb/host/ehci-omap.c | 17 +- drivers/usb/host/ohci-omap3.c | 18 +- 9 files changed, 886 insertions(+), 558 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5 v5] arm: omap: usb: device name change for the clk names of usbhs
From: Keshava Munegowda keshava_mgo...@ti.com device name usbhs clocks are changed from usbhs-omap.0 to usbhs_omap; this is because in the hwmod registration the device name is set as usbhs_omap; The redudant clock nodes are removed. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com --- arch/arm/mach-omap2/clock3xxx_data.c | 26 -- arch/arm/mach-omap2/clock44xx_data.c | 10 +- drivers/mfd/omap-usb-host.c |2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index ffd55b1..63a822f 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c @@ -3285,7 +3285,7 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, cpefuse_fck, cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(NULL, ts_fck, ts_fck,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(NULL, usbtll_fck, usbtll_fck,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, usbtll_fck, usbtll_fck,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), + CLK(usbhs_omap, usbtll_fck, usbtll_fck,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(omap-mcbsp.1, prcm_fck, core_96m_fck, CK_3XXX), CLK(omap-mcbsp.5, prcm_fck, core_96m_fck, CK_3XXX), CLK(NULL, core_96m_fck, core_96m_fck, CK_3XXX), @@ -3321,7 +3321,7 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, pka_ick, pka_ick, CK_34XX | CK_36XX), CLK(NULL, core_l4_ick, core_l4_ick, CK_3XXX), CLK(NULL, usbtll_ick, usbtll_ick,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, usbtll_ick, usbtll_ick,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), + CLK(usbhs_omap, usbtll_ick, usbtll_ick,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(omap_hsmmc.2, ick, mmchs3_ick,CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(NULL, icr_ick, icr_ick, CK_34XX | CK_36XX), CLK(omap-aes, ick, aes2_ick, CK_34XX | CK_36XX), @@ -3367,20 +3367,18 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, cam_ick, cam_ick, CK_34XX | CK_36XX), CLK(NULL, csi2_96m_fck, csi2_96m_fck, CK_34XX | CK_36XX), CLK(NULL, usbhost_120m_fck, usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, hs_fck, usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(NULL, usbhost_48m_fck, usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, fs_fck, usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), CLK(NULL, usbhost_ick, usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, usbhost_ick, usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), - CLK(usbhs-omap.0, utmi_p1_gfclk,dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, utmi_p2_gfclk,dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, xclk60mhsp1_ck, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, xclk60mhsp2_ck, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, usb_host_hs_utmi_p1_clk, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, usb_host_hs_utmi_p2_clk, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, usb_tll_hs_usb_ch0_clk, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, usb_tll_hs_usb_ch1_clk, dummy_ck, CK_3XXX), - CLK(usbhs-omap.0, init_60m_fclk,dummy_ck, CK_3XXX), + CLK(usbhs_omap, usbhost_ick, usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), + CLK(usbhs_omap, utmi_p1_gfclk,dummy_ck, CK_3XXX), + CLK(usbhs_omap, utmi_p2_gfclk,dummy_ck, CK_3XXX), + CLK(usbhs_omap, xclk60mhsp1_ck, dummy_ck, CK_3XXX), + CLK(usbhs_omap, xclk60mhsp2_ck, dummy_ck, CK_3XXX), + CLK(usbhs_omap, usb_host_hs_utmi_p1_clk, dummy_ck, CK_3XXX), + CLK(usbhs_omap, usb_host_hs_utmi_p2_clk, dummy_ck, CK_3XXX), + CLK(usbhs_omap, usb_tll_hs_usb_ch0_clk, dummy_ck, CK_3XXX), + CLK(usbhs_omap, usb_tll_hs_usb_ch1_clk, dummy_ck, CK_3XXX), + CLK(usbhs_omap, init_60m_fclk,dummy_ck, CK_3XXX), CLK(NULL, usim_fck, usim_fck, CK_3430ES2PLUS | CK_36XX), CLK(NULL, gpt1_fck, gpt1_fck, CK_3XXX), CLK(NULL, wkup_32k_fck, wkup_32k_fck, CK_3XXX), diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 2af0e3f..088977a 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c @@ -3281,7 +3281,7 @@ static
[PATCH 2/5 v5] arm: omap: usb: ehci and ohci hwmod structures for omap3
Following 4 hwmod strcuture are added: UHH hwmod of usbhs with uhh base address and functional clock, EHCI hwmod with irq and base address, OHCI hwmod with irq and base address, TLL hwmod of usbhs with the TLL base address and irq. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 279 1 files changed, 279 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 59fdb9f..d7316b3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -84,6 +84,10 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod; static struct omap_hwmod omap3xxx_mcbsp5_hwmod; static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod; static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod; +static struct omap_hwmod omap34xx_usb_host_hs_hwmod; +static struct omap_hwmod omap34xx_usbhs_ohci_hwmod; +static struct omap_hwmod omap34xx_usbhs_ehci_hwmod; +static struct omap_hwmod omap34xx_usb_tll_hs_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { @@ -3196,6 +3200,276 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; +/* + * 'usb_host_hs' class + * high-speed multi-port usb host controller + */ +static struct omap_hwmod_ocp_if omap34xx_usb_host_hs__l3_main_2 = { + .master = omap34xx_usb_host_hs_hwmod, + .slave = omap3xxx_l3_main_hwmod, + .clk= core_l3_ick, + .user = OCP_USER_MPU, +}; + +static struct omap_hwmod_class_sysconfig omap34xx_usb_host_hs_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .syss_offs = 0x0014, + .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap34xx_usb_host_hs_hwmod_class = { + .name = usbhs_uhh, + .sysc = omap34xx_usb_host_hs_sysc, +}; + +static struct omap_hwmod_ocp_if *omap34xx_usb_host_hs_masters[] = { + omap34xx_usb_host_hs__l3_main_2, +}; + +static struct omap_hwmod_addr_space omap34xx_usb_host_hs_addrs[] = { + { + .name = uhh, + .pa_start = 0x48064000, + .pa_end = 0x480643ff, + .flags = ADDR_TYPE_RT + }, + {} /* Terminating Entry */ +}; + +static struct omap_hwmod_ocp_if omap34xx_l4_cfg__usb_host_hs = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap34xx_usb_host_hs_hwmod, + .clk= l4_ick, + .addr = omap34xx_usb_host_hs_addrs, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod_ocp_if omap34xx_f128m_cfg__usb_host_hs = { + .clk= usbhost_120m_fck, + .user = OCP_USER_MPU, + .flags = OCPIF_SWSUP_IDLE, +}; + +static struct omap_hwmod_ocp_if omap34xx_f48m_cfg__usb_host_hs = { + .clk= usbhost_48m_fck, + .user = OCP_USER_MPU, + .flags = OCPIF_SWSUP_IDLE, +}; + +static struct omap_hwmod_ocp_if *omap34xx_usb_host_hs_slaves[] = { + omap34xx_l4_cfg__usb_host_hs, + omap34xx_f128m_cfg__usb_host_hs, + omap34xx_f48m_cfg__usb_host_hs, +}; + +static struct omap_hwmod omap34xx_usb_host_hs_hwmod = { + .name = usbhs_uhh, + .class = omap34xx_usb_host_hs_hwmod_class, + .main_clk = usbhost_ick, + .prcm = { + .omap2 = { + .module_offs = OMAP3430ES2_USBHOST_MOD, + .prcm_reg_id = 1, + .module_bit = 0, + .idlest_reg_id = 1, + .idlest_idle_bit = 1, + .idlest_stdby_bit = 0, + }, + }, + .slaves = omap34xx_usb_host_hs_slaves, + .slaves_cnt = ARRAY_SIZE(omap34xx_usb_host_hs_slaves), + .masters= omap34xx_usb_host_hs_masters, + .masters_cnt= ARRAY_SIZE(omap34xx_usb_host_hs_masters), + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), +}; + +/* 'usbhs_ohci' class */ +static struct omap_hwmod_ocp_if omap34xx_usbhs_ohci__l3_main_2 = { + .master = omap34xx_usbhs_ohci_hwmod, + .slave = omap3xxx_l3_main_hwmod, + .clk= core_l3_ick, + .user = OCP_USER_MPU, +}; + +static struct omap_hwmod_class omap34xx_usbhs_ohci_hwmod_class = { + .name = usbhs_ohci, +}; + +static struct omap_hwmod_ocp_if *omap34xx_usbhs_ohci_masters[] = { +
[PATCH 5/5 v5] mfd: omap: usb: Runtime PM support
From: Keshava Munegowda keshava_mgo...@ti.com The usbhs core driver does not enable/disable the interface and functional clocks; These clocks are handled by hwmod and runtime pm, hence insted of the clock enable/disable, the runtime pm APIS are used. however,the port clocks are handled by the usbhs core. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com --- arch/arm/plat-omap/include/plat/usb.h |3 - drivers/mfd/omap-usb-host.c | 731 + drivers/usb/host/ehci-omap.c | 17 +- drivers/usb/host/ohci-omap3.c | 18 +- 4 files changed, 295 insertions(+), 474 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index 17d3c93..2b66dc2 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h @@ -100,9 +100,6 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data); extern void usbhs_init(const struct usbhs_omap_board_data *pdata); -extern int omap_usbhs_enable(struct device *dev); -extern void omap_usbhs_disable(struct device *dev); - extern int omap4430_phy_power(struct device *dev, int ID, int on); extern int omap4430_phy_set_clk(struct device *dev, int on); extern int omap4430_phy_init(struct device *dev); diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 5def51c..0801f3e 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c @@ -26,6 +26,7 @@ #include linux/spinlock.h #include linux/gpio.h #include plat/usb.h +#include linux/pm_runtime.h #define USBHS_DRIVER_NAME usbhs_omap #define OMAP_EHCI_DEVICE ehci-omap @@ -146,9 +147,6 @@ struct usbhs_hcd_omap { - struct clk *usbhost_ick; - struct clk *usbhost_hs_fck; - struct clk *usbhost_fs_fck; struct clk *xclk60mhsp1_ck; struct clk *xclk60mhsp2_ck; struct clk *utmi_p1_fck; @@ -158,8 +156,6 @@ struct usbhs_hcd_omap { struct clk *usbhost_p2_fck; struct clk *usbtll_p2_fck; struct clk *init_60m_fclk; - struct clk *usbtll_fck; - struct clk *usbtll_ick; void __iomem*uhh_base; void __iomem*tll_base; @@ -168,7 +164,6 @@ struct usbhs_hcd_omap { u32 usbhs_rev; spinlock_t lock; - int count; }; /*-*/ @@ -318,269 +313,6 @@ err_end: return ret; } -/** - * usbhs_omap_probe - initialize TI-based HCDs - * - * Allocates basic resources for this USB host controller. - */ -static int __devinit usbhs_omap_probe(struct platform_device *pdev) -{ - struct device *dev = pdev-dev; - struct usbhs_omap_platform_data *pdata = dev-platform_data; - struct usbhs_hcd_omap *omap; - struct resource *res; - int ret = 0; - int i; - - if (!pdata) { - dev_err(dev, Missing platform data\n); - ret = -ENOMEM; - goto end_probe; - } - - omap = kzalloc(sizeof(*omap), GFP_KERNEL); - if (!omap) { - dev_err(dev, Memory allocation failed\n); - ret = -ENOMEM; - goto end_probe; - } - - spin_lock_init(omap-lock); - - for (i = 0; i OMAP3_HS_USB_PORTS; i++) - omap-platdata.port_mode[i] = pdata-port_mode[i]; - - omap-platdata.ehci_data = pdata-ehci_data; - omap-platdata.ohci_data = pdata-ohci_data; - - omap-usbhost_ick = clk_get(dev, usbhost_ick); - if (IS_ERR(omap-usbhost_ick)) { - ret = PTR_ERR(omap-usbhost_ick); - dev_err(dev, usbhost_ick failed error:%d\n, ret); - goto err_end; - } - - omap-usbhost_hs_fck = clk_get(dev, hs_fck); - if (IS_ERR(omap-usbhost_hs_fck)) { - ret = PTR_ERR(omap-usbhost_hs_fck); - dev_err(dev, usbhost_hs_fck failed error:%d\n, ret); - goto err_usbhost_ick; - } - - omap-usbhost_fs_fck = clk_get(dev, fs_fck); - if (IS_ERR(omap-usbhost_fs_fck)) { - ret = PTR_ERR(omap-usbhost_fs_fck); - dev_err(dev, usbhost_fs_fck failed error:%d\n, ret); - goto err_usbhost_hs_fck; - } - - omap-usbtll_fck = clk_get(dev, usbtll_fck); - if (IS_ERR(omap-usbtll_fck)) { - ret = PTR_ERR(omap-usbtll_fck); - dev_err(dev, usbtll_fck failed error:%d\n, ret); - goto err_usbhost_fs_fck; - } - -
Re: [lm-sensors] [RFC PATCH 6/6] hwmon: OMAP4: On die temperature sensor driver
On Wed, Aug 17, 2011 at 06:37:10AM -0400, J, KEERTHY wrote: [ ... ] Hi Guenter, Any inputs on the driver? Hi Keerthy. I think there was so much feedback that I would just add noise at this time, and stumble over the same issues. I'll look into it after the feedback has been applied. Thanks, Guenter -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [lm-sensors] [RFC PATCH 6/6] hwmon: OMAP4: On die temperature sensor driver
On Wed, Aug 17, 2011 at 7:15 PM, Guenter Roeck guenter.ro...@ericsson.com wrote: On Wed, Aug 17, 2011 at 06:37:10AM -0400, J, KEERTHY wrote: [ ... ] Hi Guenter, Any inputs on the driver? Hi Keerthy. I think there was so much feedback that I would just add noise at this time, and stumble over the same issues. I'll look into it after the feedback has been applied. Hi Guenter, Thanks for the response. I will resend with the comments incorporated. Thanks, Guenter -- Regards and Thanks, Keerthy -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] Media controller: Define media_entity_init() and media_entity_cleanup() conditionally
-Original Message- From: Ravi, Deepthy Sent: Wednesday, August 17, 2011 4:05 PM To: mche...@infradead.org; linux-me...@vger.kernel.org; linux- ker...@vger.kernel.org Cc: linux-omap@vger.kernel.org; Hiremath, Vaibhav; Ravi, Deepthy Subject: [PATCH] Media controller: Define media_entity_init() and media_entity_cleanup() conditionally From: Vaibhav Hiremath hvaib...@ti.com Defines the two functions only when CONFIG_MEDIA_CONTROLLER is enabled. [Hiremath, Vaibhav] Deepthy, You may want to mention about build failure without MEDIA_CONTROLLER option being enabled, especially if any sensor driver is being used between MC and non-MC framework compatible devices. For example, OMAP3 and AM3517, where TVP5146 is being used but OMAP3 is based on MC framework and AM3517 is based on simple sub-dev based interface. Thanks, Vaibhav Signed-off-by: Vaibhav Hiremath hvaib...@ti.com Signed-off-by: Deepthy Ravi deepthy.r...@ti.com --- include/media/media-entity.h |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index cd8bca6..c90916e 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -121,9 +121,18 @@ struct media_entity_graph { int top; }; +#ifdef CONFIG_MEDIA_CONTROLLER int media_entity_init(struct media_entity *entity, u16 num_pads, struct media_pad *pads, u16 extra_links); void media_entity_cleanup(struct media_entity *entity); +#else +static inline int media_entity_init(struct media_entity *entity, u16 num_pads, + struct media_pad *pads, u16 extra_links) +{ + return 0; +} +static inline void media_entity_cleanup(struct media_entity *entity) {} +#endif int media_entity_create_link(struct media_entity *source, u16 source_pad, struct media_entity *sink, u16 sink_pad, u32 flags); -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 0/7] PM QoS: add a per-device latency constraints framework
From: Jean Pihet j-pi...@ti.com High level implementation: 1. Preparation of the PM QoS for the addition of a device PM QoS constraints framework: . rename and move of the PM QoS implementation files to kernel/power/qos.c and include/linux/pm_qos.h . rename of API parameters and internal fields names . Move around the PM QoS misc devices management code for better readability . re-organize the internal data structs . generalize and export the constraints management core code 2. Implementation of the per-device PM QoS constraints: . create drivers/base/power/qos.c for the implementation . create a device PM QoS API, which calls the PM QoS constraints management core code . the per-device latency constraints data strctures are stored in the device dev_pm_info struct . the device PM code calls the init and destroy of the per-device constraints data struct in order to support the dynamic insertion and removal of the devices in the system. . to minimize the data usage by the per-device constraints, the data struct is only allocated at the first call to dev_pm_qos_add_request. The data is later free'd when the device is removed from the system . per-device notification callbacks can be registered and called upon a change to the aggregated constraint value . a global mutex protects the constraints users from the data being allocated and free'd. 3. add a global notification mechanism for the device constraints . add a global notification chain that gets called upon changes to the aggregated constraint value for any device. . the notification callbacks are passing the full constraint request data in order for the callees to have access to it. The current use is for the platform low-level code to access the target device of the constraint Questions: 1. the user space API is still under discussions on linux-omap and linux-pm MLs, cf. [1]. The idea is to add a user-space API for the devices constratins PM QoS, using a sysfs entry per device [1] http://marc.info/?l=linux-omapm=131232344503327w=2 ToDo: 1. write Documentation for the new PM QoS class, once the code is agreed on 2. submit patches for the OMAP low level code to control the power domains states from the device constraints, using a global notification callback Based on the master branch of the linux-omap git tree (3.1.0-rc1). Compile tested using OMAP and x86 generic defconfigs. Tested on OMAP3 Beagleboard (ES2.x). Need testing on platforms other than OMAP, because of the impact on the device insertion/removal in device_pm_add/remove Changelog: v6: . Split the code into the generic PM QoS code and OMAP specific code; only the PM QoS is included in this release . Added copyright in the device PM QoS code . Re-organize the code for improved readability . Changed the dev_pm_qos_* API functions type to int and improved the error checking . Added kerneldoc compliant functions headers v5: . Added a global mutex to protect the per-device data allocation/free from the users . More robust error checking in the device PM QoS code . Clean-up of the device PM QoS code: refactor some duplicated code, removal of unneeded includes v4: . Complete devices PM QoS re-design: . Separation from the existing PM QoS classes by adding a device PM QoS API. The device code is re-using the PM QoS core code for constraints lists management and notification mechanism . Addition of a devices PM QoS global notification mechanism, for interaction with the low level platform code v3: . Complete PM QoS re-design after the comments on MLs . Patch set split up for improved readability and easier maintenance v2: . Rework after comments on the mailing lists . Added a notification of device insertion/removal from the device PM framework . Validated on OMAP3 HW v1: . Initial implementation Jean Pihet (7): PM QoS: move and rename the implementation files PM QoS: minor clean-ups PM QoS: code re-organization PM QoS: re-organize data structs PM QoS: generalize and export the constraints management code PM QoS: implement the per-device PM QoS constraints PM QoS: add a global notification mechanism for the device constraints arch/arm/mach-msm/clock.c |2 +- drivers/acpi/processor_idle.c |2 +- drivers/base/power/Makefile|4 +- drivers/base/power/main.c |3 + drivers/base/power/qos.c | 400 ++ drivers/cpuidle/cpuidle.c |2 +- drivers/cpuidle/governors/ladder.c |2 +- drivers/cpuidle/governors/menu.c |2 +- drivers/media/video/via-camera.c |4 +- drivers/net/e1000e/netdev.c|2 +- drivers/net/wireless/ipw2x00/ipw2100.c |4 +- include/linux/netdevice.h |4 +- include/linux/pm.h |9 + include/linux/pm_qos.h | 147 ++
[PATCH 1/7] PM QoS: move and rename the implementation files
From: Jean Pihet j-pi...@ti.com The PM QoS implementation files are better named kernel/power/qos.c and include/linux/pm_qos.h. The PM QoS support is compiled under the CONFIG_PM option. Signed-off-by: Jean Pihet j-pi...@ti.com --- arch/arm/mach-msm/clock.c |2 +- drivers/acpi/processor_idle.c |2 +- drivers/cpuidle/cpuidle.c |2 +- drivers/cpuidle/governors/ladder.c |2 +- drivers/cpuidle/governors/menu.c |2 +- drivers/media/video/via-camera.c |2 +- drivers/net/e1000e/netdev.c|2 +- drivers/net/wireless/ipw2x00/ipw2100.c |2 +- include/linux/netdevice.h |2 +- include/linux/pm_qos.h | 61 include/linux/pm_qos_params.h | 38 --- include/sound/pcm.h|2 +- kernel/Makefile|2 +- kernel/pm_qos_params.c | 481 kernel/power/Makefile |2 +- kernel/power/qos.c | 481 net/mac80211/main.c|2 +- net/mac80211/mlme.c|2 +- net/mac80211/scan.c|2 +- sound/core/pcm_native.c|2 +- 20 files changed, 558 insertions(+), 535 deletions(-) create mode 100644 include/linux/pm_qos.h delete mode 100644 include/linux/pm_qos_params.h delete mode 100644 kernel/pm_qos_params.c create mode 100644 kernel/power/qos.c diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c index 22a5376..d9145df 100644 --- a/arch/arm/mach-msm/clock.c +++ b/arch/arm/mach-msm/clock.c @@ -18,7 +18,7 @@ #include linux/list.h #include linux/err.h #include linux/spinlock.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/mutex.h #include linux/clk.h #include linux/string.h diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 431ab11..2e69e09 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -37,7 +37,7 @@ #include linux/dmi.h #include linux/moduleparam.h #include linux/sched.h /* need_resched() */ -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/clockchips.h #include linux/cpuidle.h #include linux/irqflags.h diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index d4c5423..0df0141 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -12,7 +12,7 @@ #include linux/mutex.h #include linux/sched.h #include linux/notifier.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/cpu.h #include linux/cpuidle.h #include linux/ktime.h diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 12c9890..f62fde2 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -14,7 +14,7 @@ #include linux/kernel.h #include linux/cpuidle.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/moduleparam.h #include linux/jiffies.h diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c47f3d0..3600f19 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -12,7 +12,7 @@ #include linux/kernel.h #include linux/cpuidle.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/time.h #include linux/ktime.h #include linux/hrtimer.h diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 85d3048..b3ca389 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c @@ -21,7 +21,7 @@ #include media/videobuf-dma-sg.h #include linux/delay.h #include linux/dma-mapping.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/via-core.h #include linux/via-gpio.h #include linux/via_i2c.h diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index ab4be80..40deb44 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -47,7 +47,7 @@ #include linux/if_vlan.h #include linux/cpu.h #include linux/smp.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include linux/pm_runtime.h #include linux/aer.h #include linux/prefetch.h diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 3774dd0..aaab76c 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c @@ -161,7 +161,7 @@ that only one external action is invoked at a time. #include linux/firmware.h #include linux/acpi.h #include linux/ctype.h -#include linux/pm_qos_params.h +#include linux/pm_qos.h #include net/lib80211.h diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ddee79b..f72ac6b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -31,7 +31,7 @@ #include linux/if_link.h #ifdef __KERNEL__
[PATCH 2/7] PM QoS: minor clean-ups
From: Jean Pihet j-pi...@ti.com - Misc fixes to improve code readability: . rename struct pm_qos_request_list to struct pm_qos_request, . rename pm_qos_req parameter to req in internal code, consistenly use req in the API parameters, . update the in-kernel API callers to the new parameters names, . rename of fields names (requests, list, node, constraints) Signed-off-by: Jean Pihet j-pi...@ti.com --- drivers/media/video/via-camera.c |2 +- drivers/net/wireless/ipw2x00/ipw2100.c |2 +- include/linux/netdevice.h |2 +- include/linux/pm_qos.h | 22 include/sound/pcm.h|2 +- kernel/power/qos.c | 88 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index b3ca389..fba6c64 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c @@ -69,7 +69,7 @@ struct via_camera { struct mutex lock; enum viacam_opstate opstate; unsigned long flags; - struct pm_qos_request_list qos_request; + struct pm_qos_request qos_request; /* * GPIO info for power/reset management */ diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index aaab76c..db35f99 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c @@ -174,7 +174,7 @@ that only one external action is invoked at a time. #define DRV_DESCRIPTIONIntel(R) PRO/Wireless 2100 Network Driver #define DRV_COPYRIGHT Copyright(c) 2003-2006 Intel Corporation -static struct pm_qos_request_list ipw2100_pm_qos_req; +static struct pm_qos_request ipw2100_pm_qos_req; /* Debugging stuff */ #ifdef CONFIG_IPW2100_DEBUG diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f72ac6b..f38ab5b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -964,7 +964,7 @@ struct net_device { */ charname[IFNAMSIZ]; - struct pm_qos_request_list pm_qos_req; + struct pm_qos_request pm_qos_req; /* device name hash chain */ struct hlist_node name_hlist; diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 7ba67541..6b0968f 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -20,30 +20,30 @@ #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE0 -struct pm_qos_request_list { - struct plist_node list; +struct pm_qos_request { + struct plist_node node; int pm_qos_class; }; #ifdef CONFIG_PM -void pm_qos_add_request(struct pm_qos_request_list *l, - int pm_qos_class, s32 value); -void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, +void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, + s32 value); +void pm_qos_update_request(struct pm_qos_request *req, s32 new_value); -void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req); +void pm_qos_remove_request(struct pm_qos_request *req); int pm_qos_request(int pm_qos_class); int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); -int pm_qos_request_active(struct pm_qos_request_list *req); +int pm_qos_request_active(struct pm_qos_request *req); #else -static inline void pm_qos_add_request(struct pm_qos_request_list *l, +static inline void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, s32 value) { return; } -static inline void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, +static inline void pm_qos_update_request(struct pm_qos_request *req, s32 new_value) { return; } -static inline void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req) +static inline void pm_qos_remove_request(struct pm_qos_request *req) { return; } static inline int pm_qos_request(int pm_qos_class) @@ -54,7 +54,7 @@ static inline int pm_qos_add_notifier(int pm_qos_class, static inline int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier) { return 0; } -static inline int pm_qos_request_active(struct pm_qos_request_list *req) +static inline int pm_qos_request_active(struct pm_qos_request *req) { return 0; } #endif diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 666ee91..54cb079 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -373,7 +373,7 @@ struct snd_pcm_substream { int number; char
[PATCH 3/7] PM QoS: code re-organization
From: Jean Pihet j-pi...@ti.com Move around the PM QoS misc devices management code for better readability. Signed-off-by: Jean Pihet j-pi...@ti.com --- kernel/power/qos.c | 45 +++-- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/kernel/power/qos.c b/kernel/power/qos.c index aa52c44..788c4cf 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -188,28 +188,6 @@ static void update_target(struct pm_qos_object *o, struct plist_node *node, NULL); } -static int register_pm_qos_misc(struct pm_qos_object *qos) -{ - qos-pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR; - qos-pm_qos_power_miscdev.name = qos-name; - qos-pm_qos_power_miscdev.fops = pm_qos_power_fops; - - return misc_register(qos-pm_qos_power_miscdev); -} - -static int find_pm_qos_object_by_minor(int minor) -{ - int pm_qos_class; - - for (pm_qos_class = 0; - pm_qos_class PM_QOS_NUM_CLASSES; pm_qos_class++) { - if (minor == - pm_qos_array[pm_qos_class]-pm_qos_power_miscdev.minor) - return pm_qos_class; - } - return -1; -} - /** * pm_qos_request - returns current system wide qos expectation * @pm_qos_class: identification of which qos value is requested @@ -362,6 +340,29 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier) } EXPORT_SYMBOL_GPL(pm_qos_remove_notifier); +/* User space interface to PM QoS classes via misc devices */ +static int register_pm_qos_misc(struct pm_qos_object *qos) +{ + qos-pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR; + qos-pm_qos_power_miscdev.name = qos-name; + qos-pm_qos_power_miscdev.fops = pm_qos_power_fops; + + return misc_register(qos-pm_qos_power_miscdev); +} + +static int find_pm_qos_object_by_minor(int minor) +{ + int pm_qos_class; + + for (pm_qos_class = 0; + pm_qos_class PM_QOS_NUM_CLASSES; pm_qos_class++) { + if (minor == + pm_qos_array[pm_qos_class]-pm_qos_power_miscdev.minor) + return pm_qos_class; + } + return -1; +} + static int pm_qos_power_open(struct inode *inode, struct file *filp) { long pm_qos_class; -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/7] PM QoS: re-organize data structs
From: Jean Pihet j-pi...@ti.com In preparation for the per-device constratins support, re-organize the data strctures: - add a struct pm_qos_constraints which contains the constraints related data - update struct pm_qos_object contents to the PM QoS internal object data. Add a pointer to struct pm_qos_constraints - update the internal code to use the new data structs. Signed-off-by: Jean Pihet j-pi...@ti.com --- include/linux/pm_qos.h | 19 +++ kernel/power/qos.c | 85 +++- 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 6b0968f..9772311 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -25,6 +25,25 @@ struct pm_qos_request { int pm_qos_class; }; +enum pm_qos_type { + PM_QOS_UNITIALIZED, + PM_QOS_MAX, /* return the largest value */ + PM_QOS_MIN /* return the smallest value */ +}; + +/* + * Note: The lockless read path depends on the CPU accessing + * target_value atomically. Atomic access is only guaranteed on all CPU + * types linux supports for 32 bit quantites + */ +struct pm_qos_constraints { + struct plist_head list; + s32 target_value; /* Do not change to 64 bit */ + s32 default_value; + enum pm_qos_type type; + struct blocking_notifier_head *notifiers; +}; + #ifdef CONFIG_PM void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, s32 value); diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 788c4cf..4a35fe5 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -49,58 +49,53 @@ * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock * held, taken with _irqsave. One lock to rule them all */ -enum pm_qos_type { - PM_QOS_MAX, /* return the largest value */ - PM_QOS_MIN /* return the smallest value */ -}; - -/* - * Note: The lockless read path depends on the CPU accessing - * target_value atomically. Atomic access is only guaranteed on all CPU - * types linux supports for 32 bit quantites - */ struct pm_qos_object { - struct plist_head constraints; - struct blocking_notifier_head *notifiers; + struct pm_qos_constraints *constraints; struct miscdevice pm_qos_power_miscdev; char *name; - s32 target_value; /* Do not change to 64 bit */ - s32 default_value; - enum pm_qos_type type; }; static DEFINE_SPINLOCK(pm_qos_lock); static struct pm_qos_object null_pm_qos; + static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier); -static struct pm_qos_object cpu_dma_pm_qos = { - .constraints = PLIST_HEAD_INIT(cpu_dma_pm_qos.constraints), - .notifiers = cpu_dma_lat_notifier, - .name = cpu_dma_latency, +static struct pm_qos_constraints cpu_dma_constraints = { + .list = PLIST_HEAD_INIT(cpu_dma_constraints.list), .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, .type = PM_QOS_MIN, + .notifiers = cpu_dma_lat_notifier, +}; +static struct pm_qos_object cpu_dma_pm_qos = { + .constraints = cpu_dma_constraints, }; static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); -static struct pm_qos_object network_lat_pm_qos = { - .constraints = PLIST_HEAD_INIT(network_lat_pm_qos.constraints), - .notifiers = network_lat_notifier, - .name = network_latency, +static struct pm_qos_constraints network_lat_constraints = { + .list = PLIST_HEAD_INIT(network_lat_constraints.list), .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, - .type = PM_QOS_MIN + .type = PM_QOS_MIN, + .notifiers = network_lat_notifier, +}; +static struct pm_qos_object network_lat_pm_qos = { + .constraints = network_lat_constraints, + .name = network_latency, }; static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier); -static struct pm_qos_object network_throughput_pm_qos = { - .constraints = PLIST_HEAD_INIT(network_throughput_pm_qos.constraints), - .notifiers = network_throughput_notifier, - .name = network_throughput, +static struct pm_qos_constraints network_tput_constraints = { + .list = PLIST_HEAD_INIT(network_tput_constraints.list), .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, .type = PM_QOS_MAX, + .notifiers = network_throughput_notifier, +}; +static struct pm_qos_object network_throughput_pm_qos = { + .constraints = network_tput_constraints, + .name = network_throughput, }; @@ -129,15 +124,15 @@ static const struct file_operations pm_qos_power_fops = { /* unlocked internal variant */ static inline int pm_qos_get_value(struct pm_qos_object *o) { - if
[PATCH 5/7] PM QoS: generalize and export the constraints management code
From: Jean Pihet j-pi...@ti.com In preparation for the per-device constratins support: - rename update_target to pm_qos_update_target - generalize and export pm_qos_update_target for usage by the upcoming per-device latency constraints framework: . operate on struct pm_qos_constraints for constraints management, . introduce an 'action' parameter for constraints add/update/remove, . the return value indicates if the aggregated constraint value has changed, - update the internal code to operate on struct pm_qos_constraints - add a NULL pointer check in the API functions Signed-off-by: Jean Pihet j-pi...@ti.com --- include/linux/pm_qos.h | 14 ++ kernel/power/qos.c | 123 ++-- 2 files changed, 81 insertions(+), 56 deletions(-) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 9772311..84aa150 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -44,7 +44,16 @@ struct pm_qos_constraints { struct blocking_notifier_head *notifiers; }; +/* Action requested to pm_qos_update_target */ +enum pm_qos_req_action { + PM_QOS_ADD_REQ, /* Add a new request */ + PM_QOS_UPDATE_REQ, /* Update an existing request */ + PM_QOS_REMOVE_REQ /* Remove an existing request */ +}; + #ifdef CONFIG_PM +int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, +enum pm_qos_req_action action, int value); void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, s32 value); void pm_qos_update_request(struct pm_qos_request *req, @@ -56,6 +65,11 @@ int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier); int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); int pm_qos_request_active(struct pm_qos_request *req); #else +static inline int pm_qos_update_target(struct pm_qos_constraints *c, + struct plist_node *node, + enum pm_qos_req_action action, + int value) + { return 0; } static inline void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, s32 value) { return; } diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 4a35fe5..7c7cd18 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -122,17 +122,17 @@ static const struct file_operations pm_qos_power_fops = { }; /* unlocked internal variant */ -static inline int pm_qos_get_value(struct pm_qos_object *o) +static inline int pm_qos_get_value(struct pm_qos_constraints *c) { - if (plist_head_empty(o-constraints-list)) - return o-constraints-default_value; + if (plist_head_empty(c-list)) + return c-default_value; - switch (o-constraints-type) { + switch (c-type) { case PM_QOS_MIN: - return plist_first(o-constraints-list)-prio; + return plist_first(c-list)-prio; case PM_QOS_MAX: - return plist_last(o-constraints-list)-prio; + return plist_last(c-list)-prio; default: /* runtime check for not using enum */ @@ -140,47 +140,73 @@ static inline int pm_qos_get_value(struct pm_qos_object *o) } } -static inline s32 pm_qos_read_value(struct pm_qos_object *o) +static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) { - return o-constraints-target_value; + return c-target_value; } -static inline void pm_qos_set_value(struct pm_qos_object *o, s32 value) +static inline void pm_qos_set_value(struct pm_qos_constraints *c, s32 value) { - o-constraints-target_value = value; + c-target_value = value; } -static void update_target(struct pm_qos_object *o, struct plist_node *node, - int del, int value) +/** + * pm_qos_update_target - manages the constraints list and calls the notifiers + * if needed + * @c: constraints data struct + * @node: request to add to the list, to update or to remove + * @action: action to take on the constraints list + * @value: value of the request to add or update + * + * This function returns 1 if the aggregated constraint value has changed, 0 + * otherwise. + */ +int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, +enum pm_qos_req_action action, int value) { unsigned long flags; - int prev_value, curr_value; + int prev_value, curr_value, new_value; spin_lock_irqsave(pm_qos_lock, flags); - prev_value = pm_qos_get_value(o); - /* PM_QOS_DEFAULT_VALUE is a signal that the value is unchanged */ - if (value != PM_QOS_DEFAULT_VALUE) { + prev_value = pm_qos_get_value(c); + if (value == PM_QOS_DEFAULT_VALUE) + new_value = c-default_value;
[PATCH 6/7] PM QoS: implement the per-device PM QoS constraints
From: Jean Pihet j-pi...@ti.com Implement the per-device PM QoS constraints by creating a device PM QoS API, which calls the PM QoS constraints management core code. The per-device latency constraints data strctures are stored in the device dev_pm_info struct. The device PM code calls the init and destroy of the per-device constraints data struct in order to support the dynamic insertion and removal of the devices in the system. To minimize the data usage by the per-device constraints, the data struct is only allocated at the first call to dev_pm_qos_add_request. The data is later free'd when the device is removed from the system. A global mutex protects the constraints users from the data being allocated and free'd. Signed-off-by: Jean Pihet j-pi...@ti.com --- drivers/base/power/Makefile |4 +- drivers/base/power/main.c |3 + drivers/base/power/qos.c| 339 +++ include/linux/pm.h |9 + include/linux/pm_qos.h | 42 ++ 5 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 drivers/base/power/qos.c diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile index 2639ae7..b707447 100644 --- a/drivers/base/power/Makefile +++ b/drivers/base/power/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_PM) += sysfs.o generic_ops.o +obj-$(CONFIG_PM) += sysfs.o generic_ops.o qos.o obj-$(CONFIG_PM_SLEEP) += main.o wakeup.o obj-$(CONFIG_PM_RUNTIME) += runtime.o obj-$(CONFIG_PM_TRACE_RTC) += trace.o @@ -6,4 +6,4 @@ obj-$(CONFIG_PM_OPP)+= opp.o obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o obj-$(CONFIG_HAVE_CLK) += clock_ops.o -ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG \ No newline at end of file +ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index a854591..956443f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -22,6 +22,7 @@ #include linux/mutex.h #include linux/pm.h #include linux/pm_runtime.h +#include linux/pm_qos.h #include linux/resume-trace.h #include linux/interrupt.h #include linux/sched.h @@ -97,6 +98,7 @@ void device_pm_add(struct device *dev) dev_name(dev-parent)); list_add_tail(dev-power.entry, dpm_list); mutex_unlock(dpm_list_mtx); + dev_pm_qos_constraints_init(dev); } /** @@ -107,6 +109,7 @@ void device_pm_remove(struct device *dev) { pr_debug(PM: Removing info for %s:%s\n, dev-bus ? dev-bus-name : No Bus, dev_name(dev)); + dev_pm_qos_constraints_destroy(dev); complete_all(dev-power.completion); mutex_lock(dpm_list_mtx); list_del_init(dev-power.entry); diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c new file mode 100644 index 000..9c0a00d --- /dev/null +++ b/drivers/base/power/qos.c @@ -0,0 +1,339 @@ +/* + * Devices PM QoS constraints management + * + * 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 module exposes the interface to kernel space for specifying + * per-device PM QoS dependencies. It provides infrastructure for registration + * of: + * + * Dependents on a QoS value : register requests + * Watchers of QoS value : get notified when target QoS value changes + * + * This QoS design is best effort based. Dependents register their QoS needs. + * Watchers register to keep track of the current QoS needs of the system. + * + * Note about the per-device constraint data struct allocation: + * . The per-device constraints data struct ptr is tored into the device + *dev_pm_info. + * . To minimize the data usage by the per-device constraints, the data struct + * is only allocated at the first call to dev_pm_qos_add_request. + * . The data is later free'd when the device is removed from the system. + * . The constraints_state variable from dev_pm_info tracks the data struct + *allocation state: + *DEV_PM_QOS_NO_DEVICE: No device present or device removed, no data + * allocated, + *DEV_PM_QOS_DEVICE_PRESENT: Device present, data not allocated and will be + * allocated at the first call to dev_pm_qos_add_request, + *DEV_PM_QOS_ALLOCATED: Device present, data allocated. The per-device + * PM QoS constraints framework is operational and constraints can be + * added, updated or removed using the dev_pm_qos_* API. + * . A global mutex protects the constraints users from the data being + * allocated and free'd. + */ + +#include linux/pm_qos.h +#include linux/spinlock.h +#include linux/slab.h +#include linux/device.h +#include linux/mutex.h + + +static DEFINE_MUTEX(dev_pm_qos_mtx); + +/* + * dev_pm_qos_constraints_allocate + * @dev: device to allocate data for + * + * Called at the first call to add_request, for
[PATCH 7/7] PM QoS: add a global notification mechanism for the device constraints
From: Jean Pihet j-pi...@ti.com Add a global notification chain that gets called upon changes to the aggregated constraint value for any device. The notification callbacks are passing the full constraint request data in order for the callees to have access to it. The current use is for the platform low-level code to access the target device of the constraint. Signed-off-by: Jean Pihet j-pi...@ti.com --- drivers/base/power/qos.c | 89 ++--- include/linux/pm_qos.h | 11 ++ kernel/power/qos.c |2 +- 3 files changed, 87 insertions(+), 15 deletions(-) diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 9c0a00d..708d86d 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -17,6 +17,12 @@ * * This QoS design is best effort based. Dependents register their QoS needs. * Watchers register to keep track of the current QoS needs of the system. + * Watchers can register different types of notification callbacks: + * . a per-device notification callback using the dev_pm_qos_*_notifier API. + *The notification chain data is stored in the per-device constraint + *data struct. + * . a system-wide notification callback using the dev_pm_qos_*_global_notifier + *API. The notification chain data is stored in a static variable. * * Note about the per-device constraint data struct allocation: * . The per-device constraints data struct ptr is tored into the device @@ -45,6 +51,36 @@ static DEFINE_MUTEX(dev_pm_qos_mtx); +static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); + +/* + * apply_constraint + * @req: constraint request to apply + * @action: action to perform add/update/remove, of type enum pm_qos_req_action + * @value: defines the qos request + * + * Internal function to update the constraints list using the PM QoS core + * code and if needed call the per-device and the global notification + * callbacks + */ +static int apply_constraint(struct dev_pm_qos_request *req, + enum pm_qos_req_action action, int value) +{ + int ret, curr_value; + + ret = pm_qos_update_target(req-dev-power.constraints, + req-node, action, value); + + if (ret) { + /* Call the global callbacks if needed */ + curr_value = pm_qos_read_value(req-dev-power.constraints); + blocking_notifier_call_chain(dev_pm_notifiers, +(unsigned long)curr_value, +req); + } + + return ret; +} /* * dev_pm_qos_constraints_allocate @@ -111,12 +147,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev) dev-power.constraints-list, node) { /* -* Update constraints list and call the per-device +* Update constraints list and call the notification * callbacks if needed */ - pm_qos_update_target(req-dev-power.constraints, - req-node, PM_QOS_REMOVE_REQ, - PM_QOS_DEFAULT_VALUE); + apply_constraint(req, PM_QOS_REMOVE_REQ, +PM_QOS_DEFAULT_VALUE); memset(req, 0, sizeof(*req)); } @@ -147,7 +182,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev) * removed from the system */ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, - s32 value) + s32 value) { int ret = 0; @@ -178,8 +213,7 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, ret = dev_pm_qos_constraints_allocate(dev); if (!ret) - ret = pm_qos_update_target(dev-power.constraints, req-node, - PM_QOS_ADD_REQ, value); + ret = apply_constraint(req, PM_QOS_ADD_REQ, value); out: mutex_unlock(dev_pm_qos_mtx); @@ -220,10 +254,8 @@ int dev_pm_qos_update_request(struct dev_pm_qos_request *req, if (req-dev-power.constraints_state == DEV_PM_QOS_ALLOCATED) { if (new_value != req-node.prio) - ret = pm_qos_update_target(req-dev-power.constraints, - req-node, - PM_QOS_UPDATE_REQ, - new_value); + ret = apply_constraint(req, PM_QOS_UPDATE_REQ, + new_value); } else { /* Return if the device has been removed */ ret = -ENODEV; @@ -262,9 +294,8 @@ int
[PATCH 1/7] omap: iommu: migrate to the generic IOMMU API
Migrate OMAP's iommu driver to the generic IOMMU API, so users can stay generic, and any generic IOMMU functionality can be developed once in the generic framework. Migrate omap's iovmm (virtual memory manager) to the generic IOMMU API, and adapt omap3isp as needed, so the latter won't break. The plan is to eventually remove iovmm completely by replacing it with the (upcoming) IOMMU-based DMA-API. Tested on OMAP3 (with omap3isp) and OMAP4 (with rpmsg/remoteproc). Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/plat-omap/Kconfig |4 +- arch/arm/plat-omap/include/plat/iommu.h |3 +- arch/arm/plat-omap/include/plat/iovmm.h | 27 ++-- arch/arm/plat-omap/iommu.c | 295 +++ arch/arm/plat-omap/iopgtable.h | 18 ++ arch/arm/plat-omap/iovmm.c | 115 +++- drivers/media/video/omap3isp/isp.c | 41 - drivers/media/video/omap3isp/isp.h |3 + drivers/media/video/omap3isp/ispccdc.c | 16 +- drivers/media/video/omap3isp/ispstat.c |6 +- drivers/media/video/omap3isp/ispvideo.c |4 +- 11 files changed, 414 insertions(+), 118 deletions(-) diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index bb8f4a6..e1e954d 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,8 +132,10 @@ config OMAP_MBOX_KFIFO_SIZE This can also be changed at runtime (via the mbox_kfifo_size module parameter). +#can't be tristate; iommu api doesn't support un-registration config OMAP_IOMMU - tristate + bool + select IOMMU_API config OMAP_IOMMU_DEBUG tristate Export OMAP IOMMU internals in DebugFS diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index 174f1b9..db1c492 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h @@ -167,8 +167,6 @@ extern void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, extern size_t iopgtable_clear_entry(struct iommu *obj, u32 iova); extern int iommu_set_da_range(struct iommu *obj, u32 start, u32 end); -extern struct iommu *iommu_get(const char *name); -extern void iommu_put(struct iommu *obj); extern int iommu_set_isr(const char *name, int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, void *priv), @@ -185,5 +183,6 @@ extern int foreach_iommu_device(void *data, extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len); extern size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t len); +struct device *omap_find_iommu_device(const char *name); #endif /* __MACH_IOMMU_H */ diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h index e992b96..e2f0b38 100644 --- a/arch/arm/plat-omap/include/plat/iovmm.h +++ b/arch/arm/plat-omap/include/plat/iovmm.h @@ -13,6 +13,8 @@ #ifndef __IOMMU_MMAP_H #define __IOMMU_MMAP_H +#include linux/iommu.h + struct iovm_struct { struct iommu*iommu; /* iommu object which this belongs to */ u32 da_start; /* area definition */ @@ -71,18 +73,21 @@ struct iovm_struct { extern struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da); -extern u32 iommu_vmap(struct iommu *obj, u32 da, +extern u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, const struct sg_table *sgt, u32 flags); -extern struct sg_table *iommu_vunmap(struct iommu *obj, u32 da); -extern u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, - u32 flags); -extern void iommu_vfree(struct iommu *obj, const u32 da); -extern u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes, - u32 flags); -extern void iommu_kunmap(struct iommu *obj, u32 da); -extern u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, - u32 flags); -extern void iommu_kfree(struct iommu *obj, u32 da); +extern struct sg_table *iommu_vunmap(struct iommu_domain *domain, + struct iommu *obj, u32 da); +extern u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, + u32 da, size_t bytes, u32 flags); +extern void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, + const u32 da); +extern u32 iommu_kmap(struct iommu_domain *domain, struct iommu *obj, u32 da, + u32 pa, size_t bytes, u32 flags); +extern void iommu_kunmap(struct iommu_domain *domain, struct iommu *obj, + u32 da); +extern u32 iommu_kmalloc(struct iommu_domain *domain, struct iommu *obj, + u32 da, size_t bytes, u32 flags); +extern void iommu_kfree(struct iommu_domain *domain, struct iommu *obj, u32 da); extern void *da_to_va(struct iommu *obj,
[PATCH 2/7] omap: iommu/iovmm: move to dedicated iommu folder
Move OMAP's iommu drivers to the dedicated iommu drivers folder. While OMAP's iovmm (virtual memory manager) driver does not strictly belong to the iommu drivers folder, move it there as well, because it's by no means OMAP-specific (in concept. technically it is still coupled with OMAP's iommu). Eventually, iovmm will be completely replaced with the generic, iommu-based, dma-mapping API. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/plat-omap/Kconfig | 14 -- arch/arm/plat-omap/Makefile|2 -- arch/arm/plat-omap/{ = include/plat}/iopgtable.h |0 drivers/iommu/Kconfig | 18 ++ drivers/iommu/Makefile |3 +++ .../iommu/omap-iommu-debug.c |2 +- .../iommu.c = drivers/iommu/omap-iommu.c |2 +- .../iovmm.c = drivers/iommu/omap-iovmm.c |2 +- drivers/media/video/Kconfig|2 +- 9 files changed, 25 insertions(+), 20 deletions(-) rename arch/arm/plat-omap/{ = include/plat}/iopgtable.h (100%) rename arch/arm/plat-omap/iommu-debug.c = drivers/iommu/omap-iommu-debug.c (99%) rename arch/arm/plat-omap/iommu.c = drivers/iommu/omap-iommu.c (99%) rename arch/arm/plat-omap/iovmm.c = drivers/iommu/omap-iovmm.c (99%) diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index e1e954d..fa62037 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,20 +132,6 @@ config OMAP_MBOX_KFIFO_SIZE This can also be changed at runtime (via the mbox_kfifo_size module parameter). -#can't be tristate; iommu api doesn't support un-registration -config OMAP_IOMMU - bool - select IOMMU_API - -config OMAP_IOMMU_DEBUG - tristate Export OMAP IOMMU internals in DebugFS - depends on OMAP_IOMMU DEBUG_FS - help - Select this to see extensive information about - the internal state of OMAP IOMMU in debugfs. - - Say N unless you know you need this. - config OMAP_IOMMU_IVA2 bool diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index f0233e6..9852622 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile @@ -18,8 +18,6 @@ obj-$(CONFIG_ARCH_OMAP3) += omap_device.o obj-$(CONFIG_ARCH_OMAP4) += omap_device.o obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o -obj-$(CONFIG_OMAP_IOMMU) += iommu.o iovmm.o -obj-$(CONFIG_OMAP_IOMMU_DEBUG) += iommu-debug.o obj-$(CONFIG_CPU_FREQ) += cpu-omap.o obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o diff --git a/arch/arm/plat-omap/iopgtable.h b/arch/arm/plat-omap/include/plat/iopgtable.h similarity index 100% rename from arch/arm/plat-omap/iopgtable.h rename to arch/arm/plat-omap/include/plat/iopgtable.h diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index b57b3fa..432463b 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -107,4 +107,22 @@ config INTR_REMAP To use x2apic mode in the CPU's which support x2APIC enhancements or to support platforms with CPU's having 8 bit APIC ID, say Y. +# OMAP IOMMU support +config OMAP_IOMMU + bool OMAP IOMMU Support + select IOMMU_API + +config OMAP_IOVMM + tristate + select OMAP_IOMMU + +config OMAP_IOMMU_DEBUG + tristate Export OMAP IOMMU/IOVMM internals in DebugFS + depends on OMAP_IOVMM DEBUG_FS + help + Select this to see extensive information about + the internal state of OMAP IOMMU/IOVMM in debugfs. + + Say N unless you know you need this. + endif # IOMMU_SUPPORT diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index 4d4d77d..f798cdd 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -3,3 +3,6 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o +obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o +obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o +obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o diff --git a/arch/arm/plat-omap/iommu-debug.c b/drivers/iommu/omap-iommu-debug.c similarity index 99% rename from arch/arm/plat-omap/iommu-debug.c rename to drivers/iommu/omap-iommu-debug.c index f07cf2f..0f8c8dd 100644 --- a/arch/arm/plat-omap/iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -21,7 +21,7 @@ #include plat/iommu.h #include plat/iovmm.h -#include iopgtable.h +#include plat/iopgtable.h #define MAXCOLUMN 100 /* for short messages */ diff --git a/arch/arm/plat-omap/iommu.c b/drivers/iommu/omap-iommu.c similarity index 99% rename from arch/arm/plat-omap/iommu.c rename to drivers/iommu/omap-iommu.c index 70a271c..ffd1b27 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -25,7 +25,7 @@ #include plat/iommu.h -#include iopgtable.h +#include
[PATCH 3/7] omap: iommu: stop exporting local functions
Stop exporting functions that are used only within the iommu driver itself. Eventually OMAP's iommu driver should only expose API via the generic IOMMU framework. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/plat-omap/include/plat/iommu.h |8 drivers/iommu/omap-iommu.c | 19 +++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index db1c492..961b64f 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h @@ -153,18 +153,10 @@ struct iommu_platform_data { extern u32 iommu_arch_version(void); extern void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); -extern u32 iotlb_cr_to_virt(struct cr_regs *cr); - -extern int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e); extern void iommu_set_twl(struct iommu *obj, bool on); -extern void flush_iotlb_page(struct iommu *obj, u32 da); extern void flush_iotlb_range(struct iommu *obj, u32 start, u32 end); -extern void flush_iotlb_all(struct iommu *obj); extern int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e); -extern void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, - u32 **ppte); -extern size_t iopgtable_clear_entry(struct iommu *obj, u32 iova); extern int iommu_set_da_range(struct iommu *obj, u32 start, u32 end); extern int iommu_set_isr(const char *name, diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index ffd1b27..ed81977 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -170,11 +170,10 @@ static inline struct cr_regs *iotlb_alloc_cr(struct iommu *obj, return arch_iommu-alloc_cr(obj, e); } -u32 iotlb_cr_to_virt(struct cr_regs *cr) +static u32 iotlb_cr_to_virt(struct cr_regs *cr) { return arch_iommu-cr_to_virt(cr); } -EXPORT_SYMBOL_GPL(iotlb_cr_to_virt); static u32 get_iopte_attr(struct iotlb_entry *e) { @@ -253,7 +252,7 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) * @obj: target iommu * @e: an iommu tlb entry info **/ -int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) +static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) { int err = 0; struct iotlb_lock l; @@ -309,7 +308,6 @@ out: clk_disable(obj-clk); return err; } -EXPORT_SYMBOL_GPL(load_iotlb_entry); /** * flush_iotlb_page - Clear an iommu tlb entry @@ -318,7 +316,7 @@ EXPORT_SYMBOL_GPL(load_iotlb_entry); * * Clear an iommu tlb entry which includes 'da' address. **/ -void flush_iotlb_page(struct iommu *obj, u32 da) +static void flush_iotlb_page(struct iommu *obj, u32 da) { int i; struct cr_regs cr; @@ -347,7 +345,6 @@ void flush_iotlb_page(struct iommu *obj, u32 da) if (i == obj-nr_tlb_entries) dev_dbg(obj-dev, %s: no page for %08x\n, __func__, da); } -EXPORT_SYMBOL_GPL(flush_iotlb_page); /** * flush_iotlb_range - Clear an iommu tlb entries @@ -373,7 +370,7 @@ EXPORT_SYMBOL_GPL(flush_iotlb_range); * flush_iotlb_all - Clear all iommu tlb entries * @obj: target iommu **/ -void flush_iotlb_all(struct iommu *obj) +static void flush_iotlb_all(struct iommu *obj) { struct iotlb_lock l; @@ -387,7 +384,6 @@ void flush_iotlb_all(struct iommu *obj) clk_disable(obj-clk); } -EXPORT_SYMBOL_GPL(flush_iotlb_all); /** * iommu_set_twl - enable/disable table walking logic @@ -681,7 +677,8 @@ EXPORT_SYMBOL_GPL(iopgtable_store_entry); * @ppgd: iommu pgd entry pointer to be returned * @ppte: iommu pte entry pointer to be returned **/ -void iopgtable_lookup_entry(struct iommu *obj, u32 da, u32 **ppgd, u32 **ppte) +static void +iopgtable_lookup_entry(struct omap_iommu *obj, u32 da, u32 **ppgd, u32 **ppte) { u32 *iopgd, *iopte = NULL; @@ -695,7 +692,6 @@ out: *ppgd = iopgd; *ppte = iopte; } -EXPORT_SYMBOL_GPL(iopgtable_lookup_entry); static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) { @@ -750,7 +746,7 @@ out: * @obj: target iommu * @da:iommu device virtual address **/ -size_t iopgtable_clear_entry(struct iommu *obj, u32 da) +static size_t iopgtable_clear_entry(struct iommu *obj, u32 da) { size_t bytes; @@ -763,7 +759,6 @@ size_t iopgtable_clear_entry(struct iommu *obj, u32 da) return bytes; } -EXPORT_SYMBOL_GPL(iopgtable_clear_entry); static void iopgtable_clear_entry_all(struct iommu *obj) { -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/7] omap: iommu: PREFETCH_IOTLB cleanup
Use PREFETCH_IOTLB to control the content of the called function, instead of inlining it in the code. This improves readability of the code, and also prevents an unused function warning to show up when PREFETCH_IOTLB isn't set. While we're at it, rename load_iotlb_entry to prefetch_iotlb_entry to better reflect the purpose of that function. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- drivers/iommu/omap-iommu.c | 18 +- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index ed81977..7280e5b 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -248,11 +248,12 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) } /** - * load_iotlb_entry - Set an iommu tlb entry + * prefetch_iotlb_entry - Set an iommu tlb entry * @obj: target iommu * @e: an iommu tlb entry info **/ -static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) +#ifdef PREFETCH_IOTLB +static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) { int err = 0; struct iotlb_lock l; @@ -309,6 +310,15 @@ out: return err; } +#else /* !PREFETCH_IOTLB */ + +static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) +{ + return 0; +} + +#endif /* !PREFETCH_IOTLB */ + /** * flush_iotlb_page - Clear an iommu tlb entry * @obj: target iommu @@ -662,10 +672,8 @@ int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) flush_iotlb_page(obj, e-da); err = iopgtable_store_entry_core(obj, e); -#ifdef PREFETCH_IOTLB if (!err) - load_iotlb_entry(obj, e); -#endif + prefetch_iotlb_entry(obj, e); return err; } EXPORT_SYMBOL_GPL(iopgtable_store_entry); -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/7] omap: iommu: remove unused exported API
Remove unused public APIs from OMAP's iommu driver. IOMMU functionality should be exposed only via the generic IOMMU API; this way drivers stay generic, and different IOMMU drivers don't need to duplicate similar functionalities. The rest of the API still exposed by OMAP's iommu will be evaluated and eventually either added to the generic IOMMU API (if relevant), or completely removed. The intention is that OMAP's iommu driver will eventually not expose any public API. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/plat-omap/include/plat/iommu.h |3 -- drivers/iommu/omap-iommu.c | 59 --- 2 files changed, 0 insertions(+), 62 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index 961b64f..eed5bdc 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h @@ -153,12 +153,9 @@ struct iommu_platform_data { extern u32 iommu_arch_version(void); extern void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); -extern void iommu_set_twl(struct iommu *obj, bool on); -extern void flush_iotlb_range(struct iommu *obj, u32 start, u32 end); extern int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e); -extern int iommu_set_da_range(struct iommu *obj, u32 start, u32 end); extern int iommu_set_isr(const char *name, int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, void *priv), diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 7280e5b..d6b77c4 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -357,26 +357,6 @@ static void flush_iotlb_page(struct iommu *obj, u32 da) } /** - * flush_iotlb_range - Clear an iommu tlb entries - * @obj: target iommu - * @start: iommu device virtual address(start) - * @end: iommu device virtual address(end) - * - * Clear an iommu tlb entry which includes 'da' address. - **/ -void flush_iotlb_range(struct iommu *obj, u32 start, u32 end) -{ - u32 da = start; - - while (da end) { - flush_iotlb_page(obj, da); - /* FIXME: Optimize for multiple page size */ - da += IOPTE_SIZE; - } -} -EXPORT_SYMBOL_GPL(flush_iotlb_range); - -/** * flush_iotlb_all - Clear all iommu tlb entries * @obj: target iommu **/ @@ -395,23 +375,6 @@ static void flush_iotlb_all(struct iommu *obj) clk_disable(obj-clk); } -/** - * iommu_set_twl - enable/disable table walking logic - * @obj: target iommu - * @on:enable/disable - * - * Function used to enable/disable TWL. If one wants to work - * exclusively with locked TLB entries and receive notifications - * for TLB miss then call this function to disable TWL. - */ -void iommu_set_twl(struct iommu *obj, bool on) -{ - clk_enable(obj-clk); - arch_iommu-set_twl(obj, on); - clk_disable(obj-clk); -} -EXPORT_SYMBOL_GPL(iommu_set_twl); - #if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) @@ -848,28 +811,6 @@ static int device_match_by_alias(struct device *dev, void *data) } /** - * iommu_set_da_range - Set a valid device address range - * @obj: target iommu - * @start Start of valid range - * @endEnd of valid range - **/ -int iommu_set_da_range(struct iommu *obj, u32 start, u32 end) -{ - - if (!obj) - return -EFAULT; - - if (end start || !PAGE_ALIGN(start | end)) - return -EINVAL; - - obj-da_start = start; - obj-da_end = end; - - return 0; -} -EXPORT_SYMBOL_GPL(iommu_set_da_range); - -/** * omap_find_iommu_device() - find an omap iommu device by name * @name: name of the iommu device * -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/7] omap: iommu: omapify 'struct iommu' and exposed API
Prepend 'omap_' to OMAP's 'struct iommu' and exposed API, to prevent namespace pollution and generally to improve readability of the code that still uses the driver directly. Update the users as needed as well. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/mach-omap2/iommu2.c| 31 +++--- arch/arm/plat-omap/include/plat/iommu.h | 55 ++- arch/arm/plat-omap/include/plat/iommu2.h|4 +- arch/arm/plat-omap/include/plat/iopgtable.h |2 +- arch/arm/plat-omap/include/plat/iovmm.h | 19 ++-- drivers/iommu/omap-iommu-debug.c| 34 +++--- drivers/iommu/omap-iommu.c | 144 ++- drivers/iommu/omap-iovmm.c | 62 ++-- drivers/media/video/omap3isp/isp.c |6 +- drivers/media/video/omap3isp/isp.h |2 +- drivers/media/video/omap3isp/ispccdc.c | 23 +++-- drivers/media/video/omap3isp/ispstat.c |9 +- drivers/media/video/omap3isp/ispvideo.c |4 +- 13 files changed, 207 insertions(+), 188 deletions(-) diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c index f286012..eefc379 100644 --- a/arch/arm/mach-omap2/iommu2.c +++ b/arch/arm/mach-omap2/iommu2.c @@ -66,7 +66,7 @@ ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xf000 : 0) -static void __iommu_set_twl(struct iommu *obj, bool on) +static void __iommu_set_twl(struct omap_iommu *obj, bool on) { u32 l = iommu_read_reg(obj, MMU_CNTL); @@ -85,7 +85,7 @@ static void __iommu_set_twl(struct iommu *obj, bool on) } -static int omap2_iommu_enable(struct iommu *obj) +static int omap2_iommu_enable(struct omap_iommu *obj) { u32 l, pa; unsigned long timeout; @@ -127,7 +127,7 @@ static int omap2_iommu_enable(struct iommu *obj) return 0; } -static void omap2_iommu_disable(struct iommu *obj) +static void omap2_iommu_disable(struct omap_iommu *obj) { u32 l = iommu_read_reg(obj, MMU_CNTL); @@ -138,12 +138,12 @@ static void omap2_iommu_disable(struct iommu *obj) dev_dbg(obj-dev, %s is shutting down\n, obj-name); } -static void omap2_iommu_set_twl(struct iommu *obj, bool on) +static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on) { __iommu_set_twl(obj, false); } -static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) +static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra) { u32 stat, da; u32 errs = 0; @@ -173,13 +173,13 @@ static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) return errs; } -static void omap2_tlb_read_cr(struct iommu *obj, struct cr_regs *cr) +static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr) { cr-cam = iommu_read_reg(obj, MMU_READ_CAM); cr-ram = iommu_read_reg(obj, MMU_READ_RAM); } -static void omap2_tlb_load_cr(struct iommu *obj, struct cr_regs *cr) +static void omap2_tlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr) { iommu_write_reg(obj, cr-cam | MMU_CAM_V, MMU_CAM); iommu_write_reg(obj, cr-ram, MMU_RAM); @@ -193,7 +193,8 @@ static u32 omap2_cr_to_virt(struct cr_regs *cr) return cr-cam mask; } -static struct cr_regs *omap2_alloc_cr(struct iommu *obj, struct iotlb_entry *e) +static struct cr_regs *omap2_alloc_cr(struct omap_iommu *obj, + struct iotlb_entry *e) { struct cr_regs *cr; @@ -230,7 +231,8 @@ static u32 omap2_get_pte_attr(struct iotlb_entry *e) return attr; } -static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf) +static ssize_t +omap2_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, char *buf) { char *p = buf; @@ -254,7 +256,8 @@ static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf) goto out; \ } while (0) -static ssize_t omap2_iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len) +static ssize_t +omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len) { char *p = buf; @@ -280,7 +283,7 @@ out: return p - buf; } -static void omap2_iommu_save_ctx(struct iommu *obj) +static void omap2_iommu_save_ctx(struct omap_iommu *obj) { int i; u32 *p = obj-ctx; @@ -293,7 +296,7 @@ static void omap2_iommu_save_ctx(struct iommu *obj) BUG_ON(p[0] != IOMMU_ARCH_VERSION); } -static void omap2_iommu_restore_ctx(struct iommu *obj) +static void omap2_iommu_restore_ctx(struct omap_iommu *obj) { int i; u32 *p = obj-ctx; @@ -343,13 +346,13 @@ static const struct iommu_functions omap2_iommu_ops = { static int __init omap2_iommu_init(void) { - return install_iommu_arch(omap2_iommu_ops); + return omap_install_iommu_arch(omap2_iommu_ops); } module_init(omap2_iommu_init); static void __exit omap2_iommu_exit(void) { - uninstall_iommu_arch(omap2_iommu_ops);
[PATCH 5/7] omap: iovmm: remove unused functionality
Remove unused functionality from OMAP's iovmm module. The intention is to eventually completely replace iovmm with the generic DMA-API, so new code that'd need this iovmm functionality will have to extend the DMA-API instead. Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- arch/arm/plat-omap/include/plat/iovmm.h |8 -- drivers/iommu/omap-iovmm.c | 167 --- 2 files changed, 0 insertions(+), 175 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h index e2f0b38..fc9aa6f 100644 --- a/arch/arm/plat-omap/include/plat/iovmm.h +++ b/arch/arm/plat-omap/include/plat/iovmm.h @@ -81,14 +81,6 @@ extern u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, u32 da, size_t bytes, u32 flags); extern void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da); -extern u32 iommu_kmap(struct iommu_domain *domain, struct iommu *obj, u32 da, - u32 pa, size_t bytes, u32 flags); -extern void iommu_kunmap(struct iommu_domain *domain, struct iommu *obj, - u32 da); -extern u32 iommu_kmalloc(struct iommu_domain *domain, struct iommu *obj, - u32 da, size_t bytes, u32 flags); -extern void iommu_kfree(struct iommu_domain *domain, struct iommu *obj, u32 da); - extern void *da_to_va(struct iommu *obj, u32 da); #endif /* __IOMMU_MMAP_H */ diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 809ca12..d5cf3cf 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c @@ -419,40 +419,6 @@ static inline void sgtable_drain_vmalloc(struct sg_table *sgt) BUG_ON(!sgt); } -static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, u32 da, - size_t len) -{ - unsigned int i; - struct scatterlist *sg; - - for_each_sg(sgt-sgl, sg, sgt-nents, i) { - unsigned bytes; - - bytes = max_alignment(da | pa); - bytes = min_t(unsigned, bytes, iopgsz_max(len)); - - BUG_ON(!iopgsz_ok(bytes)); - - sg_set_buf(sg, phys_to_virt(pa), bytes); - /* -* 'pa' is cotinuous(linear). -*/ - pa += bytes; - da += bytes; - len -= bytes; - } - BUG_ON(len); -} - -static inline void sgtable_drain_kmalloc(struct sg_table *sgt) -{ - /* -* Actually this is not necessary at all, just exists for -* consistency of the code readability -*/ - BUG_ON(!sgt); -} - /* create 'da' - 'pa' mapping from 'sgt' */ static int map_iovm_area(struct iommu_domain *domain, struct iovm_struct *new, const struct sg_table *sgt, u32 flags) @@ -764,139 +730,6 @@ void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da) } EXPORT_SYMBOL_GPL(iommu_vfree); -static u32 __iommu_kmap(struct iommu_domain *domain, struct iommu *obj, - u32 da, u32 pa, void *va, size_t bytes, u32 flags) -{ - struct sg_table *sgt; - - sgt = sgtable_alloc(bytes, flags, da, pa); - if (IS_ERR(sgt)) - return PTR_ERR(sgt); - - sgtable_fill_kmalloc(sgt, pa, da, bytes); - - da = map_iommu_region(domain, obj, da, sgt, va, bytes, flags); - if (IS_ERR_VALUE(da)) { - sgtable_drain_kmalloc(sgt); - sgtable_free(sgt); - } - - return da; -} - -/** - * iommu_kmap - (d)-(p)-(v) address mapper - * @obj: objective iommu - * @da:contiguous iommu virtual memory - * @pa:contiguous physical memory - * @flags: iovma and page property - * - * Creates 1-1-1 mapping and returns @da again, which can be - * adjusted if 'IOVMF_DA_FIXED' is not set. - */ -u32 iommu_kmap(struct iommu_domain *domain, struct iommu *obj, u32 da, u32 pa, - size_t bytes, u32 flags) -{ - void *va; - - if (!obj || !obj-dev || !bytes) - return -EINVAL; - - bytes = PAGE_ALIGN(bytes); - - va = ioremap(pa, bytes); - if (!va) - return -ENOMEM; - - flags |= IOVMF_LINEAR; - flags |= IOVMF_MMIO; - - da = __iommu_kmap(domain, obj, da, pa, va, bytes, flags); - if (IS_ERR_VALUE(da)) - iounmap(va); - - return da; -} -EXPORT_SYMBOL_GPL(iommu_kmap); - -/** - * iommu_kunmap - release virtual mapping obtained by 'iommu_kmap()' - * @obj: objective iommu - * @da:iommu device virtual address - * - * Frees the iommu virtually contiguous memory area starting at - * @da, which was passed to and was returned by'iommu_kmap()'. - */ -void iommu_kunmap(struct iommu_domain *domain, struct iommu *obj, u32 da) -{ -
Re: [PATCH 4/7] omap: iommu: PREFETCH_IOTLB cleanup
Hi Ohad, From: ext Ohad Ben-Cohen o...@wizery.com Subject: [PATCH 4/7] omap: iommu: PREFETCH_IOTLB cleanup Date: Thu, 18 Aug 2011 02:10:05 +0300 Use PREFETCH_IOTLB to control the content of the called function, instead of inlining it in the code. This improves readability of the code, and also prevents an unused function warning to show up when PREFETCH_IOTLB isn't set. Great, much better. While we're at it, rename load_iotlb_entry to prefetch_iotlb_entry to better reflect the purpose of that function. Considering that, originally this function is the counterpart of flush_iotlb_page() among load_iotlb_/flush_iotlb_*() family and OMAP1 doesn't use H/W page table but only uses TLB(only prefetch/load_tlb), what about keeping the original function load_iotlb_entry(), and make inline function prefetch_iotlb_entry() has it? Something like below? static int inline prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) { return load_iotlb_entry(obj, e); } The above may keep a little bit more sense both for TLB only case too, also for some function name consistency? Signed-off-by: Ohad Ben-Cohen o...@wizery.com --- drivers/iommu/omap-iommu.c | 18 +- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index ed81977..7280e5b 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -248,11 +248,12 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) } /** - * load_iotlb_entry - Set an iommu tlb entry + * prefetch_iotlb_entry - Set an iommu tlb entry * @obj: target iommu * @e: an iommu tlb entry info **/ -static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) +#ifdef PREFETCH_IOTLB +static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) { int err = 0; struct iotlb_lock l; @@ -309,6 +310,15 @@ out: return err; } +#else /* !PREFETCH_IOTLB */ + +static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) +{ + return 0; +} + +#endif /* !PREFETCH_IOTLB */ + /** * flush_iotlb_page - Clear an iommu tlb entry * @obj: target iommu @@ -662,10 +672,8 @@ int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) flush_iotlb_page(obj, e-da); err = iopgtable_store_entry_core(obj, e); -#ifdef PREFETCH_IOTLB if (!err) - load_iotlb_entry(obj, e); -#endif + prefetch_iotlb_entry(obj, e); return err; } EXPORT_SYMBOL_GPL(iopgtable_store_entry); -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html