android P lightservice 移植调试增加状态指示灯 保存状态到设置开关 --驱动 hal lib HIDL service framework settingsprovide

本文详细介绍了如何在Android P中移植和调试lightservice,添加状态指示灯功能,并将状态保存到设置开关中,涉及驱动、HAL、lib、HIDL、service以及framework和settingsprovider的相关操作。
摘要由CSDN通过智能技术生成
diff --git a/common/arch/arm/configs/meson64_a32_defconfig b/common/arch/arm/configs/meson64_a32_defconfig
index 6a97cd6b25..a535cead7d 100644
--- a/common/arch/arm/configs/meson64_a32_defconfig
+++ b/common/arch/arm/configs/meson64_a32_defconfig
@@ -293,14 +293,14 @@ CONFIG_AMLOGIC_LCD=y
 CONFIG_AMLOGIC_LCD_TV=y
 CONFIG_AMLOGIC_LCD_TABLET=y
 CONFIG_AMLOGIC_LCD_EXTERN=y
-#CONFIG_AMLOGIC_LCD_EXTERN_I2C_ANX6862_7911=y
+CONFIG_AMLOGIC_LCD_EXTERN_I2C_ANX6862_7911=y
 CONFIG_AMLOGIC_BACKLIGHT=y
-#CONFIG_AMLOGIC_BL_EXTERN=y
-#CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556=y
-#CONFIG_AMLOGIC_BL_EXTERN_MIPI_LT070ME05=y
-#CONFIG_AMLOGIC_LOCAL_DIMMING=y
-#CONFIG_AMLOGIC_LOCAL_DIMMING_IW7038=y
-#CONFIG_AMLOGIC_LOCAL_DIMMING_IW7027=y
+CONFIG_AMLOGIC_BL_EXTERN=y
+CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556=y
+CONFIG_AMLOGIC_BL_EXTERN_MIPI_LT070ME05=y
+CONFIG_AMLOGIC_LOCAL_DIMMING=y
+CONFIG_AMLOGIC_LOCAL_DIMMING_IW7038=y
+CONFIG_AMLOGIC_LOCAL_DIMMING_IW7027=y
 CONFIG_AMLOGIC_VOUT_SERVE=y
 CONFIG_AMLOGIC_VOUT2_SERVE=y
 CONFIG_AMLOGIC_MEDIA_FB=y
diff --git a/common/drivers/amlogic/input/keyboard/adc_ntc.c b/common/drivers/amlogic/input/keyboard/adc_ntc.c
index f966cad7a3..7f84d02e19 100644
--- a/common/drivers/amlogic/input/keyboard/adc_ntc.c
+++ b/common/drivers/amlogic/input/keyboard/adc_ntc.c
@@ -64,21 +64,28 @@ static int meson_adc_temp_search_ntc(struct meson_adc_temp *temp)
         R_ntc = value*100;
         do_div(R_ntc, (1024-value));
         //R_ntc = (value*100)/(1024-value);
-        for(i=0; i<153; i++){
   
+        for(i=0; i<ARRAY_SIZE(map_ntc_temp); i++){
   
             if(R_ntc > map_ntc_temp[i][1]) break;
         }
         temperature = map_ntc_temp[i][0]>0?map_ntc_temp[i][0] : 0;
 
-        //printk("T %d value: %d R %lld\n", temperature, value, R_ntc);
+        
         if(((temperature - old_temp) > 3) || ((old_temp - temperature) > 3)){
   
             pwm_fan_update_status(temperature * 2);//更新风扇速度 风扇+5V光机正常工作后输出
             old_temp = temperature;
+			printk("T %d value: %d R %lld\n", temperature, value, R_ntc);
         }
 	}
 	mutex_unlock(&temp->temp_lock);
 	return 0;
 }
 
+int get_projection_temperature(void)
+{
   
+    return temperature;
+}
+EXPORT_SYMBOL(get_projection_temperature);
+
 static void meson_adc_temp_poll(struct work_struct *pwork)
 {
   
 	struct meson_adc_temp *temp =
diff --git a/common/drivers/amlogic/input/vl53l1cb/stmvl53l1_module.c b/common/drivers/amlogic/input/vl53l1cb/stmvl53l1_module.c
index 846a0515ef..8d6b6a228d 100644
--- a/common/drivers/amlogic/input/vl53l1cb/stmvl53l1_module.c
+++ b/common/drivers/amlogic/input/vl53l1cb/stmvl53l1_module.c
@@ -4236,7 +4236,7 @@ calibration_data.customer.algo__crosstalk_compensation_plane_offset_kcps);
         cos_b_ =d2*1000-d1*COS2A;//放大1000倍
         do_div(cos_b_, d);//商 存在cos_b_//计算出的θ' 76.5-31.5放大到100对应的cos值*1000
         
