]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
OMAPDSS: DSSCOMP: move device to omap plat to configure tiler1d slot
authorTony Lofthouse <a0741364@ti.com>
Mon, 1 Apr 2013 20:10:00 +0000 (15:10 -0500)
committerPraneeth Bajjuri <praneeth@ti.com>
Fri, 12 Jul 2013 22:41:43 +0000 (17:41 -0500)
Different devices will have varying requirements on tiler resources. This
change moves the platform device registration for dsscomp to the omap
platform level so at device initialization time we can set the appropriate
Tiler1D slot size.

Get platform information from dss2 driver, instead of it being hardcoded in
dsscomp clients. DSSCOMP query platform ioctl returns the platform specific
configuration, platform_info

Change-Id: I23c310294a96b711ea5782bddf732f10cc76e758
Signed-off-by: Arthur Philpott <arthur.philpott@ti.com>
arch/arm/plat-omap/Makefile
arch/arm/plat-omap/include/plat/board.h [new file with mode: 0644]
arch/arm/plat-omap/include/plat/dsscomp.h
arch/arm/plat-omap/include/plat/gpio-switch.h [new file with mode: 0644]
arch/arm/plat-omap/omap_dsscomp.c [new file with mode: 0644]
drivers/video/omap2/dsscomp/device.c
drivers/video/omap2/dsscomp/dsscomp.h
drivers/video/omap2/dsscomp/gralloc.c
include/video/dsscomp.h

index 4077d23a8603af0525ce648940b71087ddfcfdd9..a3f943eb1c41062f49d875641e3f8557b1bf2863 100644 (file)
@@ -15,3 +15,4 @@ obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
 i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
 obj-y += $(i2c-omap-m) $(i2c-omap-y)
 
