微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 6577平台cm36283(alsps)无法正常工作

6577平台cm36283(alsps)无法正常工作

时间:10-02 整理:3721RD 点击:
6577平台3623的器件更换36283,I2C已通,测试模式下als,ps均有数据上传,可是在实际使用中芯片无法工作,拨号与自动调节亮度都没有反映。
打印log发现cm36283_ps_operate函数没有调用到,有没有哪位碰到过类似的情况。

static int cm36283_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
        struct cm36283_priv *obj;
        struct hwmsen_object obj_ps, obj_als;
        int err = 0;
        if(!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
        {
                err = -ENOMEM;
                goto exit;
        }
       
        memset(obj, 0, sizeof(*obj));
        cm36283_obj = obj;
       
        obj->hw = get_cust_alsps_hw();//get custom file data struct
       
        INIT_WORK(&obj->eint_work, cm36283_eint_work);
        obj->client = client;
        i2c_set_clientdata(client, obj);
        /*-----------------------------value need to be confirmed-----------------------------------------*/
        atomic_set(&obj->als_debounce, 200);
        atomic_set(&obj->als_deb_on, 0);
        atomic_set(&obj->als_deb_end, 0);
        atomic_set(&obj->ps_debounce, 200);
        atomic_set(&obj->ps_deb_on, 0);
        atomic_set(&obj->ps_deb_end, 0);
        atomic_set(&obj->ps_mask, 0);
        atomic_set(&obj->als_suspend, 0);
        atomic_set(&obj->als_cmd_val, 0xDF);
        atomic_set(&obj->ps_cmd_val,  0xC1);
        atomic_set(&obj->ps_thd_val_high,  obj->hw->ps_threshold_high);
        atomic_set(&obj->ps_thd_val_low,  obj->hw->ps_threshold_low);
        atomic_set(&obj->als_thd_val_high,  obj->hw->als_threshold_high);
        atomic_set(&obj->als_thd_val_low,  obj->hw->als_threshold_low);
       
        obj->enable = 0;
        obj->pending_intr = 0;
        obj->als_level_num = sizeof(obj->hw->als_level)/sizeof(obj->hw->als_level[0]);
        obj->als_value_num = sizeof(obj->hw->als_value)/sizeof(obj->hw->als_value[0]);
        /*-----------------------------value need to be confirmed-----------------------------------------*/
       
        BUG_ON(sizeof(obj->als_level) != sizeof(obj->hw->als_level));
        memcpy(obj->als_level, obj->hw->als_level, sizeof(obj->als_level));
        BUG_ON(sizeof(obj->als_value) != sizeof(obj->hw->als_value));
        memcpy(obj->als_value, obj->hw->als_value, sizeof(obj->als_value));
        atomic_set(&obj->i2c_retry, 3);
        set_bit(CMC_BIT_ALS, &obj->enable);
        set_bit(CMC_BIT_PS, &obj->enable);
        cm36283_i2c_client = client;
        if((err = cm36283_init_client(client)))
        {
                goto exit_init_failed;
        }
        APS_LOG("cm36283_init_client() OK!\n");
        if((err = misc_register(&cm36283_device)))
        {
                APS_ERR("cm36283_device register failed\n");
                goto exit_misc_device_register_failed;
        }
        APS_LOG("cm36283_device misc_register OK!\n");
        /*------------------------cm36283 attribute file for debug--------------------------------------*/
        if((err = cm36283_create_attr(&cm36283_alsps_driver.driver)))
        {
                APS_ERR("create attribute err = %d\n", err);
                goto exit_create_attr_failed;
        }
        /*------------------------cm36283 attribute file for debug--------------------------------------*/
        obj_ps.self = cm36283_obj;
        obj_ps.polling = obj->hw->polling_mode_ps;       
        obj_ps.sensor_operate = cm36283_ps_operate;
        if((err = hwmsen_attach(ID_PROXIMITY, &obj_ps)))
        {
                APS_ERR("attach fail = %d\n", err);
                goto exit_sensor_obj_attach_fail;
        }
               
        obj_als.self = cm36283_obj;
        obj_als.polling = obj->hw->polling_mode_als;
        obj_als.sensor_operate = cm36283_als_operate;
        if((err = hwmsen_attach(ID_LIGHT, &obj_als)))
        {
                APS_ERR("attach fail = %d\n", err);
                goto exit_sensor_obj_attach_fail;
        }
        #if defined(CONFIG_HAS_EARLYSUSPEND)
        obj->early_drv.level    = EARLY_SUSPEND_LEVEL_STOP_DRAWING - 2,
        obj->early_drv.suspend  = cm36283_early_suspend,
        obj->early_drv.resume   = cm36283_late_resume,   
        register_early_suspend(&obj->early_drv);
        #endif
        APS_LOG("%s: OK\n", __func__);
        return 0;
        exit_create_attr_failed:
        exit_sensor_obj_attach_fail:
        exit_misc_device_register_failed:
                misc_deregister(&cm36283_device);
        APS_ERR("%s: liusong 001 err = %d\n", __func__, err);
        exit_init_failed:
                kfree(obj);
        APS_ERR("%s: liusong 002err = %d\n", __func__, err);
        exit:
        cm36283_i2c_client = NULL;           
        APS_ERR("%s: err = %d\n", __func__, err);
        return err;
}
这个是I2C的probe函数

        if((err = hwmsen_attach(ID_PROXIMITY, &obj_ps)))
        {
                APS_ERR("attach fail = %d\n", err);
                goto exit_sensor_obj_attach_fail;
        }
        if((err = hwmsen_attach(ID_LIGHT, &obj_als)))
        {
                APS_ERR("attach fail = %d\n", err);
                goto exit_sensor_obj_attach_fail;
        }
这两个函数开机时有跑到吗?
有没有出现fail?

这两个都跑过了,没有出现error,I2C_probe是ok的

你看看你用的是方式是中断模式还是轮询模式,要是中断模式,检查一下中断脚之类和中断方式的有没有配置好,要不把它先配置成轮询的方式先试试,在测试模式是用轮询去读数据的。

你最好是发串口的log上来,大家才好分析。

驱动代码有点小问题,跟供应商从新要了一份现在OK了

请问大虾是驱动代码的哪一块出了问题啊,我上次也出现了这种问题,但是就是没找到啊。测试模式下的值都正确就是实际的背光调节无反应。

我的是拨号的时候不能正常工作,自动调节背光没注意。
你是哪个平台

MTK啊  
,我看你上面写的也是这个方案啊。

加个Q吧  共同交流   我的820486606

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top