Skip to content

Commit

Permalink
Synchronize codes for OxygenOS 4.5.11
Browse files Browse the repository at this point in the history
The changes list:
Add PS3/PS4 controller support
Update DASH charger firmware when charger has no firmware
Decrease the default LED current from 300mA to 150mA

Change-Id: I1bc384a34b8ce742e360c9d807eabb48a5324149
  • Loading branch information
aaron committed Sep 29, 2017
1 parent 9f888dd commit b9e9c1f
Show file tree
Hide file tree
Showing 26 changed files with 1,206 additions and 78 deletions.
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-backup.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-dvt1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
8 changes: 2 additions & 6 deletions arch/arm/boot/dts/qcom/cheeseburger-evb.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,8 @@
microchip,mcu-en-gpio = <&tlmm 96 0x00>;
microchip,usb-sw-1-gpio = <&tlmm 15 0x00>;
microchip,usb-sw-2-gpio = <&tlmm 16 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-evt1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-evt2.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-evt3.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-pvt.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-pvt1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-t0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
4 changes: 0 additions & 4 deletions arch/arm/boot/dts/qcom/cheeseburger-t1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@
microchip,usb-sw-2-gpio = <&tlmm 91 0x00>;
microchip,ap-clk = <&tlmm 79 0x00>;
microchip,ap-data = <&tlmm 80 0x00>;

pinctrl-names = "mux_fastchg_active", "mux_fastchg_suspend";
pinctrl-0 = <&fastchg_active &usb_sw_active &ap_clk_active &ap_data_active>;
pinctrl-1 = <&usb_sw_suspend &fastchg_suspend &ap_clk_suspend &ap_data_suspend>;
};
};

Expand Down
23 changes: 22 additions & 1 deletion arch/arm/boot/dts/qcom/cheeseburger.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,30 @@
config {
pins = "gpio80";
drive-strength = <2>;
bias-disable;
bias-pull-down;
};
};
};
};
};

&i2c_7 {
oneplus_fastcg@26{

pinctrl-names = "mux_fastchg_active",
"mux_fastchg_suspend",
"mcu_data_active",
"mcu_data_suspend";
pinctrl-0 = <&fastchg_active
&usb_sw_active
&ap_clk_active >;
pinctrl-1 = <&usb_sw_suspend
&fastchg_suspend
&ap_clk_suspend>;
pinctrl-2 =<&ap_data_active>;
pinctrl-3 =<&ap_data_suspend>;
};
};
&pmi8998_charger {
qcom,fcc-max-ua = <500000>; /*Set FCC MAX 500mA by default,FCC will be set again after check battery temperature*/
qcom,usb-icl-ua = <1800000>;
Expand Down Expand Up @@ -552,6 +569,10 @@
status = "disabled";
};

&snd_9335 {
qcom,mbhc-audio-jack-type = "4-pole-jack";
};

/* Audio */
&soc {
i2c@c1b7000 {
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/boot/dts/qcom/msm-pmi8998.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
qcom,max-current = <500>;
qcom,default-led-trigger = "torch0_trigger";
qcom,id = <0>;
qcom,current-ma = <300>;
qcom,current-ma = <150>;
qcom,ires-ua = <12500>;
qcom,hdrm-voltage-mv = <325>;
qcom,hdrm-vol-hi-lo-win-mv = <100>;
Expand All @@ -732,7 +732,7 @@
qcom,max-current = <500>;
qcom,default-led-trigger = "torch1_trigger";
qcom,id = <1>;
qcom,current-ma = <300>;
qcom,current-ma = <150>;
qcom,ires-ua = <12500>;
qcom,hdrm-voltage-mv = <325>;
qcom,hdrm-vol-hi-lo-win-mv = <100>;
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/configs/msmcortex-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ CONFIG_FG_BQ27541=y
CONFIG_ONEPLUS_FASTCHG=y
CONFIG_INPUT_JOYSTICK=y
CONFIG_JOYSTICK_XPAD=y
CONFIG_HID_SONY=y
CONFIG_SONY_FF=y
CONFIG_SMB135X_CHARGER=y
CONFIG_SMB1351_USB_CHARGER=y
CONFIG_MSM_BCL_CTL=y
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/configs/msmcortex_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ CONFIG_QPNP_FG_GEN3=y
CONFIG_FG_BQ27541=y
CONFIG_ONEPLUS_FASTCHG=y
CONFIG_JOYSTICK_XPAD=y
CONFIG_HID_SONY=y
CONFIG_SONY_FF=y
CONFIG_SMB135X_CHARGER=y
CONFIG_SMB1351_USB_CHARGER=y
CONFIG_MSM_BCL_CTL=y
Expand Down
23 changes: 23 additions & 0 deletions arch/arm64/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,16 @@ static inline u64 __raw_readq_no_log(const volatile void __iomem *addr)
LOG_BARRIER; \
})

/*2017-08-22 add for dash adapter update*/
#define __raw_write_logged_dash(v, a, _t) ({ \
volatile void __iomem *_a = (a); \
__raw_write##_t##_no_log((v), _a); \
})
#define __raw_writeb(v, a) __raw_write_logged((v), a, b)
#define __raw_writew(v, a) __raw_write_logged((v), a, w)
#define __raw_writel(v, a) __raw_write_logged((v), a, l)
/*2017-08-22 add for dash adapter update*/
#define __raw_writel_dash(v, a) __raw_write_logged_dash((v), a, l)
#define __raw_writeq(v, a) __raw_write_logged((v), a, q)

#define __raw_read_logged(a, _l, _t) ({ \
Expand All @@ -135,9 +142,17 @@ static inline u64 __raw_readq_no_log(const volatile void __iomem *addr)
__a; \
})