+obj-$(CONFIG_DSSCOMP) += omap_dsscomp.o
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
new file mode 100644 (file)
index 0000000..d5eb4c8
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ *  arch/arm/plat-omap/include/mach/board.h
+ *
+ *  Information structures for board-specific data
+ *
+ *  Copyright (C) 2004 Nokia Corporation
+ *  Written by Juha Yrjölä <juha.yrjola@nokia.com>
+ */
+
+#ifndef _OMAP_BOARD_H
+#define _OMAP_BOARD_H
+
+#include <linux/types.h>
+
+#include <plat/gpio-switch.h>
+
+/*
+ * OMAP35x EVM revision
+ * Run time detection of EVM revision is done by reading Ethernet
+ * PHY ID -
+ *     GEN_1   = 0x01150000
+ *     GEN_2   = 0x92200000
+ */
+enum {
+       OMAP3EVM_BOARD_GEN_1 = 0,       /* EVM Rev between  A - D */
+       OMAP3EVM_BOARD_GEN_2,           /* EVM Rev >= Rev E */
+};
+
+/* Different peripheral ids */
+#define OMAP_TAG_CLOCK         0x4f01
+#define OMAP_TAG_GPIO_SWITCH   0x4f06
+#define OMAP_TAG_STI_CONSOLE   0x4f09
+#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
+
+#define OMAP_TAG_BOOT_REASON    0x4f80
+#define OMAP_TAG_FLASH_PART    0x4f81
+#define OMAP_TAG_VERSION_STR   0x4f82
+
+struct omap_clock_config {
+       /* 0 for 12 MHz, 1 for 13 MHz and 2 for 19.2 MHz */
+       u8 system_clock_type;
+};
+
+struct omap_serial_console_config {
+       u8 console_uart;
+       u32 console_speed;
+};
+
+struct omap_sti_console_config {
+       unsigned enable:1;
+       u8 channel;
+};
+
+struct omap_camera_sensor_config {
+       u16 reset_gpio;
+       int (*power_on)(void * data);
+       int (*power_off)(void * data);
+};
+
+struct omap_usb_config {
+       /* Configure drivers according to the connectors on your board:
+        *  - "A" connector (rectagular)
+        *      ... for host/OHCI use, set "register_host".
+        *  - "B" connector (squarish) or "Mini-B"
+        *      ... for device/gadget use, set "register_dev".
+        *  - "Mini-AB" connector (very similar to Mini-B)
+        *      ... for OTG use as device OR host, initialize "otg"
+        */
+       unsigned        register_host:1;
+       unsigned        register_dev:1;
+       u8              otg;    /* port number, 1-based:  usb1 == 2 */
+
+       u8              hmc_mode;
+
+       /* implicitly true if otg:  host supports remote wakeup? */
+       u8              rwc;
+
+       /* signaling pins used to talk to transceiver on usbN:
+        *  0 == usbN unused
+        *  2 == usb0-only, using internal transceiver
+        *  3 == 3 wire bidirectional
+        *  4 == 4 wire bidirectional
+        *  6 == 6 wire unidirectional (or TLL)
+        */
+       u8              pins[3];
+
+       struct platform_device *udc_device;
+       struct platform_device *ohci_device;
+       struct platform_device *otg_device;
+
+       u32 (*usb0_init)(unsigned nwires, unsigned is_device);
+       u32 (*usb1_init)(unsigned nwires);
+       u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
+};
+
+struct omap_lcd_config {
+       char panel_name[16];
+       char ctrl_name[16];
+       s16  nreset_gpio;
+       u8   data_lines;
+};
+
+struct device;
+struct fb_info;
+struct omap_backlight_config {
+       int default_intensity;
+       int (*set_power)(struct device *dev, int state);
+};
+
+struct omap_fbmem_config {
+       u32 start;
+       u32 size;
+};
+
+struct omap_pwm_led_platform_data {
+       const char *name;
+       int intensity_timer;
+       int blink_timer;
+       void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
+};
+
+struct omap_uart_config {
+       /* Bit field of UARTs present; bit 0 --> UART1 */
+       unsigned int enabled_uarts;
+};
+
+
+struct omap_flash_part_config {
+       char part_table[0];
+};
+
+struct omap_boot_reason_config {
+       char reason_str[12];
+};
+
+struct omap_version_config {
+       char component[12];
+       char version[12];
+};
+
+struct omap_board_config_entry {
+       u16 tag;
+       u16 len;
+       u8  data[0];
+};
+
+struct omap_board_config_kernel {
+       u16 tag;
+       const void *data;
+};
+
+extern const void *__init __omap_get_config(u16 tag, size_t len, int nr);
+
+#define omap_get_config(tag, type) \
+       ((const type *) __omap_get_config((tag), sizeof(type), 0))
+#define omap_get_nr_config(tag, type, nr) \
+       ((const type *) __omap_get_config((tag), sizeof(type), (nr)))
+
+extern const void *__init omap_get_var_config(u16 tag, size_t *len);
+
+extern struct omap_board_config_kernel *omap_board_config;
+extern int omap_board_config_size;
+
+
+/* for TI reference platforms sharing the same debug card */
+extern int debug_card_init(u32 addr, unsigned gpio);
+
+/* OMAP3EVM revision */
+#if defined(CONFIG_MACH_OMAP3EVM)
+u8 get_omap3_evm_rev(void);
+#else
+#define get_omap3_evm_rev() (-EINVAL)
+#endif
+#endif
index 9909e47dd528a6a1eed80e75d335e7592d721e73..2dcf2636d4453210a2cb93384304a79af7f7296d 100644 (file)
 #define _ARCH_ARM_PLAT_OMAP_DSSCOMP_H
 
 #include <video/omapdss.h>
+#include <video/dsscomp.h>
+
+struct dsscomp_platform_data {
+       unsigned int tiler1d_slotsz;
+};
 
 /* queuing operations */
 struct dsscomp;
@@ -41,4 +46,7 @@ int dsscomp_gralloc_queue(struct dsscomp_setup_dispc_data *d,
                        struct tiler_pa_info **pas,
                        bool early_callback,
                        void (*cb_fn)(void *, int), void *cb_arg);
+
+void dsscomp_set_platform_data(struct dsscomp_platform_data *data);
+
 #endif
