MTK平台释疑android M 配置中断相关问题
1.使用老方法(android L)配置中断,调用request_irq函数时出错,错误代码 -22
Dear Customer:
您好!
如电话沟通,贵司可以在发过来的code基础上做下面的修改再试试:
(1)修改aw8155.c
static int aw8155_drv_probe(struct platform_device *dev)
{
//...
// ------------------ here add your code to init device tree
-------------------- start
aw8155_pinctrl1 =
devm_pinctrl_get(&dev->dev);
if (IS_ERR(aw8155_pinctrl1)) {
AW8155_LOGE("devm_pinctrl_get error\n");
}
else{ //add
pins_default = pinctrl_lookup_state(aw8155_pinctrl1, "default");
if
(IS_ERR(pins_default)) {
AW8155_LOGE("pinctrl_lookup_state default
error\n");
}
pa_pins_int = pinctrl_lookup_state(aw8155_pinctrl1,
"pa_ctl_output0");
if (IS_ERR(pa_pins_int)) {
AW8155_LOGE("pinctrl_lookup_state pa_ctl_output0 error\n");
}
else
//add
pinctrl_select_state(aw8155_pinctrl1, pa_pins_int);
}
// ------------------ here add your code to init device tree ---------------------- end
//...
#if 0 //add
static struct platform_device
aw8155_platform_device = {
.name = "aw8155",
.id = -1,
.dev = {
.release = aw8155_dev_release,
}
};
#endif
static int __init
aw8155_init(void)
{
int ret = 0;
AW8155_LOGD("+%s\n", __func__);
#if 0 //add
ret = platform_device_register
(&aw8155_platform_device);
if (ret) {
AW8155_LOGE("platform_device_register fail\n");
return ret;
}
#endif
(2)修改fc8180_spi.c
static int dtveint_drv_probe(struct
platform_device *dev)
{
//...
eint_pinctrl =
devm_pinctrl_get(&dev->dev);
if (IS_ERR(eint_pinctrl)) {
printk(KERN_INFO "eintDebug devm_pinctrl_get error\n");
}
else{
//add
pins_default = pinctrl_lookup_state(eint_pinctrl, "default");
if
(IS_ERR(pins_default)) {
printk(KERN_INFO "eintDebug pinctrl_lookup_state
default error\n");
}
eint_pins = pinctrl_lookup_state(eint_pinctrl,
"eint_cfg");
if (IS_ERR(eint_pins)) {
printk(KERN_INFO "eintDebug
pinctrl_lookup_state pa_ctl_output0 error\n");
}
else //add
pinctrl_select_state(eint_pinctrl, eint_pins);
}
//...
#if 0
//add
static struct platform_device dtveint_platform_device = {
.name =
"dtveint",
.id = -1,
.dev = {
.release = dtveint_dev_release,
}
};
#endif
static int dtveint_init(void)
{
int ret = 0;
printk(KERN_INFO "eintDebug +%s\n", __func__);
#if 0 //add
ret =
platform_device_register (&dtveint_platform_device);
if (ret) {
printk("eintDebug platform_device_register fail\n");
return ret;
}
#endif
//...
谢谢!
2.使用spi_device驱动调用devm_pinctrl_get(&spi->dev),出现错误,反复重启,错误
”log见反复重启.log“
您好!
如电话沟通,贵司可以在发过来的code基础上做下面的修改再试试:
(1)修改aw8155.c
static int aw8155_drv_probe(struct platform_device *dev)
{
//...
// ------------------ here add your code to init device tree
-------------------- start
aw8155_pinctrl1 =
devm_pinctrl_get(&dev->dev);
if (IS_ERR(aw8155_pinctrl1)) {
AW8155_LOGE("devm_pinctrl_get error\n");
}
else{ //add
pins_default = pinctrl_lookup_state(aw8155_pinctrl1, "default");
if
(IS_ERR(pins_default)) {
AW8155_LOGE("pinctrl_lookup_state default
error\n");
}
pa_pins_int = pinctrl_lookup_state(aw8155_pinctrl1,
"pa_ctl_output0");
if (IS_ERR(pa_pins_int)) {
AW8155_LOGE("pinctrl_lookup_state pa_ctl_output0 error\n");
}
else
//add
pinctrl_select_state(aw8155_pinctrl1, pa_pins_int);
}
// ------------------ here add your code to init device tree ---------------------- end
//...
#if 0 //add
static struct platform_device
aw8155_platform_device = {
.name = "aw8155",
.id = -1,
.dev = {
.release = aw8155_dev_release,
}
};
#endif
static int __init
aw8155_init(void)
{
int ret = 0;
AW8155_LOGD("+%s\n", __func__);
#if 0 //add
ret = platform_device_register
(&aw8155_platform_device);
if (ret) {
AW8155_LOGE("platform_device_register fail\n");
return ret;
}
#endif
(2)修改fc8180_spi.c
static int dtveint_drv_probe(struct
platform_device *dev)
{
//...
eint_pinctrl =
devm_pinctrl_get(&dev->dev);
if (IS_ERR(eint_pinctrl)) {
printk(KERN_INFO "eintDebug devm_pinctrl_get error\n");
}
else{
//add
pins_default = pinctrl_lookup_state(eint_pinctrl, "default");
if
(IS_ERR(pins_default)) {
printk(KERN_INFO "eintDebug pinctrl_lookup_state
default error\n");
}
eint_pins = pinctrl_lookup_state(eint_pinctrl,
"eint_cfg");
if (IS_ERR(eint_pins)) {
printk(KERN_INFO "eintDebug
pinctrl_lookup_state pa_ctl_output0 error\n");
}
else //add
pinctrl_select_state(eint_pinctrl, eint_pins);
}
//...
#if 0
//add
static struct platform_device dtveint_platform_device = {
.name =
"dtveint",
.id = -1,
.dev = {
.release = dtveint_dev_release,
}
};
#endif
static int dtveint_init(void)
{
int ret = 0;
printk(KERN_INFO "eintDebug +%s\n", __func__);
#if 0 //add
ret =
platform_device_register (&dtveint_platform_device);
if (ret) {
printk("eintDebug platform_device_register fail\n");
return ret;
}
#endif
//...
谢谢!
2.使用spi_device驱动调用devm_pinctrl_get(&spi->dev),出现错误,反复重启,错误
”log见反复重启.log“
Dear Customer:
您好!
您这个cust_eint.dtsi文件是通过window下运行dct
tool生成的吧,这个只是做个参考。我们真正使用的是编译生成的cust.dtsi。所以您要check的话,可以check文件cust.dtsi。或者在linux下运行
dct生成相应的文件。
example:
(1)在window下运行dct
tool生成的cust_eint.dtsi文件中的accdet中断为:
ACCDET@6 {
compatible = "mediatek,
ACCDET-eint";
interrupt-parent = <&eintc>;
interrupts = <6
8>;
debounce = <6 256000>;
};
(2)在linux下运行dct
生成的cust_eint_dtsi文件会在编译生成cust.dtsi文件中的accdet中断为:
&accdet {
interrupt-parent = <&eintc>;
interrupts = <6
IRQ_TYPE_LEVEL_LOW>;
debounce = <6 256000>;
status = "okay";
};
谢谢!
您好!
您这个cust_eint.dtsi文件是通过window下运行dct
tool生成的吧,这个只是做个参考。我们真正使用的是编译生成的cust.dtsi。所以您要check的话,可以check文件cust.dtsi。或者在linux下运行
dct生成相应的文件。
example:
(1)在window下运行dct
tool生成的cust_eint.dtsi文件中的accdet中断为:
ACCDET@6 {
compatible = "mediatek,
ACCDET-eint";
interrupt-parent = <&eintc>;
interrupts = <6
8>;
debounce = <6 256000>;
};
(2)在linux下运行dct
生成的cust_eint_dtsi文件会在编译生成cust.dtsi文件中的accdet中断为:
&accdet {
interrupt-parent = <&eintc>;
interrupts = <6
IRQ_TYPE_LEVEL_LOW>;
debounce = <6 256000>;
status = "okay";
};
谢谢!
3.能否提供一个spi驱动设备树配置的样板,可能过后需要在spi驱动的probe中进行中断和gpio的配置?
Dear Customer:
您好!
举例,在SPI0 bus上挂device
(kernel-3.18\arch\arm64\boot\dts\xxxx.dts)
&spi0 {
#address-cells = <1>;
#size-cells = <0>;
label:Your
device name@0 {
compatible = "your compatible name";
reg = <0>;
=> 表示SPI0上的第一个device
spi-max-frequency = <xxxx>; =>
如有需要,可自行添加SPI相关的info,这里以max freq为例
/* your device info ….*/
};
};
您好!
举例,在SPI0 bus上挂device
(kernel-3.18\arch\arm64\boot\dts\xxxx.dts)
&spi0 {
#address-cells = <1>;
#size-cells = <0>;
label:Your
device name@0 {
compatible = "your compatible name";
reg = <0>;
=> 表示SPI0上的第一个device
spi-max-frequency = <xxxx>; =>
如有需要,可自行添加SPI相关的info,这里以max freq为例
/* your device info ….*/
};
};