/*2017-08-22 add for dash adapter update*/
#define __raw_read_logged_dash(a, _l, _t) ({ \
_t __a; \
const volatile void __iomem *_a = (const volatile void __iomem *)(a); \
__a = __raw_read##_l##_no_log(_a); \
})
#define __raw_readb(a) __raw_read_logged((a), b, u8)
#define __raw_readw(a) __raw_read_logged((a), w, u16)
#define __raw_readl(a) __raw_read_logged((a), l, u32)
/*2017-08-22 add for dash adapter update*/
#define __raw_readl_dash(a) __raw_read_logged_dash((a), l, u32)
#define __raw_readq(a) __raw_read_logged((a), q, u64)

/* IO barriers */
Expand All @@ -154,11 +169,15 @@ static inline u64 __raw_readq_no_log(const volatile void __iomem *addr)
#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
/*2017-08-22 add for dash adapter update*/
#define readl_relaxed_dash(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl_dash(c)); __r; })
#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64)__raw_readq(c)); __r; })

#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c)))
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c)))
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
/*2017-08-22 add for dash adapter update*/
#define writel_relaxed_dash(v,c) ((void)__raw_writel_dash((__force u32)cpu_to_le32(v),(c)))
#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c)))

#define readb_relaxed_no_log(c) ({ u8 __v = __raw_readb_no_log(c); __v; })
Expand All @@ -179,11 +198,15 @@ static inline u64 __raw_readq_no_log(const volatile void __iomem *addr)
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
/*2017-08-22 add for dash adapter update*/
#define readl_dash(c) ({ u32 __v = readl_relaxed_dash(c); __v; })
#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(); __v; })

#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); })
#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); })
#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); })
/*2017-08-22 add for dash adapter update*/
#define writel_dash(v,c) ({ writel_relaxed_dash((v),(c)); })
#define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); })

#define readb_no_log(c) ({ u8 __v = readb_relaxed_no_log(c); __iormb(); __v; })
Expand Down
43 changes: 30 additions & 13 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#define CREATE_TRACE_POINTS
#include <trace/events/gpio.h>
/*add for dash adapter update*/
#include <linux/power/oem_external_fg.h>

/* Implementation infrastructure for GPIO interfaces.
*
Expand Down Expand Up @@ -1283,15 +1285,18 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc)

chip = desc->chip;
offset = gpio_chip_hwgpio(desc);
value = chip->get ? chip->get(chip, offset) : -EIO;
/*
* FIXME: fix all drivers to clamp to [0,1] or return negative,
* then change this to:
* value = value < 0 ? value : !!value;
* so we can properly propagate error codes.
*/
value = !!value;
trace_gpio_value(desc_to_gpio(desc), 1, value);
if (dash_adapter_update_is_rx_gpio(desc_to_gpio(desc))) {
if (chip->get_dash) {
value = chip->get_dash(chip, offset);
} else {
pr_err("%s get_dash not exist\n", __func__);
value = chip->get ? chip->get(chip, offset) : 0;
}
} else {
value = chip->get ? chip->get(chip, offset) : -EIO;
value = !!value;
trace_gpio_value(desc_to_gpio(desc), 1, value);
}
return value;
}

Expand Down Expand Up @@ -1403,13 +1408,25 @@ static void _gpiod_set_raw_value(struct gpio_desc *desc, bool value)
struct gpio_chip *chip;

chip = desc->chip;
trace_gpio_value(desc_to_gpio(desc), 0, value);
if (dash_adapter_update_is_tx_gpio(desc_to_gpio(desc)) == false)
trace_gpio_value(desc_to_gpio(desc), 0, value);
if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
_gpio_set_open_drain_value(desc, value);
else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
_gpio_set_open_source_value(desc, value);
else
chip->set(chip, gpio_chip_hwgpio(desc), value);
else {
if (dash_adapter_update_is_tx_gpio(desc_to_gpio(desc))) {
if (chip->set_dash) {
chip->set_dash(chip,
gpio_chip_hwgpio(desc), value);
} else {
/*pr_err("%s set_dash not exist\n", __func__);*/
chip->set(chip, gpio_chip_hwgpio(desc), value);
}
} else {
chip->set(chip, gpio_chip_hwgpio(desc), value);
}
}
}

/*
Expand Down Expand Up @@ -2591,7 +2608,7 @@ void print_pinctrl_stats_op(void)
else
gpiolib_dbg_show(NULL, chip);
}
// gpiolib_seq_show(NULL, chip);
/* gpiolib_seq_show(NULL, chip);*/

spin_unlock_irqrestore(&gpio_lock, flags);
}
Expand Down
21 changes: 21 additions & 0 deletions drivers/input/misc/qpnp-power-on.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,27 @@ qpnp_get_cfg(struct qpnp_pon *pon, u32 pon_type)

return NULL;
}
bool oem_report_power_key(u32 pon_type)
{
struct qpnp_pon *pon = sys_reset_dev;
struct qpnp_pon_config *cfg = NULL;

cfg = qpnp_get_cfg(pon, pon_type);
if (!cfg)
return -EINVAL;

/* Check if key reporting is supported */
if (!cfg->key_code)
return 0;

input_report_key(pon->pon_input, cfg->key_code, 1);
input_sync(pon->pon_input);
input_report_key(pon->pon_input, cfg->key_code, 0);
input_sync(pon->pon_input);

return true;
}
EXPORT_SYMBOL(oem_report_power_key);

static int
qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type)
Expand Down
Loading

0 comments on commit b9e9c1f

Please sign in to comment.