diff --git a/arch/arm/plat-omap/include/plat/gpio-switch.h b/arch/arm/plat-omap/include/plat/gpio-switch.h
new file mode 100644 (file)
index 0000000..10da0e0
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * GPIO switch definitions
+ *
+ * Copyright (C) 2006 Nokia Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
+#define __ASM_ARCH_OMAP_GPIO_SWITCH_H
+
+#include <linux/types.h>
+
+/* Cover:
+ *     high -> closed
+ *     low  -> open
+ * Connection:
+ *     high -> connected
+ *     low  -> disconnected
+ * Activity:
+ *     high -> active
+ *     low  -> inactive
+ *
+ */
+#define OMAP_GPIO_SWITCH_TYPE_COVER            0x0000
+#define OMAP_GPIO_SWITCH_TYPE_CONNECTION       0x0001
+#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY         0x0002
+#define OMAP_GPIO_SWITCH_FLAG_INVERTED         0x0001
+#define OMAP_GPIO_SWITCH_FLAG_OUTPUT           0x0002
+
+struct omap_gpio_switch {
+       const char *name;
+       s16 gpio;
+       unsigned flags:4;
+       unsigned type:4;
+
+       /* Time in ms to debounce when transitioning from
+        * inactive state to active state. */
+       u16 debounce_rising;
+       /* Same for transition from active to inactive state. */
+       u16 debounce_falling;
+
+       /* notify board-specific code about state changes */
+       void (* notify)(void *data, int state);
+       void *notify_data;
+};
+
+/* Call at init time only */
+extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
+                                       int count);
+
+#endif
diff --git a/arch/arm/plat-omap/omap_dsscomp.c b/arch/arm/plat-omap/omap_dsscomp.c
new file mode 100644 (file)
index 0000000..e771a69
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * File: arch/arm/plat-omap/omap_dsscomp.c
+ *
+ * dsscomp resources registration for TI OMAP platforms
+ *
+ * Copyright (C) 2012 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <plat/board.h>
+
+#include <video/dsscomp.h>
+#include <plat/dsscomp.h>
+
+static struct dsscomp_platform_data dsscomp_config = {
+               .tiler1d_slotsz = SZ_16M,
+};
+
+static struct platform_device omap_dsscomp_device = {
+       .name           = "dsscomp",
+       .id             = -1,
+       .dev = {
+               .platform_data          = &dsscomp_config,
+       },
+       .num_resources = 0,
+};
+
+void dsscomp_set_platform_data(struct dsscomp_platform_data *data)
+{
+       dsscomp_config = *data;
+}
+
+static int __init omap_init_dsscomp(void)
+{
+       return platform_device_register(&omap_dsscomp_device);
+}
+
+arch_initcall(omap_init_dsscomp);
+
index 97d38b76482c1fbe232935f130df198b1dbe3d78..00d680669e4a53e26a788b387bfbfb8def1a403f 100755 (executable)
@@ -42,6 +42,8 @@
 #include <plat/dsscomp.h>
 #include "../../../drivers/gpu/drm/omapdrm/omap_dmm_tiler.h"
 #include "dsscomp.h"
+#include "../dss/dss_features.h"
+#include "../dss/dss.h"
 
 #include <linux/debugfs.h>
 
@@ -49,6 +51,8 @@ static DECLARE_WAIT_QUEUE_HEAD(waitq);
 static DEFINE_MUTEX(wait_mtx);
 bool alpha_only = true;
 
+static struct dsscomp_platform_info platform_info;
+
 static u32 hwc_virt_to_phys(u32 arg)
 {
        pmd_t *pmd;
@@ -508,6 +512,34 @@ static void fill_cache(struct dsscomp_dev *cdev)
                (cdev->ovls[0]->caps & OMAP_DSS_OVL_CAP_ZORDER);
 }
 
+static void fill_platform_info(struct dsscomp_dev *cdev)
+{
+       struct dsscomp_platform_info *p = &platform_info;
+
+       p->max_xdecim_1d = 16;
+       p->max_xdecim_2d = 16;
+       p->max_ydecim_1d = 16;
+       p->max_ydecim_2d = 2;
+
+       p->fclk = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
+       /*
+        * :TODO: for now overwrite with actual fclock as dss will not scale
+        * fclock based on composition
+        */
+       p->fclk = dispc_fclk_rate();
+
+       p->min_width = 2;
+       p->max_width = 2048;
+       p->max_height = 2048;
+
+       p->max_downscale = 4;
+       p->integer_scale_ratio_limit = 2048;
+
+       p->tiler1d_slot_size = tiler1d_slot_size(cdev);
+
+       p->fbmem_type = DSSCOMP_FBMEM_TILER2D;
+}
+
 static long comp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
        int r = 0;
@@ -573,6 +605,13 @@ static long comp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        {
                r = copy_from_user(&u.sdis, ptr, sizeof(u.sdis)) ? :
                    setup_display(cdev, &u.sdis);
+               break;
+       }
+       case DSSCIOC_QUERY_PLATFORM:
+       {
+               /* :TODO: for now refill platform info as it is dynamic */
+               r = copy_to_user(ptr, &platform_info, sizeof(platform_info));
+               break;
        }
        default:
                r = -EINVAL;
