lcd: add gpio pinctrl for pinmux off

PD#172438: lcd: add gpio pinctrl for pinmux off

include below drivers:
1.lcd
2.lcd_extern
3.backlight
4.bl_ldim
5.bl_extern

Change-Id: I7b5449fa9581d0290135c615b63a7557eb9c915a
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
Evoke Zhang
2018-08-23 20:21:46 +08:00
committed by Jianxin Pan
parent 99b548faeb
commit ffa2eb136b
60 changed files with 1097 additions and 520 deletions

View File

@@ -1383,6 +1383,13 @@
function = "pwm_b";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_4";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
/* Audio Related End */

View File

@@ -1321,6 +1321,13 @@
function = "pwm_b";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_4";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
/* Audio Related End */

View File

@@ -1195,6 +1195,13 @@
function = "pwm_b";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_4";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
/* Audio Related End */

View File

@@ -1239,6 +1239,13 @@
function = "pwm_b";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_4";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
/* Audio Related End */

View File

@@ -1205,6 +1205,13 @@
function = "pwm_b";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_4";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
/* Audio Related End */

View File

@@ -1035,6 +1035,13 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -977,6 +977,13 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -813,16 +813,10 @@
};
bl_extern_i2c {
compatible = "amlogic, bl_extern_i2c";
status = "disabled";
reg = <0x2c>; /*reg_address for lp8556*/
compatible = "bl_extern, i2c";
dev_name = "lp8556";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
reg = <0x2c>;
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
dev_name = "i2c_T5800Q";
};
};
@@ -1114,6 +1108,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -813,16 +813,10 @@
};
bl_extern_i2c {
compatible = "amlogic, bl_extern_i2c";
status = "disabled";
reg = <0x2c>; /*reg_address for lp8556*/
compatible = "bl_extern, i2c";
dev_name = "lp8556";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
reg = <0x2c>;
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
dev_name = "i2c_T5800Q";
};
};
@@ -1114,6 +1108,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -847,16 +847,10 @@
};
bl_extern_i2c {
compatible = "amlogic, bl_extern_i2c";
status = "disabled";
reg = <0x2c>; /*reg_address for lp8556*/
compatible = "bl_extern, i2c";
dev_name = "lp8556";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
reg = <0x2c>;
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
dev_name = "i2c_T5800Q";
};
};
@@ -1134,6 +1128,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -862,10 +862,10 @@
};
bl_extern_i2c {
compatible = "amlogic, bl_extern_i2c";
status = "disabled";
reg = <0x2c>; /*reg_address for lp8556*/
compatible = "bl_extern, i2c";
dev_name = "lp8556";
reg = <0x2c>;
status = "disabled";
};
};
@@ -1143,6 +1143,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -18,7 +18,6 @@
/dts-v1/;
#include "mesong12a.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal_P_32.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -18,7 +18,6 @@
/dts-v1/;
#include "mesong12a.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -19,7 +19,6 @@
#include "mesong12a.dtsi"
#include "partition_mbox_normal.dtsi"
#include "mesong12a_skt-panel.dtsi"
/ {
model = "Amlogic";

View File

@@ -1129,6 +1129,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -784,6 +784,13 @@
differential_pair = <1>;
status = "disabled";
};
bl_extern_i2c {
compatible = "bl_extern, i2c";
dev_name = "lp8556";
reg = <0x2c>;
status = "disabled";
};
};
&audiobus {
@@ -1074,6 +1081,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -814,6 +814,13 @@
differential_pair = <1>;
status = "disabled";
};
bl_extern_i2c {
compatible = "bl_extern, i2c";
dev_name = "lp8556";
reg = <0x2c>;
status = "disabled";
};
};
&audiobus {
@@ -1104,6 +1111,14 @@
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOH_5";
function = "gpio_periphs";
output-high;
};
};
}; /* end of pinctrl_periphs */
&pinctrl_aobus {

View File

@@ -655,19 +655,20 @@
dev_name = "backlight";
status = "okay";
key_valid = <0>;
pinctrl-names = "pwm_on";
pinctrl-names = "pwm_on","pwm_off";
pinctrl-0 = <&bl_pwm_on_pins>;
pinctrl-1 = <&bl_pwm_off_pins>;
pinctrl_version = <1>; /* for uboot */
bl_pwm_config = <&bl_pwm_conf>;
bl-gpios = <&gpio GPIOZ_4 GPIO_ACTIVE_HIGH
&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
bl_gpio_names = "GPIOZ_4","GPIOZ_5";
/* pwm port: PWM_A, PWM_B, PWM_C, PWM_D, PWM_VS*/
/* power index:(point gpios_index, 0xff=invalid)
* power value:(0=output low, 1=output high, 2=input)
* power delay:(unit in ms)
*/
bl-gpios = <&gpio GPIOZ_4 GPIO_ACTIVE_HIGH
&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
bl_gpio_names = "GPIOZ_4","GPIOZ_5";
bl_pwm_config = <&bl_pwm_conf>;
backlight_0{
index = <0>;
@@ -683,7 +684,7 @@
bl_pwm_attr = <0 /*pwm_method*/
180 /*pwm_freq(pwm:Hz, pwm_vs:multiple of vs)*/
100 25>; /*duty_max(%), duty_min(%)*/
bl_pwm_power = <0 0 /*pwm_gpio_index, pwm_gpio_off*/
bl_pwm_power = <0 1 /*pwm_gpio_index, pwm_gpio_off*/
10 10>; /*pwm_on_delay(ms), pwm_off_delay(ms)*/
bl_pwm_en_sequence_reverse = <0>; /* 1 for reverse */
};
@@ -712,26 +713,22 @@
compatible = "amlogic, bl_extern";
dev_name = "bl_extern";
status = "disabled";
i2c_bus = "i2c_bus_3";
extern_0{
index = <0>;
extern_name = "i2c_lp8556";
type = <0>; /*0=i2c, 1=spi, 2=mipi*/
i2c_address = <0x2c>; /*7bit i2c address*/
i2c_bus = "i2c_bus_c";
dim_max_min = <255 10>;
};
extern_1{
index = <1>;
extern_name = "mipi_lt070me05";
type = <2>; /*0=i2c, 1=spi, 2=mipi*/
dim_max_min = <255 10>;
};
};
};/* end of panel */

View File

@@ -1439,8 +1439,9 @@
dev_name = "backlight";
status = "okay";
key_valid = <0>;
pinctrl-names = "pwm_on";
pinctrl-names = "pwm_on","pwm_off";
pinctrl-0 = <&pwm_f_pins2>;
pinctrl-1 = <&bl_pwm_off_pins>;
pinctrl_version = <2>; /* for uboot */
bl_pwm_config = <&bl_pwm_conf>;
bl-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH
@@ -1490,18 +1491,21 @@
pwms = <&pwm_ef MESON_PWM_1 30040 0>;
};
};
bl_extern{
compatible = "amlogic, bl_extern";
dev_name = "bl_extern";
status = "disabled";
i2c_bus = "i2c_bus_3";
extern_0{
index = <0>;
extern_name = "i2c_lp8556";
type = <0>; /*0=i2c, 1=spi, 2=mipi*/
i2c_address = <0x2c>; /*7bit i2c address*/
i2c_bus = "i2c_bus_c";
dim_max_min = <255 10>;
};
extern_1{
index = <1>;
extern_name = "mipi_lt070me05";

View File

@@ -748,8 +748,9 @@
dev_name = "backlight";
status = "okay";
key_valid = <0>;
pinctrl-names = "pwm_on";
pinctrl-names = "pwm_on","pwm_off";
pinctrl-0 = <&pwm_f_pins2>;
pinctrl-1 = <&bl_pwm_off_pins>;
pinctrl_version = <2>; /* for uboot */
bl_pwm_config = <&bl_pwm_conf>;
bl-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH
@@ -799,18 +800,21 @@
pwms = <&pwm_ef MESON_PWM_1 30040 0>;
};
};
bl_extern{
compatible = "amlogic, bl_extern";
dev_name = "bl_extern";
status = "disabled";
i2c_bus = "i2c_bus_3";
extern_0{
index = <0>;
extern_name = "i2c_lp8556";
type = <0>; /*0=i2c, 1=spi, 2=mipi*/
i2c_address = <0x2c>; /*7bit i2c address*/
i2c_bus = "i2c_bus_c";
dim_max_min = <255 10>;
};
extern_1{
index = <1>;
extern_name = "mipi_lt070me05";

View File

@@ -1042,6 +1042,84 @@
};
};
lcd_ttl_rgb_6bit_on_pins:lcd_ttl_rgb_6bit_on{
mux {
groups = "lcd_r2_7",
"lcd_g2_7",
"lcd_b2_7";
function = "lcd_ttl";
};
};
lcd_ttl_rgb_6bit_off_pins:lcd_ttl_rgb_6bit_off{
mux {
groups = "GPIODV_2","GPIODV_3","GPIODV_4",
"GPIODV_5","GPIODV_6","GPIODV_7",
"GPIODV_10","GPIODV_11","GPIODV_12",
"GPIODV_13","GPIODV_14","GPIODV_15",
"GPIODV_18","GPIODV_19","GPIODV_20",
"GPIODV_21","GPIODV_22","GPIODV_23";
function = "gpio_periphs";
input-enable;
};
};
lcd_ttl_rgb_8bit_on_pins:lcd_ttl_rgb_8bit_on{
mux {
groups = "lcd_r0_1", "lcd_r2_7",
"lcd_g0_1", "lcd_g2_7",
"lcd_b0_1", "lcd_b2_7";
function = "lcd_ttl";
};
};
lcd_ttl_rgb_8bit_off_pins:lcd_ttl_rgb_8bit_off{
mux {
groups = "GPIODV_0","GPIODV_1","GPIODV_2","GPIODV_3",
"GPIODV_4","GPIODV_5","GPIODV_6","GPIODV_7",
"GPIODV_8","GPIODV_9","GPIODV_10","GPIODV_11",
"GPIODV_12","GPIODV_13","GPIODV_14","GPIODV_15",
"GPIODV_16","GPIODV_17","GPIODV_18","GPIODV_19",
"GPIODV_20","GPIODV_21","GPIODV_22","GPIODV_23";
function = "gpio_periphs";
input-enable;
};
};
/* DE + clk */
lcd_ttl_de_on_pins:lcd_ttl_de_on_pin{
mux {
groups = "tcon_cph", /* clk */
"tcon_oeh"; /* DE */
function = "lcd_ttl";
};
};
/* hvsync + clk */
lcd_ttl_hvsync_on_pins:lcd_ttl_hvsync_on_pin{
mux {
groups = "tcon_cph", /* clk */
"tcon_stv1", /* vs */
"tcon_sth1"; /* hs */
function = "lcd_ttl";
};
};
/* DE + hvsync + clk */
lcd_ttl_de_hvsync_on_pins:lcd_ttl_de_hvsync_on_pin{
mux {
groups = "tcon_cph", /* clk */
"tcon_oeh", /* DE */
"tcon_stv1", /* vs */
"tcon_sth1"; /* hs */
function = "lcd_ttl";
};
};
lcd_ttl_de_hvsync_off_pins:lcd_ttl_de_hvsync_off_pin{
mux {
groups = "GPIODV_26", /* clk */
"GPIODV_27", /* DE */
"GPIODV_24", /* vs */
"GPIODV_25"; /* hs */
function = "gpio_periphs";
input-enable;
};
};
}; /* end of pinctrl_periphs */
&periphs {

View File

@@ -31,6 +31,30 @@
interrupts = <0 3 1>;
interrupt-names = "vsync";
pinctrl_version = <1>; /* for uboot */
pinctrl-names = "ttl_6bit_hvsync_de_on",
"ttl_6bit_hvsync_on",
"ttl_6bit_de_on",
"ttl_6bit_hvsync_de_off",
"ttl_8bit_hvsync_de_on",
"ttl_8bit_hvsync_on",
"ttl_8bit_de_on",
"ttl_8bit_hvsync_de_off";
pinctrl-0 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_de_hvsync_on_pins>;
pinctrl-1 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_hvsync_on_pins>;
pinctrl-2 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_de_on_pins>;
pinctrl-3 = <&lcd_ttl_rgb_6bit_off_pins
&lcd_ttl_de_hvsync_off_pins>;
pinctrl-4 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_de_hvsync_on_pins>;
pinctrl-5 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_hvsync_on_pins>;
pinctrl-6 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_de_on_pins>;
pinctrl-7 = <&lcd_ttl_rgb_8bit_off_pins
&lcd_ttl_de_hvsync_off_pins>;
/* power type:
* (0=cpu_gpio, 1=pmu_gpio, 2=signal,3=extern, 0xff=ending)
@@ -39,7 +63,7 @@
* power value:(0=output low, 1=output high, 2=input)
* power delay:(unit in ms)
*/
/*lcd_cpu-gpios = <&gpio GPIOX_3 1>;*/
/*lcd_cpu-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;*/
/*lcd_cpu_gpio_names = "GPIOX_3";*/
lcd_0{
@@ -69,5 +93,56 @@
backlight_index = <0xff>;
};
};
lcd_extern{
compatible = "amlogic, lcd_extern";
dev_name = "lcd_extern";
status = "disabled";
i2c_bus = "i2c_bus_d";
key_valid = <0>;
extern_0{
index = <0>;
extern_name = "ext_default";
status = "disabled";
type = <0>; /* 0=i2c, 1=spi, 2=mipi */
i2c_address = <0x1c>; /* 7bit i2c address */
i2c_second_address = <0xff>; /* 0xff for none */
cmd_size = <0xff>; /*0xff for dynamic cmd_size*/
/* init on/off:
* fixed cmd_size: (type, value..., delay);
* cmd_size include all data.
* dynamic cmd_size: (type, cmd_size, value..., delay);
* cmd_size include value+delay.
*/
/* type: 0x00=cmd(bit[3:0]=1 for second_addr),
* 0xf0=gpio, 0xff=ending
*/
/* value: i2c or spi cmd, or gpio index & level,
* fill 0x0 for no use
*/
/* delay: unit ms */
init_on = <0x00 8 0x20 0x01 0x02 0x00 0x40 0xFF 0x00 0
0x00 8 0x80 0x02 0x00 0x40 0x62 0x51 0x73 0
0x00 8 0x61 0x06 0x00 0x00 0x00 0x00 0x00 0
0x00 8 0xC1 0x05 0x0F 0x00 0x08 0x70 0x00 0
0x00 8 0x13 0x01 0x00 0x00 0x00 0x00 0x00 0
0x00 8 0x3D 0x02 0x01 0x00 0x00 0x00 0x00 0
0x00 8 0xED 0x0D 0x01 0x00 0x00 0x00 0x00 0
0x00 8 0x23 0x02 0x00 0x00 0x00 0x00 0x00 10
0xff 0>; /*ending*/
init_off = <0xff 0>; /*ending*/
};
extern_1{
index = <1>;
extern_name = "i2c_DLPC3439";
status = "disabled";
type = <0>; /* 0=i2c, 1=spi, 2=mipi */
i2c_address = <0x1b>; /* 7bit i2c address */
cmd_size = <0xff>; /*0xff for dynamic cmd_size*/
};
};
};/* end of panel */