-        for(i=0; i<sizeof(lt_cos_table)/sizeof(lt_cos_table[0]); i++){
   //0-45度分100等分
+        for(i=0; i<ARRAY_SIZE(lt_cos_table); i++){
   //0-45度分100等分
             if(cos_b_ < lt_cos_table[i]){
   //查余弦表得到角度
                 angle = i;//按0.45度阶梯得出偏移值
                 break;
@@ -4305,7 +4305,7 @@ calibration_data.customer.algo__crosstalk_compensation_plane_offset_kcps);
         }
         else if(roi_cnt == 5){
   //中心区域用于马达对焦
             center_distance = meas_array[0]->RangeMilliMeter;
-            for(i=0;i<sizeof(distance_step)/sizeof(distance_step[0]);i++) {
   
+            for(i=0;i<ARRAY_SIZE(distance_step);i++) {
   
                 if(center_distance<distance_step[i][0]){
   
                     stepsMotor = distance_step[i][1];
                     
diff --git a/common/drivers/amlogic/media/vout/backlight/pwm_fan.c b/common/drivers/amlogic/media/vout/backlight/pwm_fan.c
index 62b204223e..1e993ddbba 100644
--- a/common/drivers/amlogic/media/vout/backlight/pwm_fan.c
+++ b/common/drivers/amlogic/media/vout/backlight/pwm_fan.c
@@ -1479,7 +1479,7 @@ static inline int aml_bl_pwm_vs_lcd_update(struct bl_pwm_config_s *bl_pwm)
 }
 
 /* bl debug calss */
-struct class *bl_debug_class;
+static struct class *bl_debug_class;
 
 static const char *bl_debug_usage_str = {
   
 "Usage:\n"
diff --git a/common/drivers/misc/eeprom/dpp3435.c b/common/drivers/misc/eeprom/dpp3435.c
index cbd2301f6e..a776ed5e03 100644
--- a/common/drivers/misc/eeprom/dpp3435.c
+++ b/common/drivers/misc/eeprom/dpp3435.c
@@ -127,6 +127,33 @@ int vcc33_en_gpio;//DLP VCC 3.3V
      return ret;
  }
 
+//1 水平 0 垂直
+int dpp3435_mirror(int mirror_h_v)
+ {
   
+ #define MIRROR_H_BIT (1<<1)
+ #define MIRROR_V_BIT (1<<2)
+ 
+     int err = 0;
+     u8 led_ctl[2] = {
   0x15, 0x06};//默认值
+ 
+     err = dpp3435_i2c_read(pclient, led_ctl, 1);//开启LED
+     if (err < 0) {
   
+         dbmsg("reg15 read fail");
+     } 
+     
+     msleep(300);
+     if(mirror_h_v)  led_ctl[1] = led_ctl[0] ^ MIRROR_H_BIT;//异或取反
+     if(!mirror_h_v) led_ctl[1] = led_ctl[0] ^ MIRROR_V_BIT;//异或取反
+     
+     led_ctl[0] = 0x14;
+     err = dpp3435_i2c_write(pclient, led_ctl, 2);//设置背投吊装
+     if (err < 0) {
   
+         dbmsg("reg14 write fail");
+     }
+     return err;
+ }
+EXPORT_SYMBOL(dpp3435_mirror);
+
 #ifdef CONFIG_OF
 /**
  * dpp3435_parse_dt - parse platform infomation form devices tree.
@@ -264,7 +291,7 @@ static void dpp3435_resume(void)
 {
 
     int err = 0;
-    u8 led_ctl[7] = {0x54, 0xE6, 0xE6, 0xE6, 0xE6, 0xE6, 0xE6};//0xE6 90%亮度
+    u8 led_ctl[7] = {0x54, 0x30, 2, 0x30, 2, 0x30, 2};//100% 低位在前 测试设置100%亮度 =560 =0x230
 
     gpio_direction_output(gm8284d_pwr, 1);
     mdelay(1000);
@@ -273,12 +300,13 @@ static void dpp3435_resume(void)
     gpio_direction_output(proj_on_gpio, 1);
     msleep(3000);
 /*
-	err = dpp3435_i2c_write(pclient, led_ctl, 7);//设置LED 90%亮度
+	err = dpp3435_i2c_write(pclient, led_ctl, 7);//设置LED 100%亮度
 	if (err < 0) {
 		dbmsg("reg52 write fail");
 	}
     msleep(300);
 */
+    msleep(3000);
     led_ctl[0] = 0x52;
     led_ctl[1] = 0xFF;
     err = dpp3435_i2c_write(pclient, led_ctl, 2);//开启LED
@@ -294,7 +322,6 @@ static void dpp3435_resume(void)
 	} else {
   
         dbmsg("reg52 read reg06=%02x %02x\n",led_ctl[0], led_ctl[1]);
     }
-
 }
 
 #if defined(CONFIG_PM)
diff --git a/common/drivers/video/backlight/backlight.c b/common/drivers/video/backlight/backlight.c
index 8049e7656d..dfd4ed3cb7 100644
--- a/common/drivers/video/backlight/backlight.c
+++ b/common/drivers/video/backlight/backlight.c
@@ -120,6 +120,59 @@ static void backlight_generate_event(struct backlight_device *bd,
 	kobject_uevent_env(&bd->dev.kobj, KOBJ_CHANGE, envp);
 	sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness");
 }
+//1 水平 0 垂直
+extern int dpp3435_mirror(int mirror_h_v);
+
+//投影仪背投接口
+static ssize_t projection_back_store(struct device *dev, struct device_attribute *attr,
+     const char *buf, size_t count)
+{
   
+    int rc = 1;
+    //dpp3435_mirror(1);//水平方向镜像
+    pr_info("projection_back_store  %d\n", count);
+    return rc;
+}
+static DEVICE_ATTR_WO(projection_back);
+
+//投影仪吊装接口 buf 传入0 关闭G-SENSOR自动吊装翻转,写一次改变一次翻转方向;传入1开启G-SENSOR
+static ssize_t projection_hoist_store(struct device *dev, struct device_attribute *attr,
+     const char *buf, size_t count)
+{
   
+    int rc = 1;
+/*    unsigned long auto_hoist;//上层写数据控制是否开启自动吊装
+
+	rc = kstrtoul(buf, 0, &auto_hoist);
+	if (rc) {
+		pr_info("projection_hoist_store fail %d\n", count);
+		return rc;
+	}
+	
+    
+    if(auto_hoist == 0) {
+	    //todo 关闭G-SENSOR检测
+	    dpp3435_mirror(0);//垂直方向翻转
+	    
+
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值