From b583d806443ededdc5a9b65ac76d0bd14df9854e Mon Sep 17 00:00:00 2001 From: cronyx Date: Sun, 4 Jun 2023 18:25:41 +0300 Subject: [PATCH] t31-t40 drivers moved to opensdk (#841) --- br-ext-chip-ingenic/configs/t31_fpv_defconfig | 1 + .../configs/t31_lite_defconfig | 1 + .../configs/t31_ultimate_defconfig | 1 + .../configs/t40_lite_defconfig | 1 + .../configs/t40_ultimate_defconfig | 1 + .../ingenic-opensdk/ingenic-opensdk.mk | 11 +- .../src/kernel/gpio_claimer/Makefile | 20 - .../src/kernel/gpio_claimer/gpio.c | 79 -- .../src/kernel/sensor_info/Makefile | 25 - .../src/kernel/sensor_info/README | 5 - .../src/kernel/sensor_info/sample_sinfo.c | 148 ---- .../src/kernel/sensor_info/sensor_info.c | 700 ------------------ .../files/script/load_ingenic | 12 +- .../ingenic-osdrv-t31/ingenic-osdrv-t31.mk | 27 - .../files/script/load_ingenic | 12 +- .../ingenic-osdrv-t40/ingenic-osdrv-t40.mk | 15 - 16 files changed, 21 insertions(+), 1038 deletions(-) delete mode 100644 general/package/ingenic-opensdk/src/kernel/gpio_claimer/Makefile delete mode 100644 general/package/ingenic-opensdk/src/kernel/gpio_claimer/gpio.c delete mode 100644 general/package/ingenic-opensdk/src/kernel/sensor_info/Makefile delete mode 100644 general/package/ingenic-opensdk/src/kernel/sensor_info/README delete mode 100644 general/package/ingenic-opensdk/src/kernel/sensor_info/sample_sinfo.c delete mode 100644 general/package/ingenic-opensdk/src/kernel/sensor_info/sensor_info.c diff --git a/br-ext-chip-ingenic/configs/t31_fpv_defconfig b/br-ext-chip-ingenic/configs/t31_fpv_defconfig index 4d417c54..554170e4 100644 --- a/br-ext-chip-ingenic/configs/t31_fpv_defconfig +++ b/br-ext-chip-ingenic/configs/t31_fpv_defconfig @@ -58,6 +58,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" BR2_PACKAGE_DROPBEAR_OPENIPC=y # BR2_PACKAGE_FDK_AAC_OPENIPC is not set BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_INGENIC_OPENSDK=y BR2_PACKAGE_INGENIC_OSDRV_T31=y # BR2_PACKAGE_HASERL is not set # BR2_PACKAGE_HISI_GPIO is not set diff --git a/br-ext-chip-ingenic/configs/t31_lite_defconfig b/br-ext-chip-ingenic/configs/t31_lite_defconfig index c0bf4263..ec94d9ce 100644 --- a/br-ext-chip-ingenic/configs/t31_lite_defconfig +++ b/br-ext-chip-ingenic/configs/t31_lite_defconfig @@ -58,6 +58,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" BR2_PACKAGE_DROPBEAR_OPENIPC=y # BR2_PACKAGE_FDK_AAC_OPENIPC is not set BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_INGENIC_OPENSDK=y BR2_PACKAGE_INGENIC_OSDRV_T31=y BR2_PACKAGE_HASERL=y # BR2_PACKAGE_HISI_GPIO is not set diff --git a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig index 7bd7b165..4b0cce01 100644 --- a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig +++ b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig @@ -58,6 +58,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" BR2_PACKAGE_DROPBEAR_OPENIPC=y # BR2_PACKAGE_FDK_AAC_OPENIPC is not set BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_INGENIC_OPENSDK=y BR2_PACKAGE_INGENIC_OSDRV_T31=y BR2_PACKAGE_HASERL=y # BR2_PACKAGE_HISI_GPIO is not set diff --git a/br-ext-chip-ingenic/configs/t40_lite_defconfig b/br-ext-chip-ingenic/configs/t40_lite_defconfig index 285d9ead..a276e52a 100644 --- a/br-ext-chip-ingenic/configs/t40_lite_defconfig +++ b/br-ext-chip-ingenic/configs/t40_lite_defconfig @@ -58,6 +58,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" BR2_PACKAGE_DROPBEAR_OPENIPC=y # BR2_PACKAGE_FDK_AAC_OPENIPC is not set BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_INGENIC_OPENSDK=y BR2_PACKAGE_INGENIC_OSDRV_T40=y BR2_PACKAGE_HASERL=y # BR2_PACKAGE_HISI_GPIO is not set diff --git a/br-ext-chip-ingenic/configs/t40_ultimate_defconfig b/br-ext-chip-ingenic/configs/t40_ultimate_defconfig index 7482893d..ade191fe 100644 --- a/br-ext-chip-ingenic/configs/t40_ultimate_defconfig +++ b/br-ext-chip-ingenic/configs/t40_ultimate_defconfig @@ -58,6 +58,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config" BR2_PACKAGE_DROPBEAR_OPENIPC=y # BR2_PACKAGE_FDK_AAC_OPENIPC is not set BR2_PACKAGE_UBOOT_TOOLS=y +BR2_PACKAGE_INGENIC_OPENSDK=y BR2_PACKAGE_INGENIC_OSDRV_T40=y BR2_PACKAGE_HASERL=y # BR2_PACKAGE_HISI_GPIO is not set diff --git a/general/package/ingenic-opensdk/ingenic-opensdk.mk b/general/package/ingenic-opensdk/ingenic-opensdk.mk index 85bb4e24..731274f0 100644 --- a/general/package/ingenic-opensdk/ingenic-opensdk.mk +++ b/general/package/ingenic-opensdk/ingenic-opensdk.mk @@ -4,17 +4,14 @@ # ################################################################################ +INGENIC_OPENSDK_VERSION = $(shell git ls-remote https://github.com/OpenIPC/openingenic master | awk '{ print $$1 }') +INGENIC_OPENSDK_SITE = $(call github,openipc,openingenic,$(INGENIC_OPENSDK_VERSION)) INGENIC_OPENSDK_LICENSE = GPL-3.0 INGENIC_OPENSDK_LICENSE_FILES = LICENSE -define INGENIC_OPENSDK_EXTRACT_CMDS - cp $(INGENIC_OPENSDK_PKGDIR)/src/kernel/* $(@D)/ -endef - +INGENIC_OPENSDK_MODULE_SUBDIRS = kernel INGENIC_OPENSDK_MODULE_MAKE_OPTS = \ - CONFIG_GPIO=m \ - KVER=$(LINUX_VERSION_PROBED) \ - KSRC=$(LINUX_DIR) + SOC=$(OPENIPC_MODEL) $(eval $(kernel-module)) $(eval $(generic-package)) diff --git a/general/package/ingenic-opensdk/src/kernel/gpio_claimer/Makefile b/general/package/ingenic-opensdk/src/kernel/gpio_claimer/Makefile deleted file mode 100644 index eb47386a..00000000 --- a/general/package/ingenic-opensdk/src/kernel/gpio_claimer/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -CROSS_COMPILE ?= mips-linux-gnu- - -ifeq (${ISVP_ENV_KERNEL_DIR}, ) - ISVP_ENV_KERNEL_DIR = ../../../kernel -endif - -KDIR := ${ISVP_ENV_KERNEL_DIR} -MODULE_NAME := gpio - -all: modules - -.PHONY: modules clean - -obj-m := $(MODULE_NAME).o - -modules: - @$(MAKE) -C $(KDIR) M=$(shell pwd) $@ -clean: - @rm -rf *.o *~ .depend .*.cmd *.mod.c .tmp_versions *.ko *.symvers modules.order - @rm -f gpio diff --git a/general/package/ingenic-opensdk/src/kernel/gpio_claimer/gpio.c b/general/package/ingenic-opensdk/src/kernel/gpio_claimer/gpio.c deleted file mode 100644 index 54b6a599..00000000 --- a/general/package/ingenic-opensdk/src/kernel/gpio_claimer/gpio.c +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("OpenIPC"); -MODULE_DESCRIPTION("Ingenic GPIO Claimer"); - -static struct proc_dir_entry *claim_proc; - -int claim_gpio(int gpio) { - int ret = 0; - - pr_debug("GPIO[%i] Requesting...\n", gpio); - - if (!gpio_is_valid(gpio)) { - pr_err("GPIO[%i] is not valid\n", gpio); - return -1; - } - - if (gpio_request(gpio, 0) > 0) - return -1; - - pr_debug("GPIO[%i] Setting direction...\n", gpio); - gpio_direction_output(gpio, 0); - pr_debug("GPIO[%i] Exporting...\n", gpio); - gpio_export(gpio, true); - - return 0; -} - -ssize_t claim_proc_write(struct file *filp, const char *buf, size_t len, - loff_t *off) { - int ret = 0; - char cmd[4] = {0}; - uint32_t addr, data, datalen; - - if (len > 4) { - return -EFAULT; - } - if (copy_from_user(cmd, buf, len)) { - return -EFAULT; - } - int gpio = simple_strtoul(cmd, NULL, 0); - ret = claim_gpio(gpio); - if (ret) { - pr_err("GPIO[%i] Error %i \n", gpio, ret); - return -EFAULT; - } else { - pr_debug("GPIO[%i] Claiming...\n", gpio); - } - - return len; -} - -static const struct file_operations claim_proc_fops = { - .owner = THIS_MODULE, - .write = claim_proc_write, -}; - -static __init int init_claim(void) { - claim_proc = proc_mkdir("jz/claim", 0); - if (!claim_proc) { - printk("err: jz_proc_mkdir failed\n"); - } - proc_create_data("gpio", S_IRUGO, claim_proc, &claim_proc_fops, NULL); - printk("Ingenic GPIO claim module (c) OpenIPC.org\n"); - return 0; -} - -static __exit void exit_claim(void) { proc_remove(claim_proc); } - -module_init(init_claim); -module_exit(exit_claim); diff --git a/general/package/ingenic-opensdk/src/kernel/sensor_info/Makefile b/general/package/ingenic-opensdk/src/kernel/sensor_info/Makefile deleted file mode 100644 index f89276a5..00000000 --- a/general/package/ingenic-opensdk/src/kernel/sensor_info/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CROSS_COMPILE ?= mips-linux-gnu- - -KDIR := ${ISVP_ENV_KERNEL_DIR} -MODULE_NAME := sinfo - -all: modules - -.PHONY: modules clean - -$(MODULE_NAME)-objs := sensor_info.o -obj-m := $(MODULE_NAME).o - -modules: - @if test "$(KDIR)" = ""; \ - then \ - echo "**************************************"; \ - echo "Please run env_setup.sh at top of isvp"; \ - echo "**************************************"; \ - fi - @$(MAKE) -C $(KDIR) M=$(shell pwd) $@ -sample_sinfo: - mips-linux-gnu-gcc sample_sinfo.c -o sample_sinfo -clean: - @rm -rf *.o *~ .depend .*.cmd *.mod.c .tmp_versions *.ko *.symvers modules.order - @rm -f sample_sinfo diff --git a/general/package/ingenic-opensdk/src/kernel/sensor_info/README b/general/package/ingenic-opensdk/src/kernel/sensor_info/README deleted file mode 100644 index bd6ce3c6..00000000 --- a/general/package/ingenic-opensdk/src/kernel/sensor_info/README +++ /dev/null @@ -1,5 +0,0 @@ -Two ways to get sensor info - -1. open /dev/sinfo; ioctl TOCTL_SINFO_GET - -2. echo 1 >/proc/jz/sinfo/info; cat /proc/jz/sinfo/info diff --git a/general/package/ingenic-opensdk/src/kernel/sensor_info/sample_sinfo.c b/general/package/ingenic-opensdk/src/kernel/sensor_info/sample_sinfo.c deleted file mode 100644 index 7133dddb..00000000 --- a/general/package/ingenic-opensdk/src/kernel/sensor_info/sample_sinfo.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * sample_sinfo.c - * - * two ways to get sensor info - * - * 1. open /dev/sinfo; ioctl TOCTL_SINFO_GET - * - * 2. echo 1 >/proc/jz/sinfo/info; cat /proc/jz/sinfo/info - * - * */ -#include -#include -#include -#include -#include -#include -#include -#include - -#define SENSOR_INFO_IOC_MAGIC 'S' -#define IOCTL_SINFO_GET _IO(SENSOR_INFO_IOC_MAGIC, 100) -#define IOCTL_SINFO_FLASH _IO(SENSOR_INFO_IOC_MAGIC, 101) - -#define SENSOR_TYPE_INVALID -1 - -typedef struct SENSOR_INFO_S -{ - unsigned char *name; -} SENSOR_INFO_T; - -SENSOR_INFO_T g_sinfo[] = -{ - {"ov9712"}, - {"ov9732"}, - {"ov9750"}, - {"jxh42"}, - {"sc1035"}, - {"sc1135"}, - {"sc1045"}, - {"sc1145"}, - {"ar0130"}, - {"jxh61"}, - {"gc2083"}, - {"gc1024"}, - {"gc1064"}, - {"gc2023"}, - {"bf3115"}, - {"imx225"}, - {"ov2710"}, - {"imx323"}, - {"sc2135"}, - {"sp1409"}, - {"jxh62"}, - {"bg0806"}, - {"ov4689"}, - {"jxf22"}, - {"imx322"}, - {"imx307"}, - {"imx291"}, - {"ov2735"}, - {"sc3035"}, - {"ar0237"}, - {"sc2145"}, - {"jxh65"}, - {"sc2300"}, - {"ov2735b"}, - {"jxv01"}, - {"ps5230"}, - {"ps5250"}, - {"ov2718"}, - {"ov2732"}, - {"sc2235"}, - {"jxk02"}, - {"ov7740"}, - {"hm2140"}, - {"gc2033"}, - {"jxf28"}, - {"os02b10"}, - {"os05a10"}, - {"sc2232"}, - {"sc2232h"}, - {"sc2230"}, - {"sc4236"}, - {"sc1245"}, - {"sc1245a"}, - {"gc1034"}, - {"sc1235"}, - {"jxf23"}, - {"ps5270"}, - {"sp140a"}, - {"sc2310"}, - {"hm2131"}, - {"mis2003"}, - {"jxk03"}, - {"sc5235"}, - {"ov5648"}, - {"ps5280"}, - {"jxf23s"}, - {"gc2053"}, - {"sc4335"}, - {"ps5260"}, - {"os04b10"}, - {"jxk05"}, - {"jxh63"}, - {"sc2335"}, - {"jxf37"}, - {"gc4653"}, - {"c23a98"}, - {"sc3335"}, - {"sc3235"}, - {"sc200ai"}, - {"sc401ai"}, - {"sc500ai"}, - {"jxq03"}, - {"jxq03p"}, - {"sc3338"}, - {"imx334"}, - {"imx335"}, - {"imx415"}, -}; -int main(int argc,char **argv) -{ - int ret = 0; - int fd = 0; - int data = -1; - /* open device file */ - fd = open("/dev/sinfo", O_RDWR); - if (-1 == fd) { - printf("err: open failed\n"); - return -1; - } - /* iotcl to get sensor info. */ - /* cmd is IOCTL_SINFO_GET, data note sensor type according to SENSOR_TYPE */ - - ret = ioctl(fd,IOCTL_SINFO_GET,&data); - if (0 != ret) { - printf("err: ioctl failed\n"); - return ret; - } - if (SENSOR_TYPE_INVALID == data) - printf("##### sensor not found\n"); - else - printf("##### sensor : %s\n", g_sinfo[data].name); - - /* close device file */ - close(fd); - return 0; -} diff --git a/general/package/ingenic-opensdk/src/kernel/sensor_info/sensor_info.c b/general/package/ingenic-opensdk/src/kernel/sensor_info/sensor_info.c deleted file mode 100644 index 3dedd54a..00000000 --- a/general/package/ingenic-opensdk/src/kernel/sensor_info/sensor_info.c +++ /dev/null @@ -1,700 +0,0 @@ -/* - * sensor_info.c - * - * Copyright (C) 2012 Ingenic Semiconductor Co., Ltd. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#ifdef CONFIG_SOC_T40 -static unsigned i2c_adapter_nr = 1; -#else -static unsigned i2c_adapter_nr = 0; -#endif -module_param(i2c_adapter_nr, uint, 0644); -MODULE_PARM_DESC(i2c_adapter_nr, "sensor used i2c_adapter nr"); - -#ifdef CONFIG_SOC_T40 -static int reset_gpio = GPIO_PC(27); -#else -static int reset_gpio = GPIO_PA(18); -#endif -module_param(reset_gpio, int, S_IRUGO); -MODULE_PARM_DESC(reset_gpio, "Reset GPIO NUM"); - -static int pwdn_gpio = -1; -module_param(pwdn_gpio, int, S_IRUGO); -MODULE_PARM_DESC(pwdn_gpio, "Power down GPIO NUM"); - -#ifdef CONFIG_SOC_T40 -static int cim1_gpio = GPIO_PC(30); -module_param(cim1_gpio, int, S_IRUGO); -MODULE_PARM_DESC(cim1_gpio, "Cim1 GPIO NUM"); -#endif - -#define SENSOR_INFO_IOC_MAGIC 'S' -#define IOCTL_SINFO_GET _IO(SENSOR_INFO_IOC_MAGIC, 100) -#define IOCTL_SINFO_FLASH _IO(SENSOR_INFO_IOC_MAGIC, 101) - -#define SENSOR_TYPE_INVALID -1 - -#define I2C_WRITE 0 -#define I2C_READ 1 - -struct i2c_trans { - uint32_t addr; - uint32_t r_w; - uint32_t data; - uint32_t datalen; -}; - -typedef struct SENSOR_INFO_S -{ - uint8_t *name; - uint8_t i2c_addr; - uint8_t *clk_name; - uint32_t clk; - - uint32_t id_value[8]; - uint32_t id_value_len; - uint32_t id_addr[8]; - uint32_t id_addr_len; - uint8_t id_cnt; - - struct i2c_adapter *adap; -} SENSOR_INFO_T, *SENSOR_INFO_P; - -SENSOR_INFO_T g_sinfo[] = -{ - {"ov9712", 0x30, "cgu_cim", 24000000, {0x97, 0x11}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"ov9732", 0x36, "cgu_cim", 24000000, {0x97, 0x32}, 1, {0x300a, 0x300b}, 2, 2, NULL}, - {"ov9750", 0x36, "cgu_cim", 24000000, {0x97, 0x50}, 1, {0x300b, 0x300c}, 2, 2, NULL}, - {"jxh42", 0x30, "cgu_cim", 24000000, {0xa0, 0x42, 0x81}, 1, {0xa, 0xb, 0x9}, 1, 3, NULL}, - {"sc1035", 0x30, "cgu_cim", 24000000, {0xf0, 0x00}, 1, {0x580b, 0x3c05}, 2, 2, NULL}, - {"sc1135", 0x30, "cgu_cim", 24000000, {0x00, 0x35}, 1, {0x580b, 0x2148}, 2, 2, NULL}, - {"sc1045", 0x30, "cgu_cim", 24000000, {0x10, 0x45}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc1145", 0x30, "cgu_cim", 24000000, {0x11, 0x45}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"ar0130", 0x10, "cgu_cim", 24000000, {0x2402}, 2, {0x3000}, 2, 1, NULL}, - {"jxh61", 0x30, "cgu_cim", 24000000, {0xa0, 0x42, 0x3}, 1, {0xa, 0xb, 0x9}, 1, 3, NULL}, - {"gc2083", 0x37, "cgu_cim", 24000000, {0x20, 0x83}, 1, {0x3f0, 0x3f1}, 2, 2, NULL}, - {"gc1024", 0x3c, "cgu_cim", 24000000, {0x10, 0x04}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"gc1064", 0x3c, "cgu_cim", 24000000, {0x10, 0x24}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"gc2023", 0x37, "cgu_cim", 24000000, {0x20, 0x23}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"bf3115", 0x6e, "cgu_cim", 24000000, {0x31, 0x16}, 1, {0xfc, 0xfd}, 1, 2, NULL}, - {"imx225", 0x1a, "cgu_cim", 24000000, {0x10, 0x01}, 1, {0x3004, 0x3013}, 2, 2, NULL}, - {"ov2710", 0x36, "cgu_cim", 24000000, {0x27, 0x10}, 1, {0x300a, 0x300b}, 2, 2, NULL}, - {"imx323", 0x1a, "cgu_cim", 37125000, {0x50, 0x0}, 1, {0x301c, 0x301d}, 2, 2, NULL}, - {"sc2135", 0x30, "cgu_cim", 24000000, {0x21, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sp1409", 0x34, "cgu_cim", 24000000, {0x14, 0x09}, 1, {0x04, 0x05}, 1, 2, NULL}, - {"jxh62", 0x30, "cgu_cim", 24000000, {0xa0, 0x62}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"bg0806", 0x32, "cgu_cim", 24000000, {0x08, 0x06}, 1, {0x0000, 0x0001}, 2, 2, NULL}, - {"ov4689", 0x36, "cgu_cim", 24000000, {0x46, 0x88}, 1, {0x300a, 0x300b}, 2, 2, NULL}, - {"jxf22", 0x40, "cgu_cim", 24000000, {0x0f, 0x22}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"imx322", 0x1a, "cgu_cim", 37125000, {0x50, 0x0}, 1, {0x301c, 0x301d}, 2, 2, NULL}, - {"imx307", 0x1a, "cgu_cim", 37125000, {0xA0, 0xB2}, 1, {0x3008, 0x301e}, 2, 2, NULL}, - {"imx291", 0x1a, "cgu_cim", 37125000, {0xA0, 0xB2}, 1, {0x3008, 0x301e}, 2, 2, NULL}, - {"ov2735", 0x3c, "cgu_cim", 24000000, {0x27, 0x35, 0x05}, 1, {0x02, 0x03, 0x04}, 1, 3, NULL}, - {"sc3035", 0x30, "cgu_cim", 24000000, {0x30, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"ar0237", 0x10, "cgu_cim", 27000000, {0x0256}, 2, {0x3000}, 2, 1, NULL}, - {"sc2145", 0x30, "cgu_cim", 24000000, {0x21, 0x45}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"jxh65", 0x30, "cgu_cim", 24000000, {0x0a, 0x65}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"sc2300", 0x30, "cgu_cim", 24000000, {0x23, 0x00}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"ov2735b", 0x3c, "cgu_cim", 24000000, {0x27, 0x35, 0x6, 0x7}, 1, {0x02, 0x03, 0x04, 0x04}, 1, 4, NULL}, - {"jxv01", 0x21, "cgu_cim", 27000000, {0x0e, 0x04}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"ps5230", 0x48, "cgu_cim", 24000000, {0x52, 0x30}, 1, {0x00, 0x01}, 1, 2, NULL}, - {"ps5250", 0x48, "cgu_cim", 24000000, {0x52, 0x50}, 1, {0x00, 0x01}, 1, 2, NULL}, - {"ov2718", 0x36, "cgu_cim", 24000000, {0x27, 0x70}, 1, {0x300a, 0x300b}, 2, 2, NULL}, - {"ov2732", 0x36, "cgu_cim", 24000000, {0x00, 0x27, 0x32}, 1, {0x300a, 0x300b, 0x300c}, 2, 3, NULL}, - {"sc2235", 0x30, "cgu_cim", 24000000, {0x22, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"jxk02", 0x40, "cgu_cim", 24000000, {0x04, 0x03}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"ov7740", 0x21, "cgu_cim", 24000000, {0x77, 0x42}, 1, {0x0a, 0x0b}, 1, 2, NULL}, - {"hm2140", 0x24, "cgu_cim", 24000000, {0x21, 0x40}, 1, {0x0000, 0x0001}, 2, 2, NULL}, - {"gc2033", 0x37, "cgu_cim", 24000000, {0x20, 0x33}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"jxf28", 0x40, "cgu_cim", 24000000, {0x0f, 0x28}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"os02b10", 0x3c, "cgu_cim", 24000000, {0x23, 0x08}, 1, {0x02, 0x03}, 1, 2, NULL}, - {"os05a10", 0x36, "cgu_cim", 24000000, {0x53, 0x05, 0x41}, 1, {0x300a, 0x300b, 0x300c}, 2, 3, NULL}, - {"sc2232", 0x30, "cgu_cim", 24000000, {0x22, 0x32, 0x01}, 1, {0x3107, 0x3108, 0x3109}, 2, 3, NULL}, - {"sc2232h", 0x30, "cgu_cim", 24000000, {0xcb, 0x07, 0x01}, 1, {0x3107, 0x3108, 0x3109}, 2, 3, NULL}, - {"sc2230", 0x30, "cgu_cim", 24000000, {0x22, 0x32, 0x20}, 1, {0x3107, 0x3108, 0x3109}, 2, 3, NULL}, - {"sc4236", 0x30, "cgu_cim", 24000000, {0x32, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc1245", 0x30, "cgu_cim", 24000000, {0x12, 0x45, 0x03}, 1, {0x3107, 0x3108, 0x3020}, 2, 3, NULL}, - {"sc1245a", 0x30, "cgu_cim", 24000000, {0x12, 0x45, 0x02}, 1, {0x3107, 0x3108, 0x3020}, 2, 3, NULL}, - {"gc1034", 0x21, "cgu_cim", 24000000, {0x10, 0x34}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"sc1235", 0x30, "cgu_cim", 24000000, {0x12, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"jxf23", 0x40, "cgu_cim", 24000000, {0x0f, 0x23}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"ps5270", 0x48, "cgu_cim", 24000000, {0x52, 0x70}, 1, {0x00, 0x01}, 1, 2, NULL}, - {"sp140a", 0x3c, "cgu_cim", 24000000, {0x14, 0x0a}, 1, {0x02, 0x03}, 1, 2, NULL}, - {"sc2310", 0x30, "cgu_cim", 24000000, {0x23, 0x11}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"hm2131", 0x24, "cgu_cim", 24000000, {0x14, 0x0a}, 1, {0x0000, 0x0001}, 2, 2, NULL}, - {"mis2003", 0x30, "cgu_cim", 24000000, {0x20, 0x03}, 1, {0x3000, 0x3001}, 2, 2, NULL}, - {"jxk03", 0x40, "cgu_cim", 24000000, {0x05, 0x03}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"sc5235", 0x30, "cgu_cim", 24000000, {0x52, 0x35}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"ov5648", 0x36, "cgu_cim", 24000000, {0x56, 0x48}, 1, {0x300a, 0x300b}, 2, 2, NULL}, - {"ps5280", 0x48, "cgu_cim", 24000000, {0x52, 0x80}, 1, {0x00, 0x01}, 1, 2, NULL}, - {"jxf23s", 0x40, "cgu_cim", 24000000, {0x0f, 0x23}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"gc2053", 0x37, "cgu_cim", 24000000, {0x20, 0x53}, 1, {0xf0, 0xf1}, 1, 2, NULL}, - {"sc4335", 0x30, "cgu_cim", 27000000, {0xcd, 0x01}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"ps5260", 0x48, "cgu_cim", 24000000, {0x52, 0x60}, 1, {0x00, 0x01}, 1, 2, NULL}, - {"os04b10", 0x3c, "cgu_cim", 24000000, {0x43, 0x08, 0x01}, 1, {0x02, 0x03, 0x04}, 1, 3, NULL}, - {"jxk05", 0x40, "cgu_cim", 24000000, {0x05, 0x05}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"jxh63", 0x40, "cgu_cim", 24000000, {0x0a, 0x63}, 1, {0x0a, 0x0b}, 1, 2, NULL}, - {"sc2335", 0x30, "cgu_cim", 24000000, {0xcb, 0x14}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"jxf37", 0x40, "cgu_cim", 24000000, {0x0f, 0x37}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"gc4653", 0x29, "cgu_cim", 24000000, {0x46, 0x53}, 1, {0x03f0, 0x03f1}, 2, 2, NULL}, - {"c23a98", 0x36, "cgu_cim", 24000000, {0x23, 0x98}, 1, {0x0000, 0x0001}, 2, 2, NULL}, - {"sc3335", 0x30, "cgu_cim", 24000000, {0xcc, 0x1a}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc3235", 0x30, "cgu_cim", 24000000, {0xcc, 0x05}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc200ai", 0x30, "cgu_cim", 24000000, {0xcb, 0x1c}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc401ai", 0x30, "cgu_cim", 24000000, {0xcd, 0x2e}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"sc500ai", 0x30, "cgu_cim", 24000000, {0xce, 0x1f}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"jxq03", 0x40, "cgu_cim", 24000000, {0x05, 0x07}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"jxq03p", 0x40, "cgu_cim", 24000000, {0x08, 0x43}, 1, {0xa, 0xb}, 1, 2, NULL}, - {"sc3338", 0x30, "cgu_cim", 24000000, {0xcc, 0x41}, 1, {0x3107, 0x3108}, 2, 2, NULL}, - {"imx334", 0x1a, "cgu_cim", 37125000, {0x20, 0x03}, 1, {0x302e, 0x302f}, 2, 2, NULL}, - {"imx335", 0x1a, "cgu_cim", 37125000, {0x08, 0x0}, 1, {0x302e, 0x302f}, 2, 2, NULL}, - {"imx415", 0x1a, "cgu_cim", 37125000, {0x28, 0x23}, 1, {0x3b00, 0x3b06}, 2, 2, NULL}, -}; - -static int8_t g_sensor_id = -1; -static struct mutex g_mutex; - -int sensor_read(SENSOR_INFO_P sinfo, struct i2c_adapter *adap, uint32_t addr, uint32_t *value) -{ - int ret; - uint8_t buf[4] = {0}; - uint8_t data[4] = {0}; - - uint8_t rlen = sinfo->id_value_len; - uint8_t wlen = sinfo->id_addr_len; - struct i2c_msg msg[2] = { - [0] = { - .addr = sinfo->i2c_addr, - .flags = 0, - .len = wlen, - .buf = buf, - }, - [1] = { - .addr = sinfo->i2c_addr, - .flags = I2C_M_RD, - .len = rlen, - .buf = data, - } - }; - - if (1 == wlen) { - buf[0] = addr&0xff; - } else if (2 == wlen){ - buf[0] = (addr>>8)&0xff; - buf[1] = addr&0xff; - } else if (3 == wlen){ - buf[0] = (addr>>16)&0xff; - buf[1] = (addr>>8)&0xff; - buf[2] = addr&0xff; - } else if (4 == wlen){ - buf[0] = (addr>>24)&0xff; - buf[1] = (addr>>16)&0xff; - buf[2] = (addr>>8)&0xff; - buf[3] = addr&0xff; - } else { - printk("error: %s,%d wlen = %d\n", __func__, __LINE__, wlen); - } - ret = i2c_transfer(adap, msg, 2); - if (ret > 0) ret = 0; - if (0 != ret) - printk("error: %s,%d ret = %d\n", __func__, __LINE__, ret); - if (1 == rlen) { - *value = data[0]; - } else if (2 == rlen){ - *value = (data[0]<<8)|data[1]; - } else if (3 == rlen){ - *value = (data[0]<<16)|(data[1]<<8)|data[2]; - } else if (4 == rlen){ - *value = (data[0]<<24)|(data[1]<<16)|(data[2]<<8)|data[3]; - } else { - printk("error: %s,%d rlen = %d\n", __func__, __LINE__, rlen); - } - printk(" sensor_read: addr=0x%x value = 0x%x\n", addr, *value); - return ret; -} -static int32_t process_one_adapter(struct device *dev, void *data) -{ - int32_t ret; - int32_t i = 0; - int32_t j = 0; - struct clk *mclk; - struct i2c_adapter *adap; - uint8_t scnt = sizeof(g_sinfo)/sizeof(g_sinfo[0]); - mutex_lock(&g_mutex); - if (dev->type != &i2c_adapter_type) { - mutex_unlock(&g_mutex); - return 0; - } - - adap = to_i2c_adapter(dev); - printk("name : %s nr : %d\n", adap->name, adap->nr); - - if (adap->nr != i2c_adapter_nr) { - mutex_unlock(&g_mutex); - return 0; - } - -#ifdef CONFIG_SOC_T40 - if(cim1_gpio != -1){ - ret = gpio_request(cim1_gpio,"cim1"); - if(!ret){ - jzgpio_set_func((cim1_gpio / 32), GPIO_FUNC_1, 1 << (cim1_gpio % 32)); - } - } -#endif - - for (i = 0; i < scnt; i++) { - uint8_t idcnt = g_sinfo[i].id_cnt; -#ifdef CONFIG_SOC_T40 - g_sinfo[i].clk_name = "div_cim1"; -#endif - mclk = clk_get(NULL, g_sinfo[i].clk_name); - if (IS_ERR(mclk)) { - printk("Cannot get sensor input clock cgu_cim\n"); - mutex_unlock(&g_mutex); - return PTR_ERR(mclk); - } - clk_set_rate(mclk, g_sinfo[i].clk); -#ifdef CONFIG_SOC_T40 - clk_prepare_enable(mclk); -#else - clk_enable(mclk); -#endif - if(reset_gpio != -1){ - ret = gpio_request(reset_gpio,"reset"); - if(!ret){ - gpio_direction_output(reset_gpio, 1); - msleep(20); - gpio_direction_output(reset_gpio, 0); - if(strcmp(g_sinfo[i].name, "sp1409") == 0) - msleep(600); - else{ - msleep(20); - gpio_direction_output(reset_gpio, 1); - msleep(20); - } - }else{ - printk("gpio requrest fail %d\n",reset_gpio); - } - } - if(pwdn_gpio != -1){ - ret = gpio_request(pwdn_gpio,"pwdn"); - if(!ret){ - gpio_direction_output(pwdn_gpio, 1); - msleep(150); - gpio_direction_output(pwdn_gpio, 0); - if(strcmp(g_sinfo[i].name, "sp1409") == 0) - msleep(600); - else - msleep(10); - }else{ - printk("gpio requrest fail %d\n",pwdn_gpio); - } - } - - for (j = 0; j < idcnt; j++) { - uint32_t value = 0; - ret = sensor_read(&g_sinfo[i], adap, g_sinfo[i].id_addr[j], &value); - if (0 != ret) { - printk("err sensor read addr = 0x%x, value = 0x%x\n", g_sinfo[i].id_addr[j], value); - break; - } - if(strcmp(g_sinfo[i].name, "ov2735b") == 0 && j == 2){ - if (value == g_sinfo[i].id_value[j]) - j++; - } - else - if (value != g_sinfo[i].id_value[j]) - break; - } - - if (-1 != reset_gpio) - gpio_free(reset_gpio); - if (-1 != pwdn_gpio) - gpio_free(pwdn_gpio); - clk_disable(mclk); - clk_put(mclk); - if (j == idcnt) { - printk("info: success sensor find : %s\n", g_sinfo[i].name); - g_sinfo[i].adap = adap; - g_sensor_id = i; - goto end_sensor_find; - } - } - printk("info: failed sensor find\n"); - g_sensor_id = -1; - mutex_unlock(&g_mutex); - return 0; -end_sensor_find: - mutex_unlock(&g_mutex); - return 0; -} - -static int32_t sensor_open(void) -{ - int ret = -1; - struct clk *mclk; - if (-1 == g_sensor_id) - return 0; - - mutex_lock(&g_mutex); -#ifdef CONFIG_SOC_T40 - g_sinfo[g_sensor_id].clk_name = "div_cim1"; -#endif - mclk = clk_get(NULL, g_sinfo[g_sensor_id].clk_name); - if (IS_ERR(mclk)) { - printk("Cannot get sensor input clock cgu_cim\n"); - mutex_unlock(&g_mutex); - return PTR_ERR(mclk); - } - clk_set_rate(mclk, g_sinfo[g_sensor_id].clk); -#ifdef CONFIG_SOC_T40 - clk_prepare_enable(mclk); -#else - clk_enable(mclk); -#endif - if(reset_gpio != -1){ - ret = gpio_request(reset_gpio,"reset"); - if(!ret){ - gpio_direction_output(reset_gpio, 1); - msleep(20); - gpio_direction_output(reset_gpio, 0); - msleep(20); - gpio_direction_output(reset_gpio, 1); - msleep(20); - }else{ - printk("gpio requrest fail %d\n",reset_gpio); - } - } - if(pwdn_gpio != -1){ - ret = gpio_request(pwdn_gpio,"pwdn"); - if(!ret){ - gpio_direction_output(pwdn_gpio, 1); - msleep(150); - gpio_direction_output(pwdn_gpio, 0); - msleep(10); - }else{ - printk("gpio requrest fail %d\n",pwdn_gpio); - } - } - mutex_unlock(&g_mutex); - return 0; -} - -static int32_t sensor_release(void) -{ - struct clk *mclk; - if (-1 == g_sensor_id) - return 0; - mutex_lock(&g_mutex); - mclk = clk_get(NULL, g_sinfo[g_sensor_id].clk_name); - if (IS_ERR(mclk)) { - printk("Cannot get sensor input clock cgu_cim\n"); - mutex_unlock(&g_mutex); - return PTR_ERR(mclk); - } - if (-1 != reset_gpio) - gpio_free(reset_gpio); - if (-1 != pwdn_gpio) - gpio_free(pwdn_gpio); - clk_disable(mclk); - clk_put(mclk); - mutex_unlock(&g_mutex); - return 0; -} - -static int32_t i2c_read_write(struct device *dev, void *data) -{ - int32_t ret; - struct i2c_adapter *adap; - struct i2c_trans *t = data; - - uint8_t buf[4] = {0}; - uint32_t value = 0; - uint8_t len = t->datalen; - struct i2c_msg msg = { - .addr = t->addr, - .flags = (t->r_w == I2C_WRITE)?0:I2C_M_RD, - .len = len, - .buf = buf, - }; - - - mutex_lock(&g_mutex); - if (dev->type != &i2c_adapter_type) { - mutex_unlock(&g_mutex); - return 0; - } - - adap = to_i2c_adapter(dev); - printk("name : %s nr : %d\n", adap->name, adap->nr); - - if (adap->nr != i2c_adapter_nr) { - mutex_unlock(&g_mutex); - return 0; - } - - if (I2C_WRITE == t->r_w) { - if (1 == len) { - buf[0] = (t->data)&0xff; - } else if (2 == len){ - buf[0] = ((t->data)>>8)&0xff; - buf[1] = (t->data)&0xff; - } else if (3 == len){ - buf[0] = ((t->data)>>16)&0xff; - buf[1] = ((t->data)>>8)&0xff; - buf[2] = (t->data)&0xff; - } else if (4 == len){ - buf[0] = ((t->data)>>24)&0xff; - buf[1] = ((t->data)>>16)&0xff; - buf[2] = ((t->data)>>8)&0xff; - buf[3] = (t->data)&0xff; - } else { - printk("error: %s,%d len = %d\n", __func__, __LINE__, len); - } - } - ret = i2c_transfer(adap, &msg, 1); - if (ret > 0) ret = 0; - if (0 != ret) - printk("error: %s,%d ret = %d\n", __func__, __LINE__, ret); - - if (I2C_READ == t->r_w) { - if (1 == len) { - value = buf[0]; - } else if (2 == len){ - value = (buf[0]<<8)|buf[1]; - } else if (3 == len){ - value = (buf[0]<<16)|(buf[1]<<8)|buf[2]; - } else if (4 == len){ - value = (buf[0]<<24)|(buf[1]<<16)|(buf[2]<<8)|buf[3]; - } else { - printk("error: %s,%d len = %d\n", __func__, __LINE__, len); - } - printk(" i2c: addr=0x%x value = 0x%x\n", t->addr, value); - } - mutex_unlock(&g_mutex); - return 0; -} -static long sinfo_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - int ret = 0; - int32_t data; - - mutex_lock(&g_mutex); - switch (cmd) { - case IOCTL_SINFO_GET: - if (-1 == g_sensor_id) - data = -1; - else - data = g_sensor_id; - if (copy_to_user((void *)arg, &data, sizeof(data))) { - printk("copy_from_user error!!!\n"); - ret = -EFAULT; - break; - } - break; - case IOCTL_SINFO_FLASH: - i2c_for_each_dev(NULL, process_one_adapter); - break; - default: - printk("invalid command: 0x%08x\n", cmd); - ret = -EINVAL; - } - mutex_unlock(&g_mutex); - return ret; -} -static int sinfo_open(struct inode *inode, struct file *filp) -{ - i2c_for_each_dev(NULL, process_one_adapter); - return 0; -} -static int sinfo_release(struct inode *inode, struct file *filp) -{ - printk ("misc sinfo_release\n"); - sensor_release(); - return 0; -} - -static ssize_t sinfo_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) -{ - return 0; -} - -static struct file_operations sinfo_fops = -{ - .owner = THIS_MODULE, - .read = sinfo_read, - .unlocked_ioctl = sinfo_ioctl, - .open = sinfo_open, - .release = sinfo_release, -}; - -static struct miscdevice misc_sinfo = { - .minor = MISC_DYNAMIC_MINOR, - .name = "sinfo", - .fops = &sinfo_fops, -}; - - -static int sinfo_proc_show(struct seq_file *m, void *v) -{ - if (-1 == g_sensor_id) - seq_printf(m, "sensor not found\n"); - else - seq_printf(m, "sensor :%s\n", g_sinfo[g_sensor_id].name); - return 0; -} - -static int sinfo_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, sinfo_proc_show, NULL); -} - -ssize_t sinfo_proc_write(struct file *filp, const char *buf, size_t len, loff_t *off) -{ - int ret = 0; - char cmd[100] = {0}; - uint32_t addr,data,datalen; - - if (len > 100) { - printk("err: cmd too long\n"); - return -EFAULT; - } - if(copy_from_user(cmd, buf, len)) - { - return -EFAULT; - } - /* probe sensor */ - if (!strncmp(cmd, "1", strlen("1"))) { - i2c_for_each_dev(NULL, process_one_adapter); - /* probe sensor */ - } else if (!strncmp(cmd, "probe", strlen("probe"))) { - i2c_for_each_dev(NULL, process_one_adapter); - /* sensor open/release i2c read/write - * open: set sensor clk,reset - * release: free clk,reset gpio - * - * example: sc2135 - * - * echo open:sc2135 > /proc/jz/sinfo/info - * echo i2c-w:0x30-0x3017-2 > /proc/jz/sinfo/info - * echo i2c-r:0x30-1 > /proc/jz/sinfo/info - * - * */ - } else if (!strncmp(cmd, "i2c-w:", strlen("i2c-w:"))) { - ret = sscanf(cmd, "i2c-w:%i-%i-%i", &addr, &data, &datalen); - if (3 != ret) { - printk("err: cmd error %s\n", cmd); - return len; - } else { - struct i2c_trans t = {addr, I2C_WRITE, data, datalen}; - printk("info: i2c-w:%d-%d-%d\n", addr, data, datalen); - i2c_for_each_dev(&t, i2c_read_write); - } - } else if (!strncmp(cmd, "i2c-r:", strlen("i2c-r:"))) { - ret = sscanf(cmd, "i2c-r:%i-%i", &addr, &datalen); - if (2 != ret) { - printk("err: cmd error %s\n", cmd); - return len; - } else { - struct i2c_trans t = {addr, I2C_READ, 0, datalen}; - printk("info: i2c-r:%d-%d\n", addr, datalen); - i2c_for_each_dev(&t, i2c_read_write); - } - } else if (!strncmp(cmd, "open", strlen("open"))) { - int i = 0; - char s[20] = {0}; - ret = sscanf(cmd, "open:%s", s); - if (1 != ret) { - printk("err: cmd error %s\n", cmd); - return len; - } else { - uint8_t scnt = sizeof(g_sinfo)/sizeof(g_sinfo[0]); - for (i = 0; i < scnt; i++) { - if (!strcmp(s, g_sinfo[i].name)) { - g_sensor_id = i; - break; - } - } - if (i >= scnt) { - printk("err: sensor not found %s, cmd %s\n", s, cmd); - return len; - } - sensor_open(); - } - } else if (!strncmp(cmd, "release", strlen("release"))) { - sensor_release(); - } else { - printk("err: cmd not support\n"); - } - return len; -} - -static const struct file_operations sinfo_proc_fops = { - .owner = THIS_MODULE, - .open = sinfo_proc_open, - .read = seq_read, - .write = sinfo_proc_write, - .llseek = seq_lseek, - .release = single_release, -}; - -struct proc_dir_entry *g_sinfo_proc; -static __init int init_sinfo(void) -{ - int ret = 0; - mutex_init(&g_mutex); -#ifdef CONFIG_SOC_T21 - *(volatile unsigned int*)(0xB0010104) = 0x1; -#endif - g_sinfo_proc = proc_mkdir("jz/sinfo", 0); - if (!g_sinfo_proc) { - printk("err: jz_proc_mkdir failed\n"); - } - proc_create_data("info", S_IRUGO, g_sinfo_proc, &sinfo_proc_fops, NULL); - /* i2c_for_each_dev(NULL, process_one_adapter); */ - ret = misc_register(&misc_sinfo); - /* printk("##### g_sensor_id = %d\n", g_sensor_id); */ - return ret; - -} - -static __exit void exit_sinfo(void) -{ - proc_remove(g_sinfo_proc); - misc_deregister(&misc_sinfo); -} - -module_init(init_sinfo); -module_exit(exit_sinfo); - -MODULE_DESCRIPTION("A Simple driver for get sensors info "); -MODULE_LICENSE("GPL"); diff --git a/general/package/ingenic-osdrv-t31/files/script/load_ingenic b/general/package/ingenic-osdrv-t31/files/script/load_ingenic index bf6ca3b5..3d7eb800 100755 --- a/general/package/ingenic-osdrv-t31/files/script/load_ingenic +++ b/general/package/ingenic-osdrv-t31/files/script/load_ingenic @@ -55,7 +55,7 @@ sync_sensor_param() { lsmod | grep "sinfo" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/sinfo.ko + modprobe sinfo check_return "insmod sinfo" fi @@ -162,31 +162,31 @@ echo -------------------- lsmod | grep "avpu" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/avpu.ko ${AVPU_PARAM} + modprobe avpu ${AVPU_PARAM} check_return "insmod avpu" fi lsmod | grep "tx_isp" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/tx-isp-${SOC}.ko ${ISP_PARAM} + modprobe tx-isp-${SOC} ${ISP_PARAM} check_return "insmod isp drv" fi lsmod | grep ${SENSOR} >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/sensor_${SENSOR}_${SOC}.ko ${SENSOR_PARAM} ${SENSOR_EXT_PARAM} + modprobe sensor_${SENSOR}_${SOC} ${SENSOR_PARAM} ${SENSOR_EXT_PARAM} check_return "insmod sensor drv" fi lsmod | grep "audio" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/audio.ko + modprobe audio check_return "insmod audio" fi lsmod | grep "gpio" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/gpio.ko + modprobe gpio check_return "insmod gpio" fi diff --git a/general/package/ingenic-osdrv-t31/ingenic-osdrv-t31.mk b/general/package/ingenic-osdrv-t31/ingenic-osdrv-t31.mk index c083906b..a65c8047 100644 --- a/general/package/ingenic-osdrv-t31/ingenic-osdrv-t31.mk +++ b/general/package/ingenic-osdrv-t31/ingenic-osdrv-t31.mk @@ -31,35 +31,8 @@ define INGENIC_OSDRV_T31_INSTALL_TARGET_CMDS $(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic # $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/*.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/audio.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/avpu.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/gpio.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sinfo.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/tx-isp-t31.ko - - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_gc2053_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_gc2083_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_gc4653_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_imx307_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_jxf37_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_jxh62_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_jxq03_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_jxq03p_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_sc200ai_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_sc2232h_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_sc2335_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_sc3338_t31.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/ingenic $(INGENIC_OSDRV_T31_PKGDIR)/files/kmod/sensor_sc5235_t31.ko - $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(INGENIC_OSDRV_T31_PKGDIR)/files/script/load* - $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(INGENIC_OSDRV_T31_PKGDIR)/files/script/ircut_demo - - # $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib/sensors/params - # $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/sensors/params $(INGENIC_OSDRV_T31_PKGDIR)/files/sensor/params/*.bin - - # $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib/sensors/params/WDR - # $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/sensors/params/WDR $(INGENIC_OSDRV_T31_PKGDIR)/files/sensor/params/WDR/*.bin $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib/ $(INGENIC_OSDRV_T31_PKGDIR)/files/lib/*.so diff --git a/general/package/ingenic-osdrv-t40/files/script/load_ingenic b/general/package/ingenic-osdrv-t40/files/script/load_ingenic index 677083b4..a2e56e28 100755 --- a/general/package/ingenic-osdrv-t40/files/script/load_ingenic +++ b/general/package/ingenic-osdrv-t40/files/script/load_ingenic @@ -24,7 +24,7 @@ check_return() { lsmod | grep "sinfo" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/sinfo.ko + modprobe sinfo check_return "insmod sinfo" fi @@ -79,31 +79,31 @@ echo -------------------- lsmod | grep "avpu" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/avpu.ko ${AVPU_PARAM} + modprobe avpu ${AVPU_PARAM} check_return "insmod avpu" fi lsmod | grep "tx_isp" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/tx-isp-${SOC}.ko ${ISP_PARAM} + modprobe tx-isp-${SOC} ${ISP_PARAM} check_return "insmod isp drv" fi lsmod | grep ${SENSOR} >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/sensor_${SENSOR}_${SOC}.ko ${SENSOR_PARAM} + modprobe sensor_${SENSOR}_${SOC} ${SENSOR_PARAM} check_return "insmod sensor drv" fi lsmod | grep "audio" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/audio.ko + modprobe audio check_return "insmod audio" fi lsmod | grep "gpio" >/dev/null if [ $? -ne 0 ]; then - insmod ${KMOD_PATH/%\//}/gpio.ko + modprobe gpio check_return "insmod gpio" fi diff --git a/general/package/ingenic-osdrv-t40/ingenic-osdrv-t40.mk b/general/package/ingenic-osdrv-t40/ingenic-osdrv-t40.mk index 1301b234..5fd7b523 100644 --- a/general/package/ingenic-osdrv-t40/ingenic-osdrv-t40.mk +++ b/general/package/ingenic-osdrv-t40/ingenic-osdrv-t40.mk @@ -24,24 +24,9 @@ define INGENIC_OSDRV_T40_INSTALL_TARGET_CMDS $(INSTALL) -m 644 -t $(TARGET_DIR)/etc/sensor $(INGENIC_OSDRV_T40_PKGDIR)/files/sensor/params/sc830ai-t40.bin $(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/4.4.94/ingenic - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/audio.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/avpu.ko $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/dtrng_dev.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/gpio.ko $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/mpsys.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sinfo.ko $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/soc-nna.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/tx-isp-t40.ko - - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_gc4653_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_imx307_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_imx335_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_imx415_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_jxk04_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_sc2232h_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_sc500ai_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_sc3335_t40.ko - $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/4.4.94/ingenic $(INGENIC_OSDRV_T40_PKGDIR)/files/kmod/sensor_sc5235_t40.ko $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/bin $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(INGENIC_OSDRV_T40_PKGDIR)/files/script/load*