View File

@@ -1087,7 +1087,7 @@
};
};
lcd_ttl_rgb_6bit_pins_on:lcd_ttl_rgb_6bit_on{
lcd_ttl_rgb_6bit_on_pins:lcd_ttl_rgb_6bit_on{
mux {
groups = "lcd_r2_7",
"lcd_g2_7",
@@ -1095,14 +1095,38 @@
function = "lcd_ttl";
};
};
lcd_ttl_rgb_6bit_off_pins:lcd_ttl_rgb_6bit_off{
mux {
groups = "GPIODV_2","GPIODV_3","GPIODV_4",
"GPIODV_5","GPIODV_6","GPIODV_7",
"GPIODV_10","GPIODV_11","GPIODV_12",
"GPIODV_13","GPIODV_14","GPIODV_15",
"GPIODV_18","GPIODV_19","GPIODV_20",
"GPIODV_21","GPIODV_22","GPIODV_23";
function = "gpio_periphs";
input-enable;
};
};
lcd_ttl_rgb_8bit_pins_on:lcd_ttl_rgb_8bit_on{
lcd_ttl_rgb_8bit_on_pins:lcd_ttl_rgb_8bit_on{
mux {
groups = "lcd_r0_1", "lcd_r2_7",
"lcd_g0_1", "lcd_g2_7",
"lcd_b0_1", "lcd_b2_7";
function = "lcd_ttl";
};
};
lcd_ttl_rgb_8bit_off_pins:lcd_ttl_rgb_8bit_off{
mux {
groups = "GPIODV_0","GPIODV_1","GPIODV_2","GPIODV_3",
"GPIODV_4","GPIODV_5","GPIODV_6","GPIODV_7",
"GPIODV_8","GPIODV_9","GPIODV_10","GPIODV_11",
"GPIODV_12","GPIODV_13","GPIODV_14","GPIODV_15",
"GPIODV_16","GPIODV_17","GPIODV_18","GPIODV_19",
"GPIODV_20","GPIODV_21","GPIODV_22","GPIODV_23";
function = "gpio_periphs";
input-enable;
};
};
/* DE + clk */
lcd_ttl_de_on_pins:lcd_ttl_de_on_pin{
@@ -1131,6 +1155,16 @@
function = "lcd_ttl";
};
};
lcd_ttl_de_hvsync_off_pins:lcd_ttl_de_hvsync_off_pin{
mux {
groups = "GPIODV_26", /* clk */
"GPIODV_27", /* DE */
"GPIODV_24", /* vs */
"GPIODV_25"; /* hs */
function = "gpio_periphs";
input-enable;
};
};
}; /* end of pinctrl_periphs */
&periphs {

View File

@@ -31,21 +31,30 @@
interrupts = <0 3 1>;
interrupt-names = "vsync";
pinctrl_version = <1>; /* for uboot */
pinctrl-names = "ttl_6bit_hvsync_de_on","ttl_6bit_hvsync_on",
"ttl_6bit_de_on","ttl_8bit_hvsync_de_on",
"ttl_8bit_hvsync_on","ttl_8bit_de_on";
pinctrl-0 = <&lcd_ttl_rgb_6bit_pins_on
pinctrl-names = "ttl_6bit_hvsync_de_on",
"ttl_6bit_hvsync_on",
"ttl_6bit_de_on",
"ttl_6bit_hvsync_de_off",
"ttl_8bit_hvsync_de_on",
"ttl_8bit_hvsync_on",
"ttl_8bit_de_on",
"ttl_8bit_hvsync_de_off";
pinctrl-0 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_de_hvsync_on_pins>;
pinctrl-1 = <&lcd_ttl_rgb_6bit_pins_on
pinctrl-1 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_hvsync_on_pins>;
pinctrl-2 = <&lcd_ttl_rgb_6bit_pins_on
pinctrl-2 = <&lcd_ttl_rgb_6bit_on_pins
&lcd_ttl_de_on_pins>;
pinctrl-3 = <&lcd_ttl_rgb_8bit_pins_on
pinctrl-3 = <&lcd_ttl_rgb_6bit_off_pins
&lcd_ttl_de_hvsync_off_pins>;
pinctrl-4 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_de_hvsync_on_pins>;
pinctrl-4 = <&lcd_ttl_rgb_8bit_pins_on
pinctrl-5 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_hvsync_on_pins>;
pinctrl-5 = <&lcd_ttl_rgb_8bit_pins_on
pinctrl-6 = <&lcd_ttl_rgb_8bit_on_pins
&lcd_ttl_de_on_pins>;
pinctrl-7 = <&lcd_ttl_rgb_8bit_off_pins
&lcd_ttl_de_hvsync_off_pins>;
/* power type:
* (0=cpu_gpio, 1=pmu_gpio, 2=signal,3=extern, 0xff=ending)
@@ -54,7 +63,7 @@
* power value:(0=output low, 1=output high, 2=input)
* power delay:(unit in ms)
*/
/*lcd_cpu-gpios = <&gpio GPIOX_3 1>;*/
/*lcd_cpu-gpios = <&gpio GPIOX_3 GPIO_ACTIVE_HIGH>;*/
/*lcd_cpu_gpio_names = "GPIOX_3";*/
lcd_0{
@@ -127,12 +136,12 @@
};
extern_1{
index = <2>;
index = <1>;
extern_name = "i2c_DLPC3439";
status = "disabled";
type = <0>; /* 0=i2c, 1=spi, 2=mipi */
i2c_address = <0x1b>; /* 7bit i2c address */
i2c_bus = "i2c_bus_d";
cmd_size = <0xff>; /*0xff for dynamic cmd_size*/
};
};
};/* end of panel */

View File