@@ -627,6 +666,7 @@ static int dsscomp_probe(struct platform_device *pdev)
        ret = misc_register(&cdev->dev);
        if (ret) {
                pr_err("dsscomp: failed to register misc device.\n");
+               kfree(cdev);
                return ret;
        }
        cdev->dbgfs = debugfs_create_dir("dsscomp", NULL);
@@ -643,11 +683,13 @@ static int dsscomp_probe(struct platform_device *pdev)
 #endif
        }
 
+       cdev->pdev = &pdev->dev;
        platform_set_drvdata(pdev, cdev);
 
        pr_info("dsscomp: initializing.\n");
 
        fill_cache(cdev);
+       fill_platform_info(cdev);
 
        /* initialize queues */
        dsscomp_queue_init(cdev);
@@ -674,26 +716,13 @@ static struct platform_driver dsscomp_pdriver = {
        .driver = { .name = MODULE_NAME_DSSCOMP, .owner = THIS_MODULE }
 };
 
-static struct platform_device dsscomp_pdev = {
-       .name = MODULE_NAME_DSSCOMP,
-       .id = -1
-};
-
 static int __init dsscomp_init(void)
 {
-       int err = platform_driver_register(&dsscomp_pdriver);
-       if (err)
-               return err;
-
-       err = platform_device_register(&dsscomp_pdev);
-       if (err)
-               platform_driver_unregister(&dsscomp_pdriver);
-       return err;
+       return platform_driver_register(&dsscomp_pdriver);
 }
 
 static void __exit dsscomp_exit(void)
 {
-       platform_device_unregister(&dsscomp_pdev);
        platform_driver_unregister(&dsscomp_pdriver);
 }
 
