update newboard support, add config_app bbfile
This commit is contained in:
parent
7327aeadbc
commit
5e0a96de8e
|
@ -21,6 +21,9 @@ bitbake -c cleanall lk && bitbake lk -f
|
|||
|
||||
bitbake -c cleanall linux-mtk-extension && bitbake linux-mtk-extension -f
|
||||
|
||||
### compile linux kernel
|
||||
bitbake linux-mtk-extension -c cleanall
|
||||
|
||||
### update
|
||||
|
||||
use adb to update image
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
DESCRIPTION = "config-app"
|
||||
LICENSE = "MediaTekProprietary"
|
||||
DEPENDS+="bluetooth openssl libev json-c alsa-lib curl"
|
||||
APPS_SRC = "${TOPDIR}/../src/apps/aud-base/config_app"
|
||||
|
||||
inherit workonsrc systemd
|
||||
|
||||
WORKONSRC = "${APPS_SRC}"
|
||||
|
||||
SYSTEMD_PACKAGES = "${PN}"
|
||||
SYSTEMD_SERVICE_${PN} = "config_app.service"
|
||||
|
||||
do_compile() {
|
||||
echo "Print Env"
|
||||
MULTI_CPU=-j7
|
||||
echo ${TOPDIR}
|
||||
echo ${COMBO_CHIP_ID}
|
||||
echo ${MTK_PROJECT}
|
||||
#cd ${S}/nvram_helper && make ${MULTI_CPU}
|
||||
sh ${S}/copy_include.sh ${TOPDIR} ${COMBO_CHIP_ID} ${MTK_PROJECT}
|
||||
echo ${S}
|
||||
cd ${S}/AssistantCenter && make
|
||||
cd ${S}/daemon_light && make ${MULTI_CPU}
|
||||
echo "fffffff"
|
||||
cd ${S} && make
|
||||
#cd ${S}/nvram_helper && make ${MULTI_CPU}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -d ${D}/etc/config_app
|
||||
install -d ${D}/data
|
||||
install -d ${D}/data/dingdong
|
||||
install -d ${D}/data/dingdong/etc
|
||||
|
||||
cp -a ${S}/data/etc/* ${D}/data/dingdong/etc/ #配置文件
|
||||
cp -a ${S}/data/etc_ro/* ${D}/etc/config_app/
|
||||
install -m 755 ${S}/AssistantCenter/dingdong-AssistantCenter ${D}${bindir}
|
||||
install -m 755 ${S}/config_app ${D}${bindir}
|
||||
install -m 755 ${S}/config_app.service ${D}${systemd_unitdir}/system
|
||||
install -m 755 ${S}/daemon_light/daemon.bin ${D}${bindir}
|
||||
}
|
||||
|
||||
FILES_${PN} += "/etc /data/dingdong"
|
||||
FILES_${PN} += "${systemd_unitdir}/system/config_app.service"
|
||||
INSANE_SKIP_${PN} += "already-stripped ldflags"
|
||||
FILES_${PN}-dev = ""
|
||||
|
|
@ -63,7 +63,7 @@ VERIFIED_KEY = "verified_key_doctor"
|
|||
MTEE_KEY = "mtee_key"
|
||||
FORCE_DISABLE_DM_VERITY = "yes"
|
||||
FORCE_DISABLE_TEE_ENCRYPTION = "yes"
|
||||
ENABLE_MTD_VERITY = "yes"
|
||||
ENABLE_MTD_VERITY = "no"
|
||||
|
||||
# Trustzone
|
||||
TZ_PROJECT = "aud8516"
|
||||
|
|
|
@ -20,8 +20,6 @@ CORE_IMAGE_EXTRA_INSTALL += " \
|
|||
"
|
||||
|
||||
IMAGE_INSTALL_append = " \
|
||||
${@base_contains('LICENSE_FLAGS_FFMPEG', 'yes', 'ffmpeg', '' ,d)} \
|
||||
${@base_contains('LICENSE_FLAGS_AISPEECH', 'yes', 'aispeech', '' ,d)} \
|
||||
${@base_contains('LICENSE_FLAGS_GMRENDER', 'yes', 'gmediarender', '' ,d)} \
|
||||
${@base_contains('LICENSE_FLAGS_BLUEZ', 'yes', 'bluez5', 'bluetooth' ,d)} \
|
||||
openssl \
|
||||
|
@ -36,6 +34,7 @@ IMAGE_INSTALL_append = " \
|
|||
prog \
|
||||
ntpdate \
|
||||
appmainprog \
|
||||
config-app \
|
||||
mic-asp \
|
||||
ppc \
|
||||
ppccli \
|
||||
|
@ -83,6 +82,8 @@ IMAGE_INSTALL_append = " \
|
|||
libgcrypt \
|
||||
zeromq \
|
||||
json-c \
|
||||
libev \
|
||||
iptables \
|
||||
"
|
||||
|
||||
install_proc() {
|
||||
|
|
66
src/kernel/linux/v4.4/arch/arm64/boot/dts/mediatek/aud8516p1v2_consys_slc_128_yocto.dts
Executable file → Normal file
66
src/kernel/linux/v4.4/arch/arm64/boot/dts/mediatek/aud8516p1v2_consys_slc_128_yocto.dts
Executable file → Normal file
|
@ -229,7 +229,7 @@
|
|||
mediatek,connectivity-combo {
|
||||
compatible = "mediatek,connectivity-combo";
|
||||
//gpio_combo_pmu_en_pin = <&pio 48 0>; /* GPIO_COMBO_PMU_EN_PIN */
|
||||
gpio_combo_rst_pin = <&pio 18 0>; /* GPIO_COMBO_RST_PIN pin */
|
||||
gpio_combo_rst_pin = <&pio 20 0>; /* GPIO_COMBO_RST_PIN pin */
|
||||
gpio_wifi_eint_pin = <&pio 20 0>; /* GPIO_WIFI_EINT_PIN */
|
||||
gpio_gps_sync_pin = <&pio 4 0>; /* GPIO_GPS_SYNC_PIN */
|
||||
/*gpio_gps_lna_pin = <&pio 3 0>;*/ /* GPIO_GPS_LNA_PIN */
|
||||
|
@ -273,20 +273,16 @@
|
|||
status = "okay";
|
||||
};*/
|
||||
|
||||
|
||||
};
|
||||
&spi {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi_pins_0>;
|
||||
feier_gpioint {
|
||||
compatible = "mediatek,feier_gpioint";
|
||||
interrupts-extended = <&pio 3 IRQ_TYPE_LEVEL_LOW>,
|
||||
<&pio 0 IRQ_TYPE_LEVEL_LOW>;
|
||||
charge_en = <&pio 1 0>;
|
||||
touch-debounce = <20>;
|
||||
status = "okay";
|
||||
spidev: spidev@0 {
|
||||
compatible = "st7789v";
|
||||
reg = <0>;
|
||||
reset_gpio = <&pio 11 0>;
|
||||
wr_sel_gpio = <&pio 10 0>;
|
||||
spi-max-frequency = <40000000>;
|
||||
};
|
||||
};
|
||||
|
||||
&accdet {
|
||||
interrupts-extended = <&sysirq GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
|
||||
// <&pio 0 IRQ_TYPE_LEVEL_HIGH>;
|
||||
|
@ -317,11 +313,6 @@
|
|||
|
||||
};
|
||||
|
||||
&bat_comm {
|
||||
//interrupt-parent = <&pmic>;
|
||||
//interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts-extended = <&pio 0 IRQ_TYPE_LEVEL_LOW>;
|
||||
};
|
||||
|
||||
&consys {
|
||||
pinctrl-names = "default", "gps_lna_state_init", "gps_lna_state_oh", "gps_lna_state_ol";
|
||||
|
@ -421,11 +412,7 @@
|
|||
regulator-always-on;
|
||||
vsel-gpio = <&pio 34 0>;
|
||||
};
|
||||
SGM41511@6B{
|
||||
compatible = "SG,SGM41511-charger";
|
||||
reg = <0x6B>;
|
||||
ce-gpio = <&pio 1 0>;
|
||||
};
|
||||
|
||||
|
||||
/*<zhongjinrong added for led driver begin*/
|
||||
/*
|
||||
|
@ -450,17 +437,6 @@
|
|||
aw20036,max_brightness = <255>;
|
||||
};
|
||||
};
|
||||
cht8305_dev@38 {
|
||||
compatible = "sensylink,cht8305_dev";
|
||||
reg = <0x40>;
|
||||
status = "ok";
|
||||
};
|
||||
cw2015_dev@62 {
|
||||
/*compatible = "cellwise,cw2015_dev";*/
|
||||
compatible = "cellwise,cw2015";
|
||||
reg = <0x62>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
@ -473,8 +449,8 @@
|
|||
tlv320aic:tlv320aic@18 {
|
||||
compatible = "mediatek,tlv320aic";
|
||||
reg = <0x18>;
|
||||
rst-gpio = <&pio 24 0>;
|
||||
/* pdn-gpio = <&pio 2 0 >;
|
||||
/* rst-gpio = <&pio 24 0>;
|
||||
pdn-gpio = <&pio 2 0 >;
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -484,11 +460,6 @@
|
|||
|
||||
};
|
||||
|
||||
&irrx {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&irrx_pins_ir_input>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&keypad {
|
||||
pinctrl-names = "default";
|
||||
|
@ -583,7 +554,7 @@
|
|||
|
||||
pwm_goio_def_cfg: pwmdefault {
|
||||
pins_cmd_dat {
|
||||
pinmux = <MT8167_PIN_12_EINT12__FUNC_PWM_A>;
|
||||
pinmux = <MT8167_PIN_24_EINT24__FUNC_PWM_A>;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -808,7 +779,7 @@
|
|||
*/
|
||||
pcfg_combo_rst_pull_dis_cfgs:cfg_rst_pull_dis {
|
||||
combo_pins {
|
||||
pins = <MT8167_PIN_18_EINT18__FUNC_GPIO18>;
|
||||
pins = <MT8167_PIN_20_EINT20__FUNC_GPIO20>;
|
||||
bias-disable;
|
||||
};
|
||||
};
|
||||
|
@ -953,15 +924,7 @@
|
|||
};
|
||||
*/
|
||||
|
||||
spi_pins_0: spi0@0 {
|
||||
pins_spi {
|
||||
pinmux = <MT8167_PIN_48_SPI_CS__FUNC_SPI_CSB>,
|
||||
<MT8167_PIN_49_SPI_CK__FUNC_SPI_CLK>,
|
||||
<MT8167_PIN_50_SPI_MI__FUNC_SPI_MI>,
|
||||
<MT8167_PIN_51_SPI_MO__FUNC_SPI_MO>;
|
||||
bias-disable;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1020,3 +983,4 @@
|
|||
pinctrl-0 = <&pwm_goio_def_cfg>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
@ -1441,25 +1441,26 @@
|
|||
/* led part */
|
||||
led0:led@0 {
|
||||
compatible = "mediatek,red";
|
||||
// led_mode = <1>;
|
||||
// data = <1>;
|
||||
// pwm_config = <0 0 0 0 0>;
|
||||
// ate_gpio = <&pio 0 0>;
|
||||
led_mode = <2>;
|
||||
data = < >;
|
||||
pwm_config = <0 0 0 0 0>;
|
||||
ate_gpio = <&pio 18 0>;
|
||||
};
|
||||
|
||||
led1:led@1 {
|
||||
compatible = "mediatek,green";
|
||||
// led_mode = <1>;
|
||||
// data = <2>;
|
||||
// pwm_config = <0 0 0 0 0>;
|
||||
// ate_gpio = <&pio 1 0>;
|
||||
led_mode = <2>;
|
||||
data = < >;
|
||||
pwm_config = <0 0 0 0 0>;
|
||||
ate_gpio = <&pio 19 0>;
|
||||
};
|
||||
|
||||
led2:led@2 {
|
||||
compatible = "mediatek,blue";
|
||||
led_mode = <1>;
|
||||
data = <0>;
|
||||
pwm_config = <0 0 0 0 0>;
|
||||
/*CLK_DIV128 = 7*/
|
||||
pwm_config = <0 7 0 0 0>;
|
||||
//iate_gpio = <&pio 12 0>;
|
||||
};
|
||||
|
||||
|
@ -1606,3 +1607,4 @@
|
|||
compatible = "mediatek,lcm";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
19
src/kernel/linux/v4.4/arch/arm64/configs/aud8516p1v2_consys_slc_yocto_defconfig
Executable file → Normal file
19
src/kernel/linux/v4.4/arch/arm64/configs/aud8516p1v2_consys_slc_yocto_defconfig
Executable file → Normal file
|
@ -146,7 +146,7 @@ CONFIG_MTD48=y
|
|||
CONFIG_MTD_NAND=y
|
||||
CONFIG_MTD_NAND_MTK=y
|
||||
CONFIG_MTD_UBI=y
|
||||
CONFIG_MTD_VERITY=y
|
||||
CONFIG_MTD_VERITY=n
|
||||
CONFIG_ZRAM=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_MEDIATEK_SOLUTION=y
|
||||
|
@ -203,7 +203,9 @@ CONFIG_MTK_DRAMC=y
|
|||
# CONFIG_MTK_EMI_MPU is not set
|
||||
# CONFIG_MTK_GPIO is not set
|
||||
# CONFIG_MTK_LEDS is not set
|
||||
# CONFIG_MTK_LEDS=y
|
||||
CONFIG_MTK_LEDS=y
|
||||
CONFIG_LEDS_TRIGGERS=y
|
||||
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||
# CONFIG_MTK_M4U is not set
|
||||
# CONFIG_MTK_PSEUDO_M4U is not set
|
||||
CONFIG_MTK_PWM=y
|
||||
|
@ -264,7 +266,7 @@ CONFIG_NET_VENDOR_MEDIATEK=y
|
|||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_KEYBOARD_MTK=y
|
||||
CONFIG_KEYBOARD_GPIO=y
|
||||
CONFIG_KEYBOARD_MTK_PMIC=y
|
||||
# CONFIG_KEYBOARD_MTK_PMIC is not set
|
||||
CONFIG_INPUT_MISC=y
|
||||
CONFIG_INPUT_UINPUT=y
|
||||
# CONFIG_VT is not set
|
||||
|
@ -488,19 +490,18 @@ CONFIG_NEW_LEDS=y
|
|||
CONFIG_LEDS_CLASS=y
|
||||
# end for usb storage support
|
||||
CONFIG_DEBUG_FS=y
|
||||
CONFIG_MTK_SWCHR_SUPPORT=y
|
||||
CONFIG_MTK_SMART_BATTERY=y
|
||||
CONFIG_MTK_SGM4151_SUPPORT=y
|
||||
#CONFIG_MTK_SWCHR_SUPPORT=y
|
||||
#CONFIG_MTK_SMART_BATTERY=y
|
||||
#CONFIG_MTK_SGM4151_SUPPORT=y
|
||||
CONFIG_POWER_DEBUG=y
|
||||
#CONFIG_USB_MTK_CHARGER_DETECT=y
|
||||
#CONFIG_MTK_LCM=is not set
|
||||
#CONFIG_MTK_FB=y
|
||||
CONFIG_FB=y
|
||||
CONFIG_FB_DEFERRED_IO=y
|
||||
#CONFIG_FB=y
|
||||
#CONFIG_FB_DEFERRED_IO=y
|
||||
#CONFIG_CUSTOM_KERNEL_LCM=b20c24017q_qvga_cmd is not set
|
||||
CONFIG_SPI_SPIDEV=y
|
||||
CONFIG_SPI_MT65XX=y
|
||||
CONFIG_MTK_LEDS=y
|
||||
|
||||
CONFIG_NETWORK_FILESYSTEMS=y
|
||||
CONFIG_NFS_FS=y
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
# GNU General Public License for more details.
|
||||
#
|
||||
#ccflags-y += -I$(srctree)/drivers/misc/mediatek/feier_infrad
|
||||
obj-y += cht8305.o
|
||||
obj-y += cw2015_fuel_gauge_V5.0.o
|
||||
#obj-y += feier_infrad.o
|
||||
#obj-y += leds-aw9523.o
|
||||
#obj-y += aht10.o
|
||||
#obj-y += cht8305.o
|
||||
#obj-y += cw2015_fuel_gauge_V5.0.o
|
||||
#obj-y += cw2015.o
|
||||
obj-y += leds-aw20036.o
|
||||
obj-y += feier_gpioint.o
|
||||
#obj-y += spi-st7789v.o
|
||||
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
/*
|
||||
* Feier Smart gpioint Driver
|
||||
*
|
||||
* Copyright (C) 2018 Feier
|
||||
*
|
||||
* Authors: yang
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/sched/rt.h> /* MAX_RT_PRIO */
|
||||
|
||||
#include <mt-plat/mtk_pwm.h>
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <asm-generic/gpio.h>
|
||||
#endif
|
||||
|
||||
static int gpioint,chargeint,charge_en;
|
||||
//#include "feier_infrad.h"
|
||||
|
||||
struct device *gdevb;
|
||||
void report_func(unsigned long data);
|
||||
|
||||
struct tasklet_struct gpioint_tasklet; //定义tasklet结构体
|
||||
//DECLEAR_TASKLET(gpioint_tasklet, report_func,(unsigned long)123);
|
||||
|
||||
|
||||
void mute_status_report(void)
|
||||
{
|
||||
//unsigned long flags;
|
||||
char module_name[16];
|
||||
char udev_event[128];
|
||||
char *envp[] = { module_name, udev_event, NULL };
|
||||
const char *event;
|
||||
static unsigned int oldstat=-1;
|
||||
|
||||
int newstat = gpio_get_value(gpioint);
|
||||
printk("newstat %d\n",newstat);
|
||||
if(gdevb!=NULL)
|
||||
{
|
||||
if(oldstat!=newstat)
|
||||
{
|
||||
printk("2newstat %d\n",newstat);
|
||||
oldstat = newstat;
|
||||
if(newstat==0)
|
||||
{
|
||||
event = "mute";
|
||||
}else
|
||||
{
|
||||
|
||||
event = "unmute";
|
||||
}
|
||||
|
||||
snprintf(module_name, 16, "MODULE=%s", "gpioint");
|
||||
snprintf(udev_event, 128, "EVENT=%s", event);
|
||||
printk("3newstat %d\n",newstat);
|
||||
if(newstat==0)
|
||||
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
|
||||
else
|
||||
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void charge_status_report(void)
|
||||
{
|
||||
//unsigned long flags;
|
||||
char *event = NULL;
|
||||
char *envp[2];
|
||||
const char *name;
|
||||
static unsigned int oldstat=-1;
|
||||
|
||||
int newstat = gpio_get_value(chargeint);
|
||||
printk("chargeint %d\n",newstat);
|
||||
if(gdevb!=NULL)
|
||||
{
|
||||
if(oldstat!=newstat)
|
||||
{
|
||||
printk("2newstat %d\n",newstat);
|
||||
oldstat = newstat;
|
||||
if(newstat==0)
|
||||
{
|
||||
name = "off";
|
||||
}else
|
||||
{
|
||||
name = "on";
|
||||
}
|
||||
event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
|
||||
printk("event %p\n",event);
|
||||
if (event) {
|
||||
envp[0] = event;
|
||||
envp[1] = NULL;
|
||||
printk("3newstat %d\n",newstat);
|
||||
if(newstat==0)
|
||||
kobject_uevent_env(&gdevb->kobj, KOBJ_REMOVE, envp);
|
||||
else
|
||||
kobject_uevent_env(&gdevb->kobj, KOBJ_ADD, envp);
|
||||
kfree(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void report_func(unsigned long data)
|
||||
{
|
||||
mute_status_report();
|
||||
}
|
||||
|
||||
|
||||
static irqreturn_t feier_mute_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
//printk("feier_mute_interrupt....\n");
|
||||
// mute_status_report();
|
||||
tasklet_schedule(&gpioint_tasklet);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t feier_charge_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
|
||||
printk("feier_charge_interrupt....\n");
|
||||
// charge_status_report();
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static ssize_t feier_gpioint_mute_status_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int stat = gpio_get_value(gpioint);
|
||||
return sprintf(buf, "mutestat = %d\n", stat);
|
||||
}
|
||||
static ssize_t feier_gpioint_charge_status_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int stat = gpio_get_value(chargeint);
|
||||
return sprintf(buf, "chargeint = %d\n", stat);
|
||||
}
|
||||
static ssize_t feier_gpioint_charge_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int stat = gpio_get_value(charge_en);
|
||||
return sprintf(buf, "charge_en = %d\n", stat);
|
||||
}
|
||||
|
||||
static ssize_t feier_gpioint_charge_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len)
|
||||
{
|
||||
int rc, _data_enable;
|
||||
rc = sscanf(buf, "%d", &_data_enable);
|
||||
if(_data_enable == 0)
|
||||
{
|
||||
gpio_set_value(charge_en, 0);
|
||||
}
|
||||
else{
|
||||
gpio_set_value(charge_en, 1);
|
||||
}
|
||||
return len;
|
||||
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(mute_status, 0664, feier_gpioint_mute_status_show, NULL);
|
||||
static DEVICE_ATTR(charge_status, 0664, feier_gpioint_charge_status_show, NULL);
|
||||
static DEVICE_ATTR(charge_enable, 0664, feier_gpioint_charge_enable_show, feier_gpioint_charge_enable_store);
|
||||
|
||||
static struct attribute *feier_gpioint_attributes[] = {
|
||||
&dev_attr_mute_status.attr,
|
||||
&dev_attr_charge_status.attr,
|
||||
&dev_attr_charge_enable.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group feier_gpioint_attr_group = {
|
||||
.attrs = feier_gpioint_attributes
|
||||
};
|
||||
|
||||
static int feier_gpioint_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret = -1;
|
||||
struct device_node *node;
|
||||
unsigned int irqmute,irqchr;
|
||||
|
||||
printk("Feier gpioint Probe...\n");
|
||||
|
||||
node = pdev->dev.of_node;
|
||||
if (node == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
ret = sysfs_create_group(&pdev->dev.kobj, &feier_gpioint_attr_group);
|
||||
tasklet_init(&gpioint_tasklet, report_func, (unsigned long)123);
|
||||
|
||||
gpioint = of_get_named_gpio(node, "interrupts-extended", 0);
|
||||
irqmute = irq_of_parse_and_map(node, 0);
|
||||
printk("irqmute = %d\n", irqmute);
|
||||
ret = request_irq(irqmute, feier_mute_interrupt,
|
||||
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_mute", pdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "fail to request irq\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
chargeint = of_get_named_gpio(node, "interrupts-extended", 1);
|
||||
irqchr = irq_of_parse_and_map(node, 1);
|
||||
printk("irqchr = %d\n", irqchr);
|
||||
ret = request_irq(irqchr, feier_charge_interrupt,
|
||||
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_chrint", pdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "fail to request irq\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
charge_en = of_get_named_gpio(node, "charge_en", 0);
|
||||
ret = gpio_request(charge_en, "charge_en");
|
||||
if (ret)
|
||||
printk("gpio_request fail, ret(%d)\n", ret);
|
||||
gpio_direction_output(charge_en, 0);
|
||||
|
||||
|
||||
irq_set_irq_wake(irqmute, 1);
|
||||
irq_set_irq_wake(irqchr, 1);
|
||||
gdevb =&(pdev->dev);
|
||||
printk("Feier gpioint Probe done...\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int feier_gpioint_remove(struct platform_device *pdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id gpioint_match_table[] = {
|
||||
{ .compatible = "mediatek,feier_gpioint",},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, gpioint_match_table);
|
||||
#endif
|
||||
|
||||
static struct platform_driver gpioint_driver = {
|
||||
.probe = feier_gpioint_probe,
|
||||
.remove = feier_gpioint_remove,
|
||||
.driver = {
|
||||
.name = "Feier_gpioint",
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef CONFIG_OF
|
||||
.of_match_table = of_match_ptr(gpioint_match_table),
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
static int __init gpioint_init(void)
|
||||
{
|
||||
printk("Feier gpioint driver.\n");
|
||||
platform_driver_register(&gpioint_driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit gpioint_exit(void)
|
||||
{
|
||||
tasklet_kill(&gpioint_tasklet);
|
||||
platform_driver_unregister(&gpioint_driver);
|
||||
}
|
||||
|
||||
module_init(gpioint_init);
|
||||
module_exit(gpioint_exit);
|
||||
|
||||
MODULE_AUTHOR("yang");
|
||||
MODULE_DESCRIPTION("Feier Redhat gpioint driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -180,6 +180,19 @@ void mt_set_bl_frequency(unsigned int freq)
|
|||
bl_frequency_hal = freq;
|
||||
}
|
||||
|
||||
int mt_set_gpio_led_set_brightness(int gpio,int level)
|
||||
{
|
||||
if(level==0)
|
||||
{
|
||||
if (gpio_is_valid(gpio))
|
||||
gpio_direction_output(gpio, 0);
|
||||
}else
|
||||
{
|
||||
if (gpio_is_valid(gpio))
|
||||
gpio_direction_output(gpio, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
||||
{
|
||||
struct device_node *led_node = NULL;
|
||||
|
@ -215,12 +228,7 @@ struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
|||
pled_dtsi[i].mode = 0;
|
||||
pled_dtsi[i].data = -1;
|
||||
} else {
|
||||
ate_gpio = of_get_named_gpio(led_node, "ate_gpio", 0);
|
||||
if (gpio_is_valid(ate_gpio)) {
|
||||
ret = gpio_request(ate_gpio, "ate_gpio");
|
||||
if (ret)
|
||||
LEDS_INFO("cannot find gpio from dts %d\n", ate_gpio);
|
||||
}
|
||||
|
||||
|
||||
isSupportDTS = true;
|
||||
ret =
|
||||
|
@ -282,6 +290,27 @@ struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
|||
} else
|
||||
LEDS_DEBUG
|
||||
("led dts can not get pwm config data.\n");
|
||||
switch (pled_dtsi[i].mode) {
|
||||
case MT65XX_LED_MODE_GPIO:
|
||||
ate_gpio = of_get_named_gpio(led_node, "ate_gpio", 0);
|
||||
if (gpio_is_valid(ate_gpio)) {
|
||||
ret = gpio_request(ate_gpio, "ate_gpio");
|
||||
if (ret)
|
||||
LEDS_INFO("cannot find gpio from dts %d\n", ate_gpio);
|
||||
printk("get ate_gpio ret %d\n ate_gpio:%d ",ret,ate_gpio);
|
||||
pled_dtsi[i].config_data.clock_source = ate_gpio;//use clock_soure for gpio pin
|
||||
}else{
|
||||
//printk("ate_gpio gpio_is_valid :%d\n ",ate_gpio);
|
||||
}
|
||||
pled_dtsi[i].data =
|
||||
(long)mt_set_gpio_led_set_brightness;
|
||||
LEDS_DEBUG
|
||||
("kernel:the backlight hw mode is LCM.\n");
|
||||
printk("datais :%ld",pled_dtsi[i].data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
switch (pled_dtsi[i].mode) {
|
||||
case MT65XX_LED_MODE_CUST_LCM:
|
||||
|
@ -363,15 +392,19 @@ int mt_led_set_pwm(int pwm_num, struct nled_setting *led)
|
|||
/* Actually, the setting still can not to turn off NLED. We should disable PWM to turn off NLED. */
|
||||
case NLED_OFF:
|
||||
pwm_setting.PWM_MODE_OLD_REGS.THRESH = 0;
|
||||
pwm_setting.clk_div = CLK_DIV1;
|
||||
if(led->div >= CLK_DIV_MAX)
|
||||
led->div = CLK_DIV1;
|
||||
pwm_setting.clk_div = led->div;
|
||||
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 100 / 2;
|
||||
break;
|
||||
|
||||
case NLED_ON:
|
||||
/*pwm_setting.PWM_MODE_OLD_REGS.THRESH = 1000 / 2;*/
|
||||
pwm_setting.clk_div = CLK_DIV1;
|
||||
if(led->div >= CLK_DIV_MAX)
|
||||
led->div = CLK_DIV1;
|
||||
pwm_setting.clk_div = led->div;
|
||||
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 1020;
|
||||
pwm_setting.PWM_MODE_OLD_REGS.THRESH =led->nled_level;//pin pwoer low for ledon
|
||||
pwm_setting.PWM_MODE_OLD_REGS.THRESH = led->nled_level;
|
||||
break;
|
||||
|
||||
case NLED_BLINK:
|
||||
|
@ -931,7 +964,7 @@ int mt_brightness_set_pmic_duty_store(u32 level, u32 div)
|
|||
|
||||
int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||
{
|
||||
struct nled_setting led_tmp_setting = { 0, 0, 0 };
|
||||
struct nled_setting led_tmp_setting = { 0, 0, 0 ,0};
|
||||
int tmp_level = level;
|
||||
unsigned int BacklightLevelSupport =
|
||||
Cust_GetBacklightLevelSupport_byPWM();
|
||||
|
@ -959,16 +992,16 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
|||
bl_duty_hal = level;
|
||||
|
||||
} else {
|
||||
|
||||
if (level == 0) {
|
||||
led_tmp_setting.nled_mode = NLED_OFF;
|
||||
led_tmp_setting.div = cust->config_data.div;
|
||||
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
||||
mt_pwm_disable(cust->data,
|
||||
cust->config_data.pmic_pad);
|
||||
} else {
|
||||
led_tmp_setting.nled_level = 4*tmp_level;
|
||||
led_tmp_setting.nled_mode = NLED_ON;
|
||||
|
||||
led_tmp_setting.div = cust->config_data.div;
|
||||
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +1022,7 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
|||
}
|
||||
mutex_unlock(&bl_level_limit_mutex);
|
||||
#endif
|
||||
return ((cust_set_brightness) (cust->data)) (level);
|
||||
return ((cust_set_brightness) (cust->data)) (cust->config_data.clock_source,level);
|
||||
|
||||
case MT65XX_LED_MODE_PMIC:
|
||||
|
||||
|
@ -1017,7 +1050,7 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
|||
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
||||
if (strcmp(cust->name, "lcd-backlight") == 0)
|
||||
bl_brightness_hal = level;
|
||||
return ((cust_set_brightness) (cust->data)) (level);
|
||||
return ((cust_set_brightness) (cust->data)) (cust->config_data.clock_source,level);//use clock_soure for gpio pin
|
||||
|
||||
case MT65XX_LED_MODE_NONE:
|
||||
default:
|
||||
|
@ -1043,10 +1076,8 @@ void mt_mt65xx_led_set(struct led_classdev *led_cdev, enum led_brightness level)
|
|||
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
||||
/* unsigned long flags; */
|
||||
/* spin_lock_irqsave(&leds_lock, flags); */
|
||||
|
||||
output_met_backlight_tag(level);
|
||||
|
||||
#if 0
|
||||
output_met_backlight_tag(level);
|
||||
if (level == 0) {
|
||||
if (gpio_is_valid(ate_gpio))
|
||||
gpio_direction_output(ate_gpio, 0);
|
||||
|
@ -1055,7 +1086,6 @@ void mt_mt65xx_led_set(struct led_classdev *led_cdev, enum led_brightness level)
|
|||
gpio_direction_output(ate_gpio, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MTK_AAL_SUPPORT
|
||||
if (led_data->level != level) {
|
||||
led_data->level = level;
|
||||
|
@ -1125,7 +1155,7 @@ int mt_mt65xx_blink_set(struct led_classdev *led_cdev,
|
|||
struct mt65xx_led_data *led_data =
|
||||
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
||||
static int got_wake_lock;
|
||||
struct nled_setting nled_tmp_setting = { 0, 0, 0 };
|
||||
struct nled_setting nled_tmp_setting = { 0, 0, 0,0 };
|
||||
|
||||
/* only allow software blink when delay_on or delay_off changed */
|
||||
if (*delay_on != led_data->delay_on
|
||||
|
@ -1190,3 +1220,4 @@ int mt_mt65xx_blink_set(struct led_classdev *led_cdev,
|
|||
/* delay_on and delay_off are not changed */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ enum mt65xx_led_mode {
|
|||
|
||||
/* backlight call back function */
|
||||
typedef int (*cust_brightness_set) (int level, int div);
|
||||
typedef int (*cust_set_brightness) (int level);
|
||||
|
||||
typedef int (*cust_set_brightness) (int gpio,int level);
|
||||
/* 10bit backlight level */
|
||||
#define LED_INCREASE_LED_LEVEL_MTKPATCH
|
||||
#ifdef LED_INCREASE_LED_LEVEL_MTKPATCH
|
||||
|
@ -187,6 +186,7 @@ struct nled_setting {
|
|||
u32 nled_level;
|
||||
u32 blink_on_time;
|
||||
u32 blink_off_time;
|
||||
int div;
|
||||
};
|
||||
|
||||
#endif /* _LEDS_SW_H */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* variables
|
||||
***************************************************************************/
|
||||
struct cust_mt65xx_led *bl_setting;
|
||||
//static unsigned int bl_div = CLK_DIV1;
|
||||
static unsigned int bl_div = CLK_DIV1;
|
||||
#define PWM_DIV_NUM 8
|
||||
static unsigned int div_array[PWM_DIV_NUM];
|
||||
struct mt65xx_led_data *g_leds_data[MT65XX_LED_TYPE_TOTAL];
|
||||
|
@ -52,7 +52,7 @@ static int debug_enable_led = 1;
|
|||
/* #define pr_fmt(fmt) "[LED_DRV]"fmt */
|
||||
#define LEDS_DRV_DEBUG(format, args...) do { \
|
||||
if (debug_enable_led) { \
|
||||
pr_debug(format, ##args);\
|
||||
printk(format, ##args);\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -154,7 +154,7 @@ static void get_div_array(void)
|
|||
i++;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
||||
static int led_set_pwm(int pwm_num, struct nled_setting *led)
|
||||
{
|
||||
|
||||
|
@ -169,7 +169,6 @@ static int brightness_set_pmic(enum mt65xx_led_pmic pmic_type, u32 level,
|
|||
return -1;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||
{
|
||||
|
@ -743,11 +742,10 @@ static int mt65xx_leds_suspend(struct platform_device *pdev, pm_message_t state)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
struct nled_setting led_tmp_setting = { NLED_OFF, 0, 0 };
|
||||
struct nled_setting led_tmp_setting = { NLED_OFF, 0, 0, 0 };
|
||||
|
||||
LEDS_DRV_DEBUG("%s\n", __func__);
|
||||
LEDS_DRV_DEBUG("mt65xx_leds_shutdown: turn off backlight\n");
|
||||
|
@ -764,6 +762,7 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
|||
/* mt_pwm_power_off (g_leds_data[i]->cust.data); */
|
||||
mt_led_pwm_disable(g_leds_data[i]->cust.data);
|
||||
} else {
|
||||
led_tmp_setting.div = g_leds_data[i]->cust.config_data.div;
|
||||
led_set_pwm(g_leds_data[i]->cust.data,
|
||||
&led_tmp_setting);
|
||||
}
|
||||
|
@ -783,7 +782,7 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
|||
break;
|
||||
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
||||
LEDS_DRV_DEBUG("backlight control through BLS!!1\n");
|
||||
((cust_set_brightness) (g_leds_data[i]->cust.data)) (0);
|
||||
((cust_set_brightness) (g_leds_data[i]->cust.data)) (g_leds_data[i]->cust.config_data.clock_source,0);
|
||||
break;
|
||||
case MT65XX_LED_MODE_NONE:
|
||||
default:
|
||||
|
@ -792,7 +791,6 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct platform_driver mt65xx_leds_driver = {
|
||||
.driver = {
|
||||
|
@ -802,7 +800,7 @@ static struct platform_driver mt65xx_leds_driver = {
|
|||
.probe = mt65xx_leds_probe,
|
||||
.remove = mt65xx_leds_remove,
|
||||
/* .suspend = mt65xx_leds_suspend, */
|
||||
/*.shutdown = mt65xx_leds_shutdown,*/
|
||||
.shutdown = mt65xx_leds_shutdown,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
|
@ -852,3 +850,4 @@ MODULE_AUTHOR("MediaTek Inc.");
|
|||
MODULE_DESCRIPTION("LED driver for MediaTek MT65xx chip");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("leds-mt65xx");
|
||||
|
||||
|
|
Loading…
Reference in New Issue