@@ -408,16 +408,15 @@
status = "okay";
key_valid = <1>;
i2c_bus = "i2c_bus_c";
/*pinctrl-names="extern_pins";*/
/*pinctrl_names_uboot = "i2c_c";*/ /* i2c_a, i2c_b, i2c_c */
/*pinctrl-0=<&i2c_c_master>;*/
/*extern-gpios = <&gpio GPIOH_2 1*/
/*&gpio GPIOH_3 1>;*/
/*pinctrl-names="extern_on", */
/* "extern_off"; */
/*pinctrl-0=<&i2c2_h_pins */
/* &lcd_extern_off_pins>; */
/*pinctrl_gpio_off = <0>; */
/*extern-gpios = <&gpio GPIOH_2 GPIO_ACTIVE_HIGH*/
/* &gpio GPIOH_3 GPIO_ACTIVE_HIGH>;*/
/*extern_gpio_names = "GPIOH_2","GPIOH_3";*/
/*i2c_gpio_off = <0 0 1 0>; */
/* I2C_SCK_gpio_index, I2C_SCK_gpio_off,
* I2C_SDA_gpio_index, I2C_SCK_gpio_off
*/
/*i2c_gpio = <0 1>; //i2c_sck, i2c_sda gpio_index */
extern_0{
index = <0>;
@@ -471,12 +470,16 @@
pinctrl-names = "pwm_on","pwm_vs_on",
"pwm_combo_0_1_on",
"pwm_combo_0_vs_1_on",
"pwm_combo_0_1_vs_on";
"pwm_combo_0_1_vs_on",
"pwm_off",
"pwm_combo_off";
pinctrl-0 = <&pwm_b_z6_pins>;
pinctrl-1 = <&pwm_vs_z6_pins>;
pinctrl-2 = <&pwm_b_z6_pins &pwm_c_z7_pins>;
pinctrl-3 = <&pwm_vs_z6_pins &pwm_c_z7_pins>;
pinctrl-4 = <&pwm_b_z6_pins &pwm_vs_z7_pins>;
pinctrl-5 = <&bl_pwm_off_pins>;
pinctrl-6 = <&bl_pwm_combo_off_pins>;
pinctrl_version = <2>; /* for uboot */
bl_pwm_config = <&bl_pwm_conf>;

View File

@@ -1239,14 +1239,21 @@
function = "vbyone";
};
};
lcd_vbyone_off_pins: lcd_vbyone_off_pin {
mux {
groups = "GPIOH_0","GPIOH_1";
function = "gpio_periphs";
input-enable;
};
};
lcd_ttl_rgb_6bit_pins_on:lcd_ttl_rgb_6bit_on{
lcd_ttl_rgb_6bit_on_pins:lcd_ttl_rgb_6bit_on{
mux {
groups = "lcd_r2_7","lcd_g2_7","lcd_b2_7";
function = "lcd";
};
};
lcd_ttl_rgb_6bit_pins_off:lcd_ttl_rgb_6bit_off{
lcd_ttl_rgb_6bit_off_pins:lcd_ttl_rgb_6bit_off{
mux {
groups = "GPIOY_2","GPIOY_3","GPIOY_4","GPIOY_5",
"GPIOY_6","GPIOY_7", /*r2~7*/
@@ -1258,7 +1265,7 @@
input-enable;
};
};
lcd_ttl_rgb_8bit_pins_on:lcd_ttl_rgb_8bit_on{
lcd_ttl_rgb_8bit_on_pins:lcd_ttl_rgb_8bit_on{
mux {
groups = "lcd_r0_1","lcd_r2_7",
"lcd_g0_1","lcd_g2_7",
@@ -1266,7 +1273,7 @@
function = "lcd";
};
};
lcd_ttl_rgb_8bit_pins_off:lcd_ttl_rgb_8bit_off{
lcd_ttl_rgb_8bit_off_pins:lcd_ttl_rgb_8bit_off{
mux {
groups = "GPIOY_0","GPIOY_1","GPIOY_2","GPIOY_3",
"GPIOY_4","GPIOY_5", "GPIOY_6","GPIOY_7",

View File

@@ -31,8 +31,9 @@
interrupts = <0 3 1
0 78 1>;
interrupt-names = "vsync","vbyone";
pinctrl-names = "vbyone";
pinctrl-names = "vbyone","vbyone_off";
pinctrl-0 = <&lcd_vbyone_pins>;
pinctrl-1 = <&lcd_vbyone_off_pins>;
pinctrl_version = <2>; /* for uboot */
/* power type:(0=cpu_gpio, 2=signal, 3=extern, 0xff=ending) */
@@ -457,16 +458,15 @@
status = "okay";
key_valid = <1>;
i2c_bus = "i2c_bus_c";
/*pinctrl-names="extern_pins";*/
/*pinctrl_names_uboot = "i2c_c";*/ /* i2c_a, i2c_b, i2c_c */
/*pinctrl-0=<&i2c_c_master>;*/
/*extern-gpios = <&gpio GPIOH_2 1*/
/*&gpio GPIOH_3 1>;*/
/*pinctrl-names="extern_on", */
/* "extern_off"; */
/*pinctrl-0=<&i2c2_h_pins */
/* &lcd_extern_off_pins>; */
/*pinctrl_gpio_off = <0>; */
/*extern-gpios = <&gpio GPIOH_2 GPIO_ACTIVE_HIGH*/
/* &gpio GPIOH_3 GPIO_ACTIVE_HIGH>;*/
/*extern_gpio_names = "GPIOH_2","GPIOH_3";*/
/*i2c_gpio_off = <0 0 1 0>; */
/* I2C_SCK_gpio_index, I2C_SCK_gpio_off,
* I2C_SDA_gpio_index, I2C_SCK_gpio_off
*/
/*i2c_gpio = <0 1>; //i2c_sck, i2c_sda gpio_index */
extern_0{
index = <0>;
@@ -520,7 +520,9 @@
pinctrl-names = "pwm_on","pwm_vs_on",
"pwm_combo_0_1_on",
"pwm_combo_0_vs_1_on",
"pwm_combo_0_1_vs_on";
"pwm_combo_0_1_vs_on",
"pwm_off",
"pwm_combo_off";
pinctrl-0 = <&bl_pwm_on_pins>;
pinctrl-1 = <&bl_pwm_vs_on_pins>;
pinctrl-2 = <&bl_pwm_combo_0_on_pins
@@ -529,6 +531,8 @@
&bl_pwm_combo_1_on_pins>;
pinctrl-4 = <&bl_pwm_combo_0_on_pins
&bl_pwm_combo_1_vs_on_pins>;
pinctrl-5 = <&bl_pwm_off_pins>;
pinctrl-6 = <&bl_pwm_combo_off_pins>;
pinctrl_version = <2>; /* for uboot */
interrupts = <0 3 1>;
interrupt-names = "ldim_vsync";
@@ -676,9 +680,12 @@
compatible = "amlogic, ldim_dev";
dev_name = "ldim_dev";
status = "okay";
pinctrl-names = "ldim_pwm","ldim_pwm_vs";
pinctrl-0 = <&ldim_pwm_pins>;
pinctrl-1 = <&ldim_pwm_vs_pins>;
pinctrl-names = "ldim_pwm",
"ldim_pwm_vs",
"ldim_pwm_off";
pinctrl-0 = <&bl_pwm_on_pins>;
pinctrl-1 = <&bl_pwm_vs_on_pins>;
pinctrl-2 = <&bl_pwm_off_pins>;
pinctrl_version = <1>; /* for uboot */
/* pwm port: PWM_A, PWM_B, PWM_C, PWM_D, PWM_E, PWM_F, PWM_VS*/

View File

@@ -1026,6 +1026,35 @@
};
};
/* end AUDIO_RELATED */
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};
&i2c1 {
@@ -1035,6 +1064,19 @@
pinctrl-0=<&i2c1_dv_pins>;
};
&i2c2 {
status = "disabled";
pinctrl-names="default";
pinctrl-0=<&i2c2_h_pins>;
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "disabled";
};
};
&dwc3 {
status = "okay";
};

View File

@@ -1033,6 +1033,35 @@
};
};
/* end AUDIO_RELATED */
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};
&i2c1 {
@@ -1042,6 +1071,19 @@
pinctrl-0=<&i2c1_dv_pins>;
};
&i2c2 {
status = "disabled";
pinctrl-names="default";
pinctrl-0=<&i2c2_h_pins>;
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "disabled";
};
};
&dwc3 {
status = "okay";
};

View File

@@ -1023,6 +1023,35 @@
};
};
/* end AUDIO_RELATED */
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};
&i2c0 {
@@ -1052,6 +1081,19 @@
pinctrl-0=<&i2c1_dv_pins>;
};
&i2c2 {
status = "okay";
pinctrl-names="default";
pinctrl-0=<&i2c2_h_pins>;
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "okay";
};
};
&dwc3 {
status = "okay";
};

View File

@@ -1044,6 +1044,35 @@
};
};
/* end AUDIO_RELATED */
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};
&i2c0 {
@@ -1073,6 +1102,19 @@
pinctrl-0=<&i2c1_dv_pins>;
};
&i2c2 {
status = "okay";
pinctrl-names="default";
pinctrl-0=<&i2c2_h_pins>;
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "okay";
};
};
&dwc3 {
status = "okay";
};

View File

@@ -1468,11 +1468,11 @@
status = "okay";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "okay";
};
};
@@ -1519,6 +1519,18 @@
};
};
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_on_pins:bl_pwm_on_pin {
mux {
@@ -1532,6 +1544,13 @@
function = "pwm_vs";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_0_on_pins:bl_pwm_combo_0_on_pin {
mux {
pins = "pwm_b";
@@ -1556,18 +1575,12 @@
function = "pwm_vs";
};
};
/*ldim*/
ldim_pwm_pins:ldim_pwm_pin {
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "pwm_b";
function = "pwm_b";
};
};
ldim_pwm_vs_pins:ldim_pwm_vs_pin {
mux {
pins = "pwm_vs_z6";
function = "pwm_vs";
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};

View File

@@ -1472,11 +1472,12 @@
drc_enable = <0>;
status = "okay";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "okay";
};
};
@@ -1524,6 +1525,18 @@
};
};
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_on_pins:bl_pwm_on_pin {
mux {
@@ -1537,6 +1550,13 @@
function = "pwm_vs";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_0_on_pins:bl_pwm_combo_0_on_pin {
mux {
pins = "pwm_b";
@@ -1561,18 +1581,12 @@
function = "pwm_vs";
};
};
/*ldim*/
ldim_pwm_pins:ldim_pwm_pin {
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "pwm_b";
function = "pwm_b";
};
};
ldim_pwm_vs_pins:ldim_pwm_vs_pin {
mux {
pins = "pwm_vs_z6";
function = "pwm_vs";
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};

View File

@@ -1465,11 +1465,12 @@
drc_enable = <0>;
status = "okay";
};
lcd_extern_i2c {
compatible = "amlogic, lcd_i2c_T5800Q";
status = "disabled";
reg = <0x1c>; /*reg_address for i2c_T5800Q*/
lcd_extern_i2c0: lcd_extern_i2c@0 {
compatible = "lcd_ext, i2c";
dev_name = "i2c_T5800Q";
reg = <0x1c>;
status = "okay";
};
};
@@ -1516,6 +1517,18 @@
};
};
/*lcd_extern*/
lcd_extern_off_pins:lcd_extern_off_pin {
mux {
pins = "GPIOH_2",
"GPIOH_3";
function = "gpio_periphs";
/*output-high;*/
output-low;
/*input-enable;*/
};
};
/*backlight*/
bl_pwm_on_pins:bl_pwm_on_pin {
mux {
@@ -1529,6 +1542,13 @@
function = "pwm_vs";
};
};
bl_pwm_off_pins:bl_pwm_off_pin {
mux {
pins = "GPIOZ_6";
function = "gpio_periphs";
output-low;
};
};
bl_pwm_combo_0_on_pins:bl_pwm_combo_0_on_pin {
mux {
pins = "pwm_b";
@@ -1553,18 +1573,12 @@
function = "pwm_vs";
};
};
/*ldim*/
ldim_pwm_pins:ldim_pwm_pin {
bl_pwm_combo_off_pins:bl_pwm_combo_off_pin {
mux {
pins = "pwm_b";
function = "pwm_b";
};
};
ldim_pwm_vs_pins:ldim_pwm_vs_pin {
mux {
pins = "pwm_vs_z6";
function = "pwm_vs";
pins = "GPIOZ_6",
"GPIOZ_7";
function = "gpio_periphs";
output-low;
};
};
};

View File