index 8fe7a39f143444f4f190af9badf82403d208deff..5146c1f0bf91d9d56b9bb0e55906ee03faaac344 100644 (file)
 /**
  * DSS Composition Device Driver
  *
+ * @pdev:  hook for platform device data
  * @dev:   misc device base
  * @dbgfs: debugfs hook
  */
 struct dsscomp_dev {
+       struct device *pdev;
        struct miscdevice dev;
        struct dentry *dbgfs;
 
@@ -146,6 +148,13 @@ struct omap_overlay_manager *find_dss_mgr(int display_ix);
 void swap_rb_in_ovl_info(struct dss2_ovl_info *oi);
 void swap_rb_in_mgr_info(struct dss2_mgr_info *mi);
 
+static inline u32 tiler1d_slot_size(struct dsscomp_dev *cdev)
+{
+       struct dsscomp_platform_data *pdata;
+       pdata = (struct dsscomp_platform_data *)cdev->pdev->platform_data;
+       return pdata->tiler1d_slotsz;
+}
+
 /*
  * Debug functions
  */
index 5c3a897b40610cc1c5a35e67d25976fcc2117a99..2c4ca72deb88d99cc8cdf77fad3cfd227ce5348e 100755 (executable)
@@ -35,7 +35,6 @@
 static bool blanked;
 
 #define NUM_TILER1D_SLOTS 2
-#define TILER1D_SLOT_SIZE (16 << 20)
 
 static struct tiler1d_slot {
        struct list_head q;
@@ -427,9 +426,9 @@ skip_map1d:
                r = tiler_pin_phys(slot->block_handle, slot->page_map,
                                                slot_used);
                if (r)
-                       dev_err(DEV(cdev), "failed to pin %d pages into %d-pg "
-                                       "slots (%d)\n", slot_used,
-                                       TILER1D_SLOT_SIZE >> PAGE_SHIFT, r);
+                       dev_err(DEV(cdev), "failed to pin %d pages into"
+                       " %d-pg slots (%d)\n", slot_used,
+                       tiler1d_slot_size(cdev) >> PAGE_SHIFT, r);
        }
 
        for (ch = 0; ch < MAX_MANAGERS; ch++) {
@@ -470,6 +469,7 @@ skip_comp:
 
        return r;
 }
+EXPORT_SYMBOL(dsscomp_gralloc_queue);
 
 #ifdef CONFIG_EARLYSUSPEND
 static int blank_complete;
@@ -584,8 +584,11 @@ void dsscomp_gralloc_init(struct dsscomp_dev *cdev_)
 {
        int i;
 
+       if (!cdev_)
+               return;
+
        /* save at least cdev pointer */
-       if (!cdev && cdev_) {
+       if (!cdev) {
                cdev = cdev_;
 
 #ifdef CONFIG_HAS_EARLYSUSPEND
@@ -597,14 +600,14 @@ void dsscomp_gralloc_init(struct dsscomp_dev *cdev_)
                INIT_LIST_HEAD(&free_slots);
                for (i = 0; i < NUM_TILER1D_SLOTS; i++) {
                        struct tiler_block *block_handle =
-                               tiler_reserve_1d(TILER1D_SLOT_SIZE);
+                               tiler_reserve_1d(tiler1d_slot_size(cdev_));
                        if (IS_ERR_OR_NULL(block_handle)) {
                                pr_err("could not allocate tiler block\n");
                                break;
                        }
                        slots[i].block_handle = block_handle;
                        slots[i].phys = tiler_ssptr(block_handle);
-                       slots[i].size = TILER1D_SLOT_SIZE >> PAGE_SHIFT;
+                       slots[i].size =  tiler1d_slot_size(cdev_) >> PAGE_SHIFT;
                        slots[i].page_map = vmalloc(sizeof(*slots[i].page_map) *
                                                slots[i].size);
                        if (!slots[i].page_map) {
index 6c634771ca585e78a29e707e891a8a561f928d2e..c6def77f5c8154eed09dc7dcf347c187ba5aa22d 100644 (file)
@@ -653,6 +653,52 @@ struct dsscomp_wait_data {
        enum dsscomp_wait_phase phase;  /* phase to wait for */
 };
 
+enum dsscomp_fbmem_type {
+       DSSCOMP_FBMEM_TILER2D = 0,
+       DSSCOMP_FBMEM_VRAM = 1,
+};
+
+/*
+ * ioctl: DSSCIOC_QUERY_PLATFORM, struct dsscomp_platform_info
+ *
+ * Use this ioctl to get platform information needed to decide
+ * DSS/DSSCOMP capabilities, by filling out the passed structure with:
+ *
+ * A) predecimation limits
+ * B) maximum fclk (DSS is assumed to scale up to this fclk automatically
+ *    to support frames)
+ * C) minimum and maximum sizes (for now we use the same limits for
+ *    both source and window sizes, which works for OMAP4/5)
+ * D) scaler limitations. (assuming same max downscale limitation both
+ *    horizontally/vertically; however, fclock requirements are only
+ *    dependent on horizontal scaling, which works for OMAP4 ES1.1+ and
+ *    OMAP5 only).
+ *    integer_scale_ratio_limit is the maximum source width to round up
+ *    fclock/pixclock to an integer.
+ * E) Tiler1D slot size
+ *
+ * Returns: 0 on success, <0 error value on failure (unlikely)
+ */
+
+struct dsscomp_platform_info {
+       /* decimation limits for 2D and 1D buffers */
+       __u8 max_xdecim_2d;
+       __u8 max_ydecim_2d;
+       __u8 max_xdecim_1d;
+       __u8 max_ydecim_1d;
+       __u32 fclk;             /* dispc max fclk */
+       /* pipeline source/destination limits */
+       __u8 min_width;
+       __u16 max_width;
+       __u16 max_height;
+       /* scaler limitations */
+       __u8 max_downscale;
+       /* below this width, we assume integer pixelclk scale */
+       __u16 integer_scale_ratio_limit;
+       __u32 tiler1d_slot_size;
+       enum dsscomp_fbmem_type fbmem_type; /* TILER2D vs VRAM */
+};
+
 /* IOCTLS */
 #define DSSCIOC_SETUP_MGR      _IOW('O', 128, struct dsscomp_setup_mgr_data)
 #define DSSCIOC_CHECK_OVL      _IOWR('O', 129, struct dsscomp_check_ovl_data)
@@ -663,4 +709,5 @@ struct dsscomp_wait_data {
 #define DSSCIOC_SETUP_DISPC    _IOW('O', 133, struct dsscomp_setup_dispc_data)
 #define DSSCIOC_SETUP_DISPLAY  \
                        _IOW('O', 134, struct dsscomp_setup_display_data)
+#define DSSCIOC_QUERY_PLATFORM _IOR('O', 135, struct dsscomp_platform_info)
 #endif