@@ -48,7 +48,7 @@
#include "aml_bl_reg.h"
/* #define AML_BACKLIGHT_DEBUG */
static unsigned int bl_debug_print_flag;
unsigned int bl_debug_print_flag;
static struct aml_bl_drv_s *bl_drv;
@@ -104,6 +104,8 @@ static struct bl_config_s bl_config = {
{.probe_flag = 0, .register_flag = 0,},
{.probe_flag = 0, .register_flag = 0,},
},
.pinmux_flag = 0xff,
};
const char *bl_chip_table[] = {
@@ -339,17 +341,19 @@ static inline unsigned int bl_do_div(unsigned long num, unsigned int den)
}
/* ****************************************************** */
#define BL_PINMUX_MAX 6
#define BL_PINMUX_MAX 8
static char *bl_pinmux_str[BL_PINMUX_MAX] = {
"pwm_on", /* 0 */
"pwm_vs_on", /* 1 */
"pwm_combo_0_1_on", /* 2 */
"pwm_combo_0_vs_1_on", /* 3 */
"pwm_combo_0_1_vs_on", /* 4 */
"pwm_off", /* 5 */
"pwm_combo_off", /* 6 */
"none",
};
static void bl_pwm_pinmux_set(struct bl_config_s *bconf)
static void bl_pwm_pinmux_set(struct bl_config_s *bconf, int status)
{
int index = 0xff;
@@ -358,19 +362,27 @@ static void bl_pwm_pinmux_set(struct bl_config_s *bconf)
switch (bconf->method) {
case BL_CTRL_PWM:
if (bconf->bl_pwm->pwm_port == BL_PWM_VS)
index = 1;
else
index = 0;
if (status) {
if (bconf->bl_pwm->pwm_port == BL_PWM_VS)
index = 1;
else
index = 0;
} else {
index = 5;
}
break;
case BL_CTRL_PWM_COMBO:
if (bconf->bl_pwm_combo0->pwm_port == BL_PWM_VS)
index = 3;
else {
if (bconf->bl_pwm_combo1->pwm_port == BL_PWM_VS)
index = 4;
else
index = 2;
if (status) {
if (bconf->bl_pwm_combo0->pwm_port == BL_PWM_VS) {
index = 3;
} else {
if (bconf->bl_pwm_combo1->pwm_port == BL_PWM_VS)
index = 4;
else
index = 2;
}
} else {
index = 6;
}
break;
default:
@@ -383,16 +395,23 @@ static void bl_pwm_pinmux_set(struct bl_config_s *bconf)
return;
}
if (bconf->pinmux_flag == index) {
BLPR("pinmux %s is already selected\n",
bl_pinmux_str[index]);
return;
}
/* request pwm pinmux */
bconf->pin = devm_pinctrl_get_select(bl_drv->dev, bl_pinmux_str[index]);
if (IS_ERR(bconf->pin)) {
BLERR("set %s pinmux error\n", bl_pinmux_str[index]);
BLERR("set pinmux %s error\n", bl_pinmux_str[index]);
} else {
if (bl_debug_print_flag) {
BLPR("request %s pinmux: %p\n",
BLPR("set pinmux %s: %p\n",
bl_pinmux_str[index], bconf->pin);
}
}
bconf->pinmux_flag = index;
}
/* ****************************************************** */
@@ -678,9 +697,11 @@ static void bl_power_on(void)
msleep(bconf->pwm_on_delay);
/* step 2: power on pwm */
bl_pwm_ctrl(bconf->bl_pwm, 1);
bl_pwm_pinmux_set(bconf, 1);
} else {
/* step 1: power on pwm */
bl_pwm_ctrl(bconf->bl_pwm, 1);
bl_pwm_pinmux_set(bconf, 1);
if (bconf->pwm_on_delay > 0)
msleep(bconf->pwm_on_delay);
/* step 2: power on enable */
@@ -696,10 +717,12 @@ static void bl_power_on(void)
/* step 2: power on pwm_combo */
bl_pwm_ctrl(bconf->bl_pwm_combo0, 1);
bl_pwm_ctrl(bconf->bl_pwm_combo1, 1);
bl_pwm_pinmux_set(bconf, 1);
} else {
/* step 1: power on pwm_combo */
bl_pwm_ctrl(bconf->bl_pwm_combo0, 1);
bl_pwm_ctrl(bconf->bl_pwm_combo1, 1);
bl_pwm_pinmux_set(bconf, 1);
if (bconf->pwm_on_delay > 0)
msleep(bconf->pwm_on_delay);
/* step 2: power on enable */
@@ -809,6 +832,7 @@ static void bl_power_off(void)
case BL_CTRL_PWM:
if (bconf->en_sequence_reverse) {
/* step 1: power off pwm */
bl_pwm_pinmux_set(bconf, 0);
bl_pwm_ctrl(bconf->bl_pwm, 0);
if (bconf->pwm_off_delay > 0)
msleep(bconf->pwm_off_delay);
@@ -820,12 +844,14 @@ static void bl_power_off(void)
/* step 2: power off pwm */
if (bconf->pwm_off_delay > 0)
msleep(bconf->pwm_off_delay);
bl_pwm_pinmux_set(bconf, 0);
bl_pwm_ctrl(bconf->bl_pwm, 0);
}
break;
case BL_CTRL_PWM_COMBO:
if (bconf->en_sequence_reverse) {
/* step 1: power off pwm_combo */
bl_pwm_pinmux_set(bconf, 0);
bl_pwm_ctrl(bconf->bl_pwm_combo0, 0);
bl_pwm_ctrl(bconf->bl_pwm_combo1, 0);
if (bconf->pwm_off_delay > 0)
@@ -838,6 +864,7 @@ static void bl_power_off(void)
/* step 2: power off pwm_combo */
if (bconf->pwm_off_delay > 0)
msleep(bconf->pwm_off_delay);
bl_pwm_pinmux_set(bconf, 0);
bl_pwm_ctrl(bconf->bl_pwm_combo0, 0);
bl_pwm_ctrl(bconf->bl_pwm_combo1, 0);
}
@@ -2136,7 +2163,6 @@ static int aml_bl_config_load(struct bl_config_s *bconf,
case BL_CTRL_PWM:
case BL_CTRL_PWM_COMBO:
ret = aml_bl_pwm_channel_register(bconf, pdev->dev.of_node);
bl_pwm_pinmux_set(bconf);
break;
#ifdef CONFIG_AMLOGIC_BL_EXTERN
case BL_CTRL_EXTERN:
@@ -3259,6 +3285,8 @@ static void aml_bl_init_status_update(void)
aml_bl_set_level(bl_on_level);
else
aml_bl_update_status(bl_drv->bldev);
bl_pwm_pinmux_set(bl_drv->bconf, 1);
}
static int aml_bl_probe(struct platform_device *pdev)
@@ -3266,7 +3294,6 @@ static int aml_bl_probe(struct platform_device *pdev)
const struct of_device_id *match;
struct backlight_properties props;
struct backlight_device *bldev;
struct bl_config_s *bconf;
int ret;
#ifdef AML_BACKLIGHT_DEBUG
@@ -3298,18 +3325,17 @@ static int aml_bl_probe(struct platform_device *pdev)
bl_drv->data->chip_type,
bl_drv->data->chip_name);
bconf = &bl_config;
bl_drv->dev = &pdev->dev;
bl_drv->bconf = bconf;
ret = aml_bl_config_load(bconf, pdev);
bl_drv->bconf = &bl_config;
ret = aml_bl_config_load(bl_drv->bconf, pdev);
if (ret)
goto err;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.power = FB_BLANK_UNBLANK; /* full on */
props.max_brightness = (bconf->level_max > 0 ?
bconf->level_max : BL_LEVEL_MAX);
props.max_brightness = (bl_drv->bconf->level_max > 0 ?
bl_drv->bconf->level_max : BL_LEVEL_MAX);
props.brightness = bl_on_level;
bldev = backlight_device_register(AML_BL_NAME, &pdev->dev,

View File

@@ -44,7 +44,8 @@ static int global_hw_init_on(void)
{
struct aml_ldim_driver_s *ldim_drv = aml_ldim_get_driver();
ldim_drv->pinmux_ctrl(ldim_drv->ldev_conf->pinmux_name);
ldim_set_duty_pwm(&(ldim_drv->ldev_conf->pwm_config));
ldim_drv->pinmux_ctrl(1);
mdelay(2);
ldim_gpio_set(ldim_drv->ldev_conf->en_gpio,
ldim_drv->ldev_conf->en_gpio_on);
@@ -59,6 +60,7 @@ static int global_hw_init_off(void)
ldim_gpio_set(ldim_drv->ldev_conf->en_gpio,
ldim_drv->ldev_conf->en_gpio_off);
ldim_drv->pinmux_ctrl(0);
ldim_pwm_off(&(ldim_drv->ldev_conf->pwm_config));
return 0;

View File

@@ -225,7 +225,8 @@ static int iw7027_hw_init_on(void)
iw7027_power_on_init(IW7027_POWER_ON);
/* step 5: supply stable vsync */
ldim_drv->pinmux_ctrl(ldim_drv->ldev_conf->pinmux_name);
ldim_set_duty_pwm(&(ldim_drv->ldev_conf->pwm_config));
ldim_drv->pinmux_ctrl(1);
/* step 6: delay for system clock and light bar PSU stable */
msleep(520);
@@ -265,6 +266,7 @@ static int iw7027_hw_init_off(void)
ldim_gpio_set(ldim_drv->ldev_conf->en_gpio,
ldim_drv->ldev_conf->en_gpio_off);
ldim_drv->pinmux_ctrl(0);
ldim_pwm_off(&(ldim_drv->ldev_conf->pwm_config));
return 0;

View File

@@ -306,51 +306,44 @@ void ldim_pwm_off(struct bl_pwm_config_s *bl_pwm)
static char *ldim_pinmux_str[] = {
"ldim_pwm", /* 0 */
"ldim_pwm_vs", /* 1 */
"ldim_pwm_off", /* 1 */
"none",
};
/* set ldim pwm_vs */
static int ldim_pwm_pinmux_ctrl(char *pin_str)
static int ldim_pwm_pinmux_ctrl(int status)
{
struct aml_ldim_driver_s *ldim_drv = aml_ldim_get_driver();
struct bl_pwm_config_s *bl_pwm;
int ret = 0;
int ret = 0, index = 0xff;
if (strcmp(pin_str, "invalid") == 0)
if (strcmp(ldim_drv->ldev_conf->pinmux_name, "invalid") == 0)
return 0;
bl_pwm = &ldim_drv->ldev_conf->pwm_config;
if (bl_pwm->pwm_port >= BL_PWM_MAX)
return 0;
ldim_set_duty_pwm(bl_pwm);
if (bl_pwm->pwm_port == BL_PWM_VS)
index = (status) ? 1 : 2;
else
index = (status) ? 0 : 2;
if (ldim_drv->pinmux_flag)
if (ldim_drv->pinmux_flag == index) {
LDIMPR("pinmux %s is already selected\n",
ldim_pinmux_str[index]);
return 0;
}
/* request pwm pinmux */
if (bl_pwm->pwm_port == BL_PWM_VS) {
ldim_drv->pin = devm_pinctrl_get_select(ldim_drv->dev,
ldim_pinmux_str[1]);
if (IS_ERR(ldim_drv->pin)) {
LDIMERR("set %s pinmux error\n",
ldim_pinmux_str[1]);
} else {
LDIMPR("request %s pinmux: %p\n",
ldim_pinmux_str[1], ldim_drv->pin);
}
ldim_drv->pin = devm_pinctrl_get_select(ldim_drv->dev,
ldim_pinmux_str[index]);
if (IS_ERR(ldim_drv->pin)) {
LDIMERR("set pinmux %s error\n", ldim_pinmux_str[index]);
} else {
ldim_drv->pin = devm_pinctrl_get_select(ldim_drv->dev,
ldim_pinmux_str[0]);
if (IS_ERR(ldim_drv->pin)) {
LDIMERR("set %s pinmux error\n",
ldim_pinmux_str[0]);
} else {
LDIMPR("request %s pinmux: %p\n",
ldim_pinmux_str[0], ldim_drv->pin);
}
LDIMPR("set pinmux %s: %p\n",
ldim_pinmux_str[index], ldim_drv->pin);
}
ldim_drv->pinmux_flag = 1;
ldim_drv->pinmux_flag = index;
return ret;
}
@@ -498,6 +491,10 @@ static void ldim_config_print(void)
break;
}
}
pr_info("pinmux_flag: %d\n"
"pinmux_pointer: 0x%p\n",
ldim_drv->pinmux_flag,
ldim_drv->pin);
} else {
pr_info("device config is null\n");
}
@@ -607,9 +604,10 @@ static int ldim_dev_get_config_from_dts(struct device_node *np, int index)
ret = of_property_read_string(child, "ldim_pwm_pinmux_sel", &str);
if (ret) {
LDIMERR("failed to get ldim_pwm_name\n");
str = "invalid";
strcpy(ldim_dev_config.pinmux_name, "invalid");
} else {
strcpy(ldim_dev_config.pinmux_name, str);
}
strcpy(ldim_dev_config.pinmux_name, str);
ret = of_property_read_string(child, "ldim_pwm_port", &str);
if (ret) {

View File

@@ -1629,7 +1629,6 @@ static void ldim_func_ctrl(unsigned char status)
static int ldim_on_init(void)
{
int ret = 0;
struct aml_ldim_driver_s *ldim_drv = aml_ldim_get_driver();
LDIMPR("%s\n", __func__);
@@ -1642,7 +1641,7 @@ static int ldim_on_init(void)
ldim_func_ctrl(0); /* default disable ldim function */
if (ldim_driver.pinmux_ctrl)
ldim_driver.pinmux_ctrl(ldim_drv->ldev_conf->pinmux_name);
ldim_driver.pinmux_ctrl(1);
ldim_on_flag = 1;
ldim_level_update = 1;
@@ -1714,7 +1713,7 @@ static struct aml_ldim_driver_s ldim_driver = {
.valid_flag = 0, /* default invalid, active when bl_ctrl_method=ldim */
.dev_index = 0xff,
.static_pic_flag = 0,
.pinmux_flag = 0,
.pinmux_flag = 0xff,
.ldim_conf = &ldim_config,
.ldev_conf = NULL,
.ldim_matrix_buf = NULL,

View File

@@ -48,7 +48,8 @@ static int ob3350_hw_init_on(void)
ldim_drv->ldev_conf->en_gpio_on);
mdelay(2);
ldim_drv->pinmux_ctrl(ldim_drv->ldev_conf->pinmux_name);
ldim_set_duty_pwm(&(ldim_drv->ldev_conf->pwm_config));
ldim_drv->pinmux_ctrl(1);
mdelay(20);
return 0;
@@ -60,6 +61,7 @@ static int ob3350_hw_init_off(void)
ldim_gpio_set(ldim_drv->ldev_conf->en_gpio,
ldim_drv->ldev_conf->en_gpio_off);
ldim_drv->pinmux_ctrl(0);
ldim_pwm_off(&(ldim_drv->ldev_conf->pwm_config));
return 0;

View File

@@ -20,7 +20,6 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/amlogic/i2c-amlogic.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/slab.h>
@@ -30,17 +29,32 @@
#include <linux/amlogic/media/vout/lcd/aml_bl.h>
#include "bl_extern.h"
unsigned int bl_extern_brightness;
static struct aml_bl_extern_driver_s bl_extern_driver;
static int bl_extern_set_level(unsigned int level)
{
bl_extern_brightness = level & 0xff;
struct aml_bl_drv_s *bl_drv = aml_bl_get_driver();
unsigned int level_max, level_min;
unsigned int dim_max, dim_min;
int ret = 0;
if (bl_drv == NULL)
return -1;
level_max = bl_drv->bconf->level_max;
level_min = bl_drv->bconf->level_min;
dim_max = bl_extern_driver.config.dim_max;
dim_min = bl_extern_driver.config.dim_min;
level = dim_min - ((level - level_min) * (dim_min - dim_max)) /
(level_max - level_min);
bl_extern_driver.brightness = level;
if (bl_extern_driver.status == 0)
return 0;
if (bl_extern_driver.device_bri_update)
bl_extern_driver.device_bri_update(level);
ret = bl_extern_driver.device_bri_update(level);
return 0;
return ret;
}
static int bl_extern_power_on(void)
@@ -50,10 +64,11 @@ static int bl_extern_power_on(void)
BLEX("%s\n", __func__);
if (bl_extern_driver.device_power_on)
bl_extern_driver.device_power_on();
ret = bl_extern_driver.device_power_on();
bl_extern_driver.status = 1;
/* restore bl level */
bl_extern_set_level(bl_extern_brightness);
bl_extern_set_level(bl_extern_driver.brightness);
return ret;
}
@@ -63,13 +78,16 @@ static int bl_extern_power_off(void)
BLEX("%s\n", __func__);
bl_extern_driver.status = 0;
if (bl_extern_driver.device_power_off)
bl_extern_driver.device_power_off();
ret = bl_extern_driver.device_power_off();
return ret;
}
static struct aml_bl_extern_driver_s bl_extern_driver = {
.status = 0,
.brightness = 0,
.power_on = bl_extern_power_on,
.power_off = bl_extern_power_off,
.set_level = bl_extern_set_level,
@@ -98,17 +116,27 @@ static unsigned char bl_extern_get_i2c_bus_str(const char *str)
unsigned char i2c_bus;
if (strncmp(str, "i2c_bus_ao", 10) == 0)
i2c_bus = AML_I2C_MASTER_AO;
i2c_bus = BL_EXTERN_I2C_BUS_4;
else if (strncmp(str, "i2c_bus_a", 9) == 0)
i2c_bus = AML_I2C_MASTER_A;
i2c_bus = BL_EXTERN_I2C_BUS_0;
else if (strncmp(str, "i2c_bus_b", 9) == 0)
i2c_bus = AML_I2C_MASTER_B;
i2c_bus = BL_EXTERN_I2C_BUS_1;
else if (strncmp(str, "i2c_bus_c", 9) == 0)
i2c_bus = AML_I2C_MASTER_C;
i2c_bus = BL_EXTERN_I2C_BUS_2;
else if (strncmp(str, "i2c_bus_d", 9) == 0)
i2c_bus = AML_I2C_MASTER_D;
i2c_bus = BL_EXTERN_I2C_BUS_3;
else if (strncmp(str, "i2c_bus_0", 10) == 0)
i2c_bus = BL_EXTERN_I2C_BUS_0;
else if (strncmp(str, "i2c_bus_1", 9) == 0)
i2c_bus = BL_EXTERN_I2C_BUS_1;
else if (strncmp(str, "i2c_bus_2", 9) == 0)
i2c_bus = BL_EXTERN_I2C_BUS_2;
else if (strncmp(str, "i2c_bus_3", 9) == 0)
i2c_bus = BL_EXTERN_I2C_BUS_3;
else if (strncmp(str, "i2c_bus_4", 9) == 0)
i2c_bus = BL_EXTERN_I2C_BUS_4;
else {
i2c_bus = AML_I2C_MASTER_A;
i2c_bus = BL_EXTERN_I2C_BUS_MAX;
BLEXERR("invalid i2c_bus: %s\n", str);
}
@@ -123,7 +151,7 @@ static void bl_extern_config_print(void)
BLEX("%s:\n", __func__);
switch (bl_extern->config.type) {
case BL_EXTERN_I2C:
pr_info("index: %d\n"
pr_info("index: %d\n"
"name: %s\n"
"type: i2c(%d)\n"
"i2c_addr: 0x%02x\n"
@@ -151,7 +179,7 @@ static void bl_extern_config_print(void)
case BL_EXTERN_SPI:
break;
case BL_EXTERN_MIPI:
pr_info("index: %d\n"
pr_info("index: %d\n"
"name: %s\n"
"type: mipi(%d)\n"
"dim_min: %d\n"
@@ -170,38 +198,46 @@ static void bl_extern_config_print(void)
static int bl_extern_config_from_dts(struct device_node *np, int index)
{
char be_propname[20];
char propname[20];
struct device_node *child;
const char *str;
unsigned int temp[5], val;
int ret = 0;
struct aml_bl_extern_driver_s *bl_extern = aml_bl_extern_get_driver();
ret = of_property_read_string(np, "i2c_bus", &str);
if (ret == 0)
bl_extern->config.i2c_bus = BL_EXTERN_I2C_BUS_MAX;
else
bl_extern->config.i2c_bus = bl_extern_get_i2c_bus_str(str);
/* get device config */
sprintf(be_propname, "extern_%d", index);
BLEX("load: %s\n", be_propname);
child = of_get_child_by_name(np, be_propname);
sprintf(propname, "extern_%d", index);
child = of_get_child_by_name(np, propname);
if (child == NULL) {
BLEXERR("failed to get %s\n", be_propname);
BLEXERR("failed to get %s\n", propname);
return -1;
}
BLEX("load: %s\n", propname);
ret = of_property_read_u32_array(child, "index", &temp[0], 1);
if (ret)
if (ret) {
BLEXERR("failed to get index, exit\n");
else {
} else {
if (temp[0] == index)
bl_extern->config.index = temp[0];
else {
BLEXERR("index not match, exit\n");
BLEXERR("index %d not match, exit\n", index);
return -1;
}
}
}
ret = of_property_read_string(child, "extern_name", &str);
if (ret) {
BLEXERR("failed to get bl_extern_name\n");
str = "bl_extern_name";
strcpy(bl_extern->config.name, "none");
} else {
strcpy(bl_extern->config.name, str);
}
strcpy(bl_extern->config.name, str);
ret = of_property_read_u32(child, "type", &val);
if (ret) {
@@ -227,30 +263,23 @@ static int bl_extern_config_from_dts(struct device_node *np, int index)
switch (bl_extern->config.type) {
case BL_EXTERN_I2C:
if (bl_extern->config.i2c_bus >= BL_EXTERN_I2C_BUS_MAX) {
BLEXERR("failed to get i2c_bus\n");
} else {
BLEX("%s i2c_bus=%s[%d]\n",
bl_extern->config.name,
str, bl_extern->config.i2c_bus);
}
ret = of_property_read_u32(child, "i2c_address", &val);
if (ret) {
BLEXERR("failed to get i2c_address\n");
} else {
bl_extern->config.i2c_addr = (unsigned char)val;
}
if (lcd_debug_print_flag) {
BLEX("%s i2c_address=0x%02x\n",
bl_extern->config.name,
bl_extern->config.i2c_addr);
}
ret = of_property_read_string(child, "i2c_bus", &str);
if (ret) {
BLEXERR("failed to get i2c_bus\n");
} else {
bl_extern->config.i2c_bus =
bl_extern_get_i2c_bus_str(str);
}
if (lcd_debug_print_flag) {
BLEX("%s i2c_bus=%s[%d]\n",
bl_extern->config.name, str,
bl_extern->config.i2c_bus);
}
break;
case BL_EXTERN_SPI:
break;
@@ -264,30 +293,26 @@ static int bl_extern_config_from_dts(struct device_node *np, int index)
static int bl_extern_add_driver(void)
{
int ret = 0;
int ret = -1;
struct bl_extern_config_s *extconf = &bl_extern_driver.config;
if (strcmp(extconf->name, "i2c_lp8556") == 0) {
#ifdef CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556
ret = i2c_lp8556_probe();
#endif
goto bl_extern_add_driver_next;
} else if (strcmp(extconf->name, "mipi_lt070me05") == 0) {
#ifdef CONFIG_AMLOGIC_BL_EXTERN_MIPI_LT070ME05
ret = mipi_lt070me05_probe();
#endif
goto bl_extern_add_driver_next;
} else {
BLEXERR("invalid device name: %s\n", extconf->name);
ret = -1;
}
bl_extern_add_driver_next:
if (ret) {
BLEXERR("add device driver failed %s(%d)\n",
extconf->name, extconf->index);
} else {
BLEX("add device driver %s(%d)\n",
BLEX("add device driver %s(%d) ok\n",
extconf->name, extconf->index);
}
@@ -296,30 +321,26 @@ bl_extern_add_driver_next:
static int bl_extern_remove_driver(void)
{
int ret = 0;
int ret = -1;
struct bl_extern_config_s *extconf = &bl_extern_driver.config;
if (strcmp(extconf->name, "i2c_lp8556") == 0) {
#ifdef CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556
ret = i2c_lp8556_remove();
#endif
goto bl_extern_remove_driver_next;
} else if (strcmp(extconf->name, "mipi_lt070me05") == 0) {
#ifdef CONFIG_AMLOGIC_BL_EXTERN_MIPI_LT070ME05
ret = mipi_lt070me05_remove();
#endif
goto bl_extern_remove_driver_next;
} else {
BLEXERR("invalid device name: %s\n", extconf->name);
ret = -1;
}
bl_extern_remove_driver_next:
if (ret) {
BLEXERR("remove device driver failed %s(%d)\n",
extconf->name, extconf->index);
} else {
BLEX("remove device driver %s(%d)\n",
BLEX("remove device driver %s(%d) ok\n",
extconf->name, extconf->index);
}
@@ -330,8 +351,7 @@ int aml_bl_extern_device_load(int index)
{
int ret = 0;
bl_extern_config_from_dts(bl_extern_driver.dev->of_node,
index);
bl_extern_config_from_dts(bl_extern_driver.dev->of_node, index);
bl_extern_add_driver();
bl_extern_driver.config_print = bl_extern_config_print;
BLEX("%s OK\n", __func__);
@@ -384,9 +404,6 @@ static int __init aml_bl_extern_init(void)
{
int ret;
if (lcd_debug_print_flag)
BLEX("%s\n", __func__);
ret = platform_driver_register(&aml_bl_extern_driver);
if (ret) {
BLEXERR("driver register failed\n");

View File

@@ -18,15 +18,29 @@
#ifndef _BL_EXTERN_H_
#define _BL_EXTERN_H_
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/amlogic/aml_gpio_consumer.h>
#include <linux/pinctrl/consumer.h>
#include <linux/amlogic/media/vout/lcd/lcd_vout.h>
extern unsigned int bl_debug_print_flag;
#define BLEX(fmt, args...) pr_info("bl extern: "fmt"", ## args)
#define BLEXERR(fmt, args...) pr_err("bl extern: error: "fmt"", ## args)
#define BLEXERR(fmt, args...) pr_err("bl extern: error: "fmt"", ## args)
#define BL_EXTERN_DRIVER "bl_extern"
struct aml_bl_extern_i2c_dev_s {
char name[20];
struct i2c_client *client;
};
extern struct aml_bl_extern_i2c_dev_s *aml_bl_extern_i2c_get_dev(void);
extern int bl_extern_i2c_write(struct i2c_client *i2client,
unsigned char *buff, unsigned int len);
extern int bl_extern_i2c_read(struct i2c_client *i2client,
unsigned char *buff, unsigned int len);
#define BL_EXTERN_DRIVER "bl_extern"
#ifdef CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556
extern int i2c_lp8556_probe(void);

View File

@@ -19,7 +19,6 @@
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/amlogic/i2c-amlogic.h>
#include <linux/amlogic/media/vout/lcd/aml_bl_extern.h>
#include "bl_extern.h"
@@ -30,8 +29,60 @@ struct aml_bl_extern_i2c_dev_s *aml_bl_extern_i2c_get_dev(void)
return i2c_device;
}
int bl_extern_i2c_write(struct i2c_client *i2client,
unsigned char *buff, unsigned int len)
{
struct i2c_msg msg;
int ret = 0;
if (i2client == NULL) {
BLEXERR("i2client is null\n");
return -1;
}
msg.addr = i2client->addr;
msg.flags = 0;
msg.len = len;
msg.buf = buff;
ret = i2c_transfer(i2client->adapter, &msg, 1);
if (ret < 0)
BLEXERR("i2c write failed [addr 0x%02x]\n", i2client->addr);
return ret;
}
int bl_extern_i2c_read(struct i2c_client *i2client,
unsigned char *buff, unsigned int len)
{
struct i2c_msg msgs[2];
int ret = 0;
if (i2client == NULL) {
BLEXERR("i2client is null\n");
return -1;
}
msgs[0].addr = i2client->addr;
msgs[0].flags = 0;
msgs[0].len = 1;
msgs[0].buf = buff;
msgs[1].addr = i2client->addr;
msgs[1].flags = I2C_M_RD;
msgs[1].len = len;
msgs[1].buf = buff;
ret = i2c_transfer(i2client->adapter, msgs, 2);
if (ret < 0) {
BLEXERR("%s: i2c transfer failed [addr 0x%02x]\n",
__func__, i2client->addr);
}
return ret;
}
static int bl_extern_i2c_config_from_dts(struct device *dev,
struct aml_bl_extern_i2c_dev_s *i2c_device)
struct aml_bl_extern_i2c_dev_s *i2c_dev)
{
int ret;
struct device_node *np = dev->of_node;
@@ -39,20 +90,20 @@ static int bl_extern_i2c_config_from_dts(struct device *dev,
ret = of_property_read_string(np, "dev_name", &str);
if (ret) {
BLEXERR("failed to get dev_i2c_name\n");
str = "bl_extern_i2c_name";
BLEXERR("failed to get dev_name\n");
strcpy(i2c_dev->name, "none");
} else {
strcpy(i2c_dev->name, str);
}
strcpy(i2c_device->name, str);
return 0;
}
static int aml_bl_extern_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
const struct i2c_device_id *id)
{
BLEX("I2C Address: 0x%02x", client->addr);
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
BLEXERR("I2C check functionality failed.");
BLEXERR("i2c check functionality failed.");
return -ENODEV;
}
@@ -63,6 +114,8 @@ static int aml_bl_extern_i2c_probe(struct i2c_client *client,
return -ENOMEM;
}
i2c_device->client = client;
BLEX("i2c Address: 0x%02x", i2c_device->client->addr);
bl_extern_i2c_config_from_dts(&client->dev, i2c_device);
return 0;
@@ -84,7 +137,7 @@ static const struct i2c_device_id aml_bl_extern_i2c_id[] = {
#ifdef CONFIG_OF
static const struct of_device_id aml_bl_extern_i2c_dt_match[] = {
{
.compatible = "amlogic, bl_extern_i2c",
.compatible = "bl_extern, i2c",
},
{},
};
@@ -107,7 +160,7 @@ static int __init aml_bl_extern_i2c_init(void)
{
int ret;
if (lcd_debug_print_flag)
if (bl_debug_print_flag)
BLEX("%s\n", __func__);
ret = i2c_add_driver(&aml_bl_extern_i2c_driver);

View File

@@ -20,24 +20,21 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/amlogic/i2c-amlogic.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/amlogic/media/vout/lcd/aml_bl_extern.h>
#include <linux/amlogic/media/vout/lcd/aml_bl.h>
#include "bl_extern.h"
#define BL_EXTERN_INDEX 0
#define BL_EXTERN_NAME "i2c_lp8556"
#define BL_EXTERN_TYPE BL_EXTERN_I2C
#define BL_EXTERN_CMD_SIZE 4
static unsigned int bl_status;
static struct bl_extern_config_s *ext_config;
static struct aml_bl_extern_i2c_dev_s *i2c_dev;
#define BL_EXTERN_CMD_SIZE 4
static unsigned char init_on_table[] = {
0x00, 0xa2, 0x20, 0x00,
0x00, 0xa5, 0x54, 0x00,
@@ -48,42 +45,28 @@ static unsigned char init_on_table[] = {
0x00, 0xa1, 0xb7, 0x00,
0x00, 0xa0, 0xff, 0x00,
0x00, 0x00, 0x80, 0x00,
0xff, 0x00, 0x00, 0x00, //ending
0xff, 0x00, 0x00, 0x00, /*ending*/
};
static unsigned char init_off_table[] = {
0xff, 0x00, 0x00, 0x00, //ending
0xff, 0x00, 0x00, 0x00, /*ending*/
};
static int i2c_lp8556_write(struct i2c_client *i2client,
unsigned char *buff, unsigned int len)
{
int ret = 0;
struct i2c_msg msg[] = {
{
.addr = i2client->addr,
.flags = 0,
.len = len,
.buf = buff,
}
};
BLEX("%s\n", __func__);
ret = i2c_transfer(i2client->adapter, msg, 1);
if (ret < 0)
BLEXERR("i2c write failed [addr 0x%02x]\n", i2client->addr);
return ret;
}
static int i2c_lp8556_power_cmd(unsigned char *init_table)
{
int i = 0, len;
int ret = 0;
struct aml_bl_extern_driver_s *bl_extern = aml_bl_extern_get_driver();
struct aml_bl_extern_i2c_dev_s *i2c_dev = aml_bl_extern_i2c_get_dev();
BLEX("%s\n", __func__);
if (ext_config == NULL) {
BLEXERR("invalid ext_config\n");
return -1;
}
if (i2c_dev == NULL) {
BLEXERR("invalid i2c device\n");
return -1;
}
len = BL_EXTERN_CMD_SIZE;
while (i <= BL_EXTERN_INIT_TABLE_MAX) {
@@ -92,16 +75,12 @@ static int i2c_lp8556_power_cmd(unsigned char *init_table)
} else if (init_table[i] == BL_EXTERN_INIT_NONE) {
/* do nothing, only for delay */
} else if (init_table[i] == BL_EXTERN_INIT_CMD) {
if (i2c_dev == NULL) {
BLEXERR("invalid i2c device\n");
return -1;
}
ret = i2c_lp8556_write(i2c_dev->client,
ret = bl_extern_i2c_write(i2c_dev->client,
&init_table[i+1], (len-2));
} else {
BLEXERR("%s(%d: %s): power_type %d is invalid\n",
__func__, bl_extern->config.index,
bl_extern->config.name, bl_extern->config.type);
BLEXERR("%s: %s(%d): power_type %d is invalid\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
}
if (init_table[i+len-1] > 0)
mdelay(init_table[i+len-1]);
@@ -114,71 +93,56 @@ static int i2c_lp8556_power_cmd(unsigned char *init_table)
static int i2c_lp8556_power_ctrl(int flag)
{
int ret = 0;
struct aml_bl_extern_driver_s *bl_extern = aml_bl_extern_get_driver();
BLEX("%s\n", __func__);
if (ext_config == NULL) {
BLEXERR("invalid ext_config\n");
return -1;
}
if (flag)
ret = i2c_lp8556_power_cmd(init_on_table);
else
ret = i2c_lp8556_power_cmd(init_off_table);
BLEX("%s(%d: %s): %d\n",
__func__, bl_extern->config.index,
bl_extern->config.name, flag);
BLEX("%s: %s(%d): %d\n",
__func__, ext_config->name, ext_config->index, flag);
return ret;
}
static int i2c_lp8556_power_on(void)
{
int ret;
BLEX("%s\n", __func__);
bl_status = 1;
ret = i2c_lp8556_power_ctrl(1);
return ret;
}
static int i2c_lp8556_power_off(void)
{
int ret;
bl_status = 0;
ret = i2c_lp8556_power_ctrl(0);
return ret;
}
static int i2c_lp8556_set_level(unsigned int level)
{
unsigned char tData[3];
int ret = 0;
struct aml_bl_drv_s *bl_drv = aml_bl_get_driver();
struct aml_bl_extern_driver_s *bl_extern = aml_bl_extern_get_driver();
struct aml_bl_extern_i2c_dev_s *i2c_dev = aml_bl_extern_i2c_get_dev();
unsigned int level_max, level_min;
unsigned int dim_max, dim_min;
if (bl_drv == NULL)
return -1;
level_max = bl_drv->bconf->level_max;
level_min = bl_drv->bconf->level_min;
dim_max = bl_extern->config.dim_max;
dim_min = bl_extern->config.dim_min;
level = dim_min - ((level - level_min) * (dim_min - dim_max)) /
(level_max - level_min);
level &= 0xff;
if (i2c_dev == NULL) {
BLEXERR("invalid i2c device\n");
return -1;
}
if (bl_status) {
tData[0] = 0x0;
tData[1] = level;
ret = i2c_lp8556_write(i2c_dev->client, tData, 2);
}
tData[0] = 0x0;
tData[1] = level & 0xff;
ret = bl_extern_i2c_write(i2c_dev->client, tData, 2);
return ret;
}
@@ -191,11 +155,8 @@ static int i2c_lp8556_update(void)
return -1;
}
if (bl_extern->config.type == BL_EXTERN_MAX) {
bl_extern->config.index = BL_EXTERN_INDEX;
bl_extern->config.type = BL_EXTERN_TYPE;
strcpy(bl_extern->config.name, BL_EXTERN_NAME);
}
ext_config = &bl_extern->config;
i2c_dev = aml_bl_extern_i2c_get_dev();
bl_extern->device_power_on = i2c_lp8556_power_on;
bl_extern->device_power_off = i2c_lp8556_power_off;

View File

@@ -20,34 +20,24 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/amlogic/i2c-amlogic.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/amlogic/media/vout/lcd/aml_bl_extern.h>
#include <linux/amlogic/media/vout/lcd/aml_bl.h>
#include "bl_extern.h"
#define BL_EXTERN_INDEX 1
#define BL_EXTERN_NAME "mipi_lt070me05"
#define BL_EXTERN_TYPE BL_EXTERN_MIPI
static unsigned int bl_status;
static int mipi_lt070me05_power_on(void)
{
bl_status = 1;
return 0;
}
static int mipi_lt070me05_power_off(void)
{
bl_status = 0;
return 0;
}
@@ -58,27 +48,12 @@ static int mipi_lt070me05_power_off(void)
static int mipi_lt070me05_set_level(unsigned int level)
{
unsigned char payload[] = {0x15, 2, 0x51, 0xe6, 0xff, 0xff};
struct aml_bl_drv_s *bl_drv = aml_bl_get_driver();
struct aml_bl_extern_driver_s *bl_extern = aml_bl_extern_get_driver();
unsigned int level_max, level_min;
unsigned int dim_max, dim_min;
if (bl_drv == NULL)
return -1;
level_max = bl_drv->bconf->level_max;
level_min = bl_drv->bconf->level_min;
dim_max = bl_extern->config.dim_max;
dim_min = bl_extern->config.dim_min;
level = dim_min - ((level - level_min) * (dim_min - dim_max)) /
(level_max - level_min);
level &= 0xff;
if (bl_status) {
payload[3] = level;
payload[3] = level & 0xff;
#ifdef CONFIG_AMLOGIC_LCD_TABLET
dsi_write_cmd(&payload[0]);
dsi_write_cmd(&payload[0]);
#endif
}
return 0;
}
@@ -91,12 +66,6 @@ static int mipi_lt070me05_update(void)
return -1;
}
if (bl_extern->config.type == BL_EXTERN_MAX) {
bl_extern->config.index = BL_EXTERN_INDEX;
bl_extern->config.type = BL_EXTERN_TYPE;
strcpy(bl_extern->config.name, BL_EXTERN_NAME);
}
bl_extern->device_power_on = mipi_lt070me05_power_on;
bl_extern->device_power_off = mipi_lt070me05_power_off;
bl_extern->device_bri_update = mipi_lt070me05_set_level;

View File

@@ -259,7 +259,7 @@ unsigned int lcd_cpu_gpio_get(unsigned int index)
return gpiod_get_value(cpu_gpio->gpio);
}
const char *lcd_ttl_pinmux_str[] = {
static char *lcd_ttl_pinmux_str[] = {
"ttl_6bit_hvsync_on", /* 0 */
"ttl_6bit_de_on", /* 1 */
"ttl_6bit_hvsync_de_on", /* 2 */
@@ -274,93 +274,91 @@ void lcd_ttl_pinmux_set(int status)
{
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
struct lcd_config_s *pconf;
unsigned int index, num;
unsigned int base, index;
if (lcd_debug_print_flag)
LCDPR("%s: %d\n", __func__, status);
pconf = lcd_drv->lcd_config;
if (pconf->lcd_basic.lcd_bits == 6)
index = 0;
base = 0;
else
index = 4;
base = 4;
if (status) {
if (pconf->pinmux_flag == 0) {
pconf->pinmux_flag = 1;
switch (pconf->lcd_control.ttl_config->sync_valid) {
case 1: /* hvsync */
num = index + 0;
break;
case 2: /* DE */
num = index + 1;
break;
default:
case 3: /* DE + hvsync */
num = index + 2;
break;
}
} else {
LCDPR("ttl pinmux is already selected\n");
return;
switch (pconf->lcd_control.ttl_config->sync_valid) {
case 1: /* hvsync */
index = base + 0;
break;
case 2: /* DE */
index = base + 1;
break;
default:
case 3: /* DE + hvsync */
index = base + 2;
break;
}
} else {
if (pconf->pinmux_flag) {
pconf->pinmux_flag = 0;
num = index + 3;
} else {
LCDPR("ttl pinmux is already released\n");
return;
}
index = base + 3;
}
if (pconf->pinmux_flag == index) {
LCDPR("pinmux %s is already selected\n",
lcd_ttl_pinmux_str[index]);
return;
}
/* request pinmux */
pconf->pin = devm_pinctrl_get_select(lcd_drv->dev,
lcd_ttl_pinmux_str[num]);
lcd_ttl_pinmux_str[index]);
if (IS_ERR(pconf->pin))
LCDERR("set ttl pinmux error\n");
LCDERR("set ttl pinmux %s error\n", lcd_ttl_pinmux_str[index]);
else {
if (lcd_debug_print_flag) {
LCDPR("set ttl pinmux %s: %p\n",
lcd_ttl_pinmux_str[index], pconf->pin);
}
}
pconf->pinmux_flag = index;
}
static char *lcd_vbyone_pinmux_str[] = {
"vbyone",
"vbyone_off",
"none",
};
/* set VX1_LOCKN && VX1_HTPDN */
void lcd_vbyone_pinmux_set(int status)
{
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
struct lcd_config_s *pconf;
unsigned int index;
if (lcd_debug_print_flag)
LCDPR("%s: %d\n", __func__, status);
#if 1
pconf = lcd_drv->lcd_config;
if (status) {
if (pconf->pinmux_flag == 0) {
pconf->pinmux_flag = 1;
/* request pinmux */
pconf->pin = devm_pinctrl_get_select(lcd_drv->dev,
"vbyone");
if (IS_ERR(pconf->pin))
LCDERR("set vbyone pinmux error\n");
} else {
LCDPR("vbyone pinmux is already selected\n");
}
index = (status) ? 0 : 1;
if (pconf->pinmux_flag == index) {
LCDPR("pinmux %s is already selected\n",
lcd_vbyone_pinmux_str[index]);
return;
}
pconf->pin = devm_pinctrl_get_select(lcd_drv->dev,
lcd_vbyone_pinmux_str[index]);
if (IS_ERR(pconf->pin)) {
LCDERR("set vbyone pinmux %s error\n",
lcd_vbyone_pinmux_str[index]);
} else {
if (pconf->pinmux_flag) {
pconf->pinmux_flag = 0;
/* release pinmux */
devm_pinctrl_put(pconf->pin);
} else {
LCDPR("vbyone pinmux is already released\n");
if (lcd_debug_print_flag) {
LCDPR("set vbyone pinmux %s: %p\n",
lcd_vbyone_pinmux_str[index], pconf->pin);
}
}
#else
if (status) {
lcd_pinmux_clr_mask(7,
((1 << 1) | (1 << 2) | (1 << 9) | (1 << 10)));
lcd_pinmux_set_mask(7, ((1 << 11) | (1 << 12)));
} else {
lcd_pinmux_clr_mask(7, ((1 << 11) | (1 << 12)));
}
#endif
pconf->pinmux_flag = index;
}
unsigned int lcd_lvds_channel_on_value(struct lcd_config_s *pconf)

View File

@@ -30,7 +30,8 @@
/* 20180620: fix coverity errors */
/* 20180626: txl suuport */
/* 20180718: mute: wait vsync for display shadow */
#define LCD_DRV_VERSION "20180718"
/* 20180827: add pinmux off support */
#define LCD_DRV_VERSION "20180827"
#define VPP_OUT_SATURATE (1 << 0)

View File

@@ -343,6 +343,12 @@ static int lcd_info_print(char *buf, int offset)
((pconf->lcd_control.ttl_config->sync_valid >> 1) & 1),
((pconf->lcd_control.ttl_config->swap_ctrl >> 1) & 1),
((pconf->lcd_control.ttl_config->swap_ctrl >> 0) & 1));
len += snprintf((buf+len), n,
"pinmux_flag %d\n"
"pinmux_pointer 0x%p\n\n",
pconf->pinmux_flag,
pconf->pin);
break;
case LCD_LVDS:
n = lcd_debug_info_len(len + offset);
@@ -414,6 +420,12 @@ static int lcd_info_print(char *buf, int offset)
((vx1_conf->ctrl_flag >> 2) & 0x1),
vx1_conf->cdr_training_hold);
}
len += snprintf((buf+len), n,
"pinmux_flag %d\n"
"pinmux_pointer 0x%p\n\n",
pconf->pinmux_flag,
pconf->pin);
break;
case LCD_MIPI:
#ifdef CONFIG_AMLOGIC_LCD_TABLET

View File

@@ -236,9 +236,9 @@ static int lcd_extern_power_cmd_dynamic_size(unsigned char *init_table,
if (init_table[i+cmd_size+1] > 0)
mdelay(init_table[i+cmd_size+1]);
} else {
EXTERR("%s(%d: %s): type %d invalid\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): type %d invalid\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
}
i += (cmd_size + 2);
step++;
@@ -289,18 +289,18 @@ static int lcd_extern_power_cmd_dynamic_size(unsigned char *init_table,
if (init_table[i+cmd_size+1] > 0)
mdelay(init_table[i+cmd_size+1]);
} else {
EXTERR("%s(%d: %s): type %d invalid\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): type %d invalid\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
}
i += (cmd_size + 2);
step++;
}
break;
default:
EXTERR("%s(%d: %s): extern_type %d is not support\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): extern_type %d is not support\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
break;
}
@@ -351,9 +351,9 @@ static int lcd_extern_power_cmd_fixed_size(unsigned char *init_table, int flag)
ret = lcd_extern_i2c_write(i2c1_dev->client,
&init_table[i+1], (cmd_size-2));
} else {
EXTERR("%s(%d: %s): type %d invalid\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): type %d invalid\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
}
if (init_table[i+cmd_size-1] > 0)
mdelay(init_table[i+cmd_size-1]);
@@ -381,9 +381,9 @@ static int lcd_extern_power_cmd_fixed_size(unsigned char *init_table, int flag)
ret = lcd_extern_spi_write(&init_table[i+1],
(cmd_size-2));
} else {
EXTERR("%s(%d: %s): type %d invalid\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): type %d invalid\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
}
if (init_table[i+cmd_size-1] > 0)
mdelay(init_table[i+cmd_size-1]);
@@ -392,20 +392,28 @@ static int lcd_extern_power_cmd_fixed_size(unsigned char *init_table, int flag)
}
break;
default:
EXTERR("%s(%d: %s): extern_type %d is not support\n",
__func__, ext_config->index,
ext_config->name, ext_config->type);
EXTERR("%s: %s(%d): extern_type %d is not support\n",
__func__, ext_config->name,
ext_config->index, ext_config->type);
break;
}
return ret;
}
static int lcd_extern_power_cmd(unsigned char *init_table, int flag)
static int lcd_extern_power_ctrl(int flag)
{
unsigned char *init_table;
unsigned char cmd_size;
int ret = 0;
if (ext_config->type == LCD_EXTERN_SPI)
spi_gpio_init();
if (flag)
init_table = ext_config->table_init_on;
else
init_table = ext_config->table_init_off;
cmd_size = ext_config->cmd_size;
if (cmd_size < 1) {
EXTERR("%s: cmd_size %d is invalid\n", __func__, cmd_size);
@@ -421,26 +429,11 @@ static int lcd_extern_power_cmd(unsigned char *init_table, int flag)
else
ret = lcd_extern_power_cmd_fixed_size(init_table, flag);
return ret;
}
static int lcd_extern_power_ctrl(int flag)
{
int ret = 0;
if (ext_config->type == LCD_EXTERN_SPI)
spi_gpio_init();
if (flag)
ret = lcd_extern_power_cmd(ext_config->table_init_on, 1);
else
ret = lcd_extern_power_cmd(ext_config->table_init_off, 0);
if (ext_config->type == LCD_EXTERN_SPI)
spi_gpio_off();
EXTPR("%s(%d: %s): %d\n",
__func__, ext_config->index, ext_config->name, flag);
EXTPR("%s: %s(%d): %d\n",
__func__, ext_config->name, ext_config->index, flag);
return ret;
}

View File

@@ -58,6 +58,7 @@ static struct lcd_extern_config_s lcd_extern_config = {
.type = LCD_EXTERN_MAX,
.status = 0,
.pinmux_valid = 0,
.pinmux_gpio_off = 2,
.key_valid = 0,
.addr_sel = 0,
@@ -65,9 +66,7 @@ static struct lcd_extern_config_s lcd_extern_config = {
.i2c_addr2 = LCD_EXTERN_I2C_ADDR_INVALID,
.i2c_bus = LCD_EXTERN_I2C_BUS_INVALID,
.i2c_sck_gpio = LCD_EXTERN_GPIO_NUM_MAX,
.i2c_sck_gpio_off = 2,
.i2c_sda_gpio = LCD_EXTERN_GPIO_NUM_MAX,
.i2c_sda_gpio_off = 2,
.spi_gpio_cs = LCD_EXTERN_GPIO_NUM_MAX,
.spi_gpio_clk = LCD_EXTERN_GPIO_NUM_MAX,
@@ -289,45 +288,56 @@ unsigned int lcd_extern_gpio_get(unsigned char index)
return gpiod_get_value(ext_gpio->gpio);
}
#define LCD_EXTERN_PINMUX_MAX 3
static char *lcd_extern_pinmux_str[LCD_EXTERN_PINMUX_MAX] = {
"extern_on", /* 0 */
"extern_off", /* 1 */
"none",
};
void lcd_extern_pinmux_set(int status)
{
/* kernel4.9 can't release pins */
int index = 0xff;
if (lcd_ext_driver == NULL)
return;
if (lcd_ext_driver->config->pinmux_valid == 0) {
if (lcd_debug_print_flag) {
EXTPR("%s: pinmux_valid %d, bypass\n",
__func__, lcd_ext_driver->config->pinmux_valid);
}
if (lcd_debug_print_flag)
EXTPR("%s: pinmux invalid, bypass\n", __func__);
return;
}
if (lcd_debug_print_flag)
EXTPR("%s: %d\n", __func__, status);
if (status) {
/* release gpio */
if (lcd_ext_driver->pinmux_flag) {
EXTPR("drv_index %d pinmux is already selected\n",
lcd_ext_driver->config->index);
return;
}
index = (status) ? 0 : 1;
/* request pinmux */
lcd_ext_driver->pin = devm_pinctrl_get_select(lcd_extern_dev,
"extern_pins");
if (IS_ERR(lcd_ext_driver->pin)) {
EXTERR("set drv_index %d pinmux error\n",
lcd_ext_driver->config->index);
} else {
if (lcd_debug_print_flag) {
EXTPR("set drv_index %d pinmux ok\n",
lcd_ext_driver->config->index);
}
}
lcd_ext_driver->pinmux_flag = 1;
if (lcd_ext_driver->pinmux_flag == index) {
EXTPR("%s(%d) pinmux %s is already selected\n",
lcd_ext_driver->config->name,
lcd_ext_driver->config->index,
lcd_extern_pinmux_str[index]);
return;
}
/* request pinmux */
lcd_ext_driver->pin = devm_pinctrl_get_select(lcd_extern_dev,
lcd_extern_pinmux_str[index]);
if (IS_ERR(lcd_ext_driver->pin)) {
EXTERR("set %s(%d) pinmux %s error\n",
lcd_ext_driver->config->name,
lcd_ext_driver->config->index,
lcd_extern_pinmux_str[index]);
} else {
if (lcd_debug_print_flag) {
EXTPR("set %s(%d) pinmux %s ok\n",
lcd_ext_driver->config->name,
lcd_ext_driver->config->index,
lcd_extern_pinmux_str[index]);
}
}
lcd_ext_driver->pinmux_flag = index;
}
#ifdef CONFIG_OF
@@ -1358,19 +1368,13 @@ static int lcd_extern_get_config(void)
lcd_extern_config.i2c_bus = lcd_extern_get_i2c_bus_str(str);
ret = of_property_read_u32_array(lcd_extern_dev->of_node,
"i2c_gpio_off", &extern_para[0], 4);
"i2c_gpio", &extern_para[0], 2);
if (ret) {
lcd_extern_config.i2c_sck_gpio = LCD_EXTERN_GPIO_NUM_MAX;
lcd_extern_config.i2c_sck_gpio_off = 2;
lcd_extern_config.i2c_sda_gpio = LCD_EXTERN_GPIO_NUM_MAX;
lcd_extern_config.i2c_sda_gpio_off = 2;
} else {
lcd_extern_config.i2c_sck_gpio = (unsigned char)extern_para[0];
lcd_extern_config.i2c_sck_gpio_off =
(unsigned char) extern_para[1];
lcd_extern_config.i2c_sda_gpio = (unsigned char)extern_para[2];
lcd_extern_config.i2c_sda_gpio_off =
(unsigned char)extern_para[3];
lcd_extern_config.i2c_sda_gpio = (unsigned char)extern_para[1];
}
ret = of_property_read_string(lcd_extern_dev->of_node,
@@ -1380,6 +1384,15 @@ static int lcd_extern_get_config(void)
else
lcd_extern_config.pinmux_valid = 1;
ret = of_property_read_u32(lcd_extern_dev->of_node,
"pinctrl_gpio_off", &extern_para[0]);
if (ret) {
lcd_extern_config.pinmux_gpio_off = 2;
} else {
lcd_extern_config.pinmux_gpio_off =
(unsigned char)extern_para[0];
}
ret = of_property_read_u32(lcd_extern_dev->of_node,
"key_valid", &extern_para[0]);
if (ret) {
@@ -1539,7 +1552,7 @@ static int lcd_extern_add_driver(struct lcd_extern_config_s *extconf)
ext_drv = lcd_ext_driver;
ext_drv->config = extconf;
ext_drv->pinmux_flag = 0;
ext_drv->pinmux_flag = 0xff;
switch (ext_drv->config->type) {
case LCD_EXTERN_I2C:
@@ -1791,6 +1804,10 @@ static ssize_t lcd_extern_info_show(struct class *class,
pr_info("not support extern_type\n");
break;
}
if (econf->pinmux_valid) {
pr_info("pinmux_flag: %d\n", lcd_ext_driver->pinmux_flag);
pr_info("pinmux_pointer: 0x%p\n", lcd_ext_driver->pin);
}
return sprintf(buf, "\n");
}

View File

@@ -191,7 +191,7 @@ static struct lcd_config_s lcd_config_dft = {
.mipi_config = &lcd_mipi_config,
},
.lcd_power = &lcd_power_config,
.pinmux_flag = 0,
.pinmux_flag = 0xff,
.change_flag = 0,
.retry_enable_flag = 0,
.retry_enable_cnt = 0,

View File

@@ -26,11 +26,11 @@ enum bl_extern_type_e {
};
enum bl_extern_i2c_bus_e {
BL_EXTERN_I2C_BUS_AO = 0,
BL_EXTERN_I2C_BUS_A,
BL_EXTERN_I2C_BUS_B,
BL_EXTERN_I2C_BUS_C,
BL_EXTERN_I2C_BUS_D,
BL_EXTERN_I2C_BUS_0 = 0,
BL_EXTERN_I2C_BUS_1,
BL_EXTERN_I2C_BUS_2,
BL_EXTERN_I2C_BUS_3,
BL_EXTERN_I2C_BUS_4,
BL_EXTERN_I2C_BUS_MAX,
};
#define BL_EXTERN_I2C_BUS_INVALID 0xff
@@ -59,8 +59,9 @@ struct bl_extern_config_s {
};
/* global API */
#define BL_EXT_DRIVER_MAX 10
struct aml_bl_extern_driver_s {
unsigned char status;
unsigned int brightness;
int (*power_on)(void);
int (*power_off)(void);
int (*set_level)(unsigned int level);
@@ -72,12 +73,6 @@ struct aml_bl_extern_driver_s {
struct device *dev;
};
struct aml_bl_extern_i2c_dev_s {
char name[20];
struct i2c_client *client;
};
extern struct aml_bl_extern_i2c_dev_s *aml_bl_extern_i2c_get_dev(void);
extern struct aml_bl_extern_driver_s *aml_bl_extern_get_driver(void);
extern int aml_bl_extern_device_load(int index);

View File

@@ -120,7 +120,7 @@ struct aml_ldim_driver_s {
int (*power_on)(void);
int (*power_off)(void);
int (*set_level)(unsigned int level);
int (*pinmux_ctrl)(char *pin_str);
int (*pinmux_ctrl)(int status);
int (*pwm_vs_update)(void);
int (*device_power_on)(void);
int (*device_power_off)(void);

View File

@@ -58,6 +58,7 @@ struct lcd_extern_config_s {
enum lcd_extern_type_e type;
unsigned char status;
unsigned char pinmux_valid;
unsigned char pinmux_gpio_off;
unsigned char key_valid;
unsigned char addr_sel; /* internal used */
@@ -65,9 +66,7 @@ struct lcd_extern_config_s {
unsigned char i2c_addr2;
unsigned char i2c_bus;
unsigned char i2c_sck_gpio;
unsigned char i2c_sck_gpio_off;
unsigned char i2c_sda_gpio;
unsigned char i2c_sda_gpio_off;
unsigned char spi_gpio_cs;
unsigned char spi_gpio_clk;