Skip to content

Commit

Permalink
Changed pmic from twl6030 to twl6032, usb doesnt get detected, proper…
Browse files Browse the repository at this point in the history
… usb fix needed
  • Loading branch information
MightyM17 committed May 28, 2021
1 parent 97877f9 commit 0941a57
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 21 deletions.
202 changes: 182 additions & 20 deletions arch/arm/boot/dts/omap4-samsung-espresso3g.dts
@@ -1,5 +1,6 @@
/dts-v1/;
#include "dt-bindings/gpio/gpio.h"
#include <dt-bindings/interrupt-controller/irq.h>
#include "omap443x.dtsi"

/ {
Expand Down Expand Up @@ -48,6 +49,28 @@
regulator-always-on;
enable-active-high;
};

reg_espresso_internal: regulator-espresso-internal {
compatible = "regulator-fixed";
regulator-name = "eMMC_LDO";
regulator-max-microvolt = <1800000>;
regulator-min-microvolt = <1800000>;
gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
startup-delay-us = <100000>;
regulator-boot-on;
regulator-always-on;
enable-active-high;
};

reg_espresso_external: regulator-espresso-external {
compatible = "regulator-fixed";
regulator-name = "vmmc2";
regulator-max-microvolt = <2800000>;
regulator-min-microvolt = <2800000>;
gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
regulator-always-on;
enable-active-high;
};

reg_touch_ldo_en: regulator-touch-ldo-en {
compatible = "regulator-fixed";
Expand Down Expand Up @@ -80,7 +103,7 @@
compatible = "pwm-backlight";
pinctrl-names = "default";
pinctrl-0 = <&backlight_pins>;
pwms = <&pwm10 0 5000000 0>;
pwms = <&pwm10 0 100000 0>;
power-supply = <&reg_lcd>;
enable-gpios = <&gpio3 31 0>;
brightness-levels = <0 4 8 16 32 64 128 255>;
Expand Down Expand Up @@ -121,7 +144,7 @@
data-mapping = "jeida-24";
backlight = <&backlight>;
panel-timing {
clock-frequency = <28444445>;
clock-frequency = <18962962>;

hback-porch = <210>;
hactive = <1024>;
Expand All @@ -145,7 +168,24 @@
};
};
};

gp2a_shunt: current-sense-shunt {
compatible = "current-sense-shunt";
io-channels = <&gpadc 4>;
shunt-resistor-micro-ohms = <24000000>; /* 24 kOhm https://github.com/Unlegacy-Android/android_device_samsung_espresso/blob/aosp-6.0/libsensors/LightSensor.cpp */
#io-channel-cells = <0>;
io-channel-ranges;
};
};

&omap4_pmx_wkup {
twl6030_wkup_pins: pinmux_twl6030_wkup_pins {
pinctrl-single,pins = <
OMAP4_IOPAD(0x56, PIN_OUTPUT_PULLUP | MUX_MODE2) /* fref_clk3_req.sys_drm_msecure */
>;
};
};

&omap4_pmx_core {
pwm10_default: pinmux_pwm10_default {
pinctrl-single,pins = <
Expand Down Expand Up @@ -202,6 +242,17 @@
>;
};

mmc1_pins: pinmux_mmc1_pins {
pinctrl-single,pins = <
OMAP4_IOPAD(0x0e2, PIN_INPUT_PULLDOWN | MUX_MODE0) /* sdmmc1_clk */
OMAP4_IOPAD(0x0e4, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmcc1_cmd */
OMAP4_IOPAD(0x0e6, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmcc1_dat0 */
OMAP4_IOPAD(0x0e8, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1 */
OMAP4_IOPAD(0x0ea, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2 */
OMAP4_IOPAD(0x0ec, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3 */
>;
};

mmc5_pins: pinmux_mmc5_pins {
pinctrl-single,pins = <
OMAP4_IOPAD(0x148, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */
Expand Down Expand Up @@ -255,22 +306,107 @@
>;
};

emmcen_gpio: pinmux_emmcen_gpio {
twl6030_pins: pinmux_twl6030_pins {
pinctrl-single,pins = <
OMAP4_IOPAD(0x07a, PIN_INPUT_PULLUP | MUX_MODE3) /* gpmc_ncs3.gpio_53 */
OMAP4_IOPAD(0x19e, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1.sys_nirq1 */
>;
};
};

&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;

// We need i2c1 muxed early on the boot process for pmic
// bootloader already done it for us
// pinctrl-names = "default";
// pinctrl-0 = <&i2c1_pins>;

clock-frequency = <400000>;

twl: twl@48 {
reg = <0x48>;
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */

pinctrl-names = "default";
pinctrl-0 = <
&twl6030_pins
&twl6030_wkup_pins
>;

/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
interrupt-parent = <&gic>;
};
};

#include "twl6030.dtsi"

&twl {
compatible = "ti,twl6032";

vana: regulator-vana {
compatible = "ti,twl6030-vana";
regulator-min-microvolt = <2100000>;
regulator-max-microvolt = <2100000>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};

vaux1: regulator-vaux1 {
compatible = "ti,twl6032-ldo1";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};

vusim: regulator-vusim {
compatible = "ti,twl6032-ldo3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};

vaux2: regulator-vaux2 {
compatible = "ti,twl6032-ldo4";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
};

ldo5: regulator-ldo5 {
compatible = "ti,twl6032-ldo5";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};

vcxio: regulator-vcxio {
compatible = "ti,twl6032-ldo6";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};

vusb: regulator-vusb {
compatible = "ti,twl6032-ldousb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-state-mem {
regulator-off-in-suspend;
};
};

gpadc: gpadc {
compatible = "ti,twl6032-gpadc";
interrupts = <3>;
#io-channel-cells = <1>;
};
};

&i2c2 {
Expand All @@ -297,6 +433,37 @@
&i2c4 {
pinctrl-names = "default";
pinctrl-0 = <&i2c4_pins>;

accelerometer@18 {
compatible = "bosch,bma254";
reg = <0x18>;
vdd-supply = <&ldo5>;
vddio-supply = <&vaux2>;
interrupt-parent = <&gpio4>;
interrupts = <25 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)> , <26 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
};

magnetometer@2e {
compatible = "yamaha,yas530";
reg = <0x2e>;
vdd-supply = <&ldo5>;
iovdd-supply = <&vaux2>;
reset-gpios = <&gpio5 29 GPIO_ACTIVE_LOW>;
interrupts = <&gpio6 10 IRQ_TYPE_EDGE_RISING>;
};

light-sensor@44 {
compatible = "sharp,gp2ap002a00f";
reg = <0x44>;
interrupt-parent = <&gpio1>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&ldo5>;
vio-supply = <&ldo5>;
io-channels = <&gp2a_shunt>;
io-channel-names = "alsout";
sharp,proximity-far-hysteresis = /bits/ 8 <0x40>;
sharp,proximity-close-hysteresis = /bits/ 8 <0x20>;
};
};

&dss {
Expand All @@ -313,15 +480,6 @@
};
};

#include "twl6030.dtsi"
#include "twl6030_omap4.dtsi"

&vmmc {
/* https://github.com/LineageOS/android_kernel_samsung_espresso10/blob/67333f2574cd95b40c73a4809aea55d7e889b570/arch/arm/mach-omap2/board-espresso-pmic.c */
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3000000>;
};

&twl_usb_comparator {
usb-supply = <&vusb>;
};
Expand All @@ -333,15 +491,20 @@
};

&mmc1 {
status = "disabled";
status = "ok";
pinctrl-names = "default";
pinctrl-0 = <&mmc1_pins>;

vmmc-supply = <&reg_espresso_external>;
bus-width = <4>;
};


&mmc2 {
pinctrl-names = "default";
pinctrl-0 = <&mmc2_pins>;

vmmc-supply = <&vmmc>;
vmmc-supply = <&reg_espresso_internal>;
ti,non-removable;
bus-width = <8>;
};
Expand All @@ -351,7 +514,6 @@
};

&mmc5 {
//status = "disabled";
status = "okay";

#address-cells = <1>;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/omapdrm/dss/dispc.c
Expand Up @@ -3728,6 +3728,7 @@ void dispc_mgr_set_clock_div(struct dispc_device *dispc,
enum omap_channel channel,
const struct dispc_clock_info *cinfo)
{
dump_stack();
DSSDBG("lck = %lu (%u)\n", cinfo->lck, cinfo->lck_div);
DSSDBG("pck = %lu (%u)\n", cinfo->pck, cinfo->pck_div);

Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/omapdrm/dss/dpi.c
Expand Up @@ -219,19 +219,23 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data)
static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
struct dpi_clk_calc_ctx *ctx)
{
DSSDBG("HELLO NEW DEBUGGING");
unsigned long clkin;

memset(ctx, 0, sizeof(*ctx));
ctx->dpi = dpi;
ctx->clkout_idx = dss_pll_get_clkout_idx_for_src(dpi->clk_src);

clkin = clk_get_rate(dpi->pll->clkin);
DSSDBG("clkin %lu",clkin);

if (dpi->pll->hw->type == DSS_PLL_TYPE_A) {
unsigned long pll_min, pll_max;

ctx->pck_min = pck - 1000;
ctx->pck_max = pck + 1000;
DSSDBG("ctx->pck_min %ld",ctx->pck_min);
DSSDBG("ctx->pck_max %ld",ctx->pck_max);

pll_min = 0;
pll_max = 0;
Expand All @@ -240,13 +244,17 @@ static bool dpi_pll_clk_calc(struct dpi_data *dpi, unsigned long pck,
pll_min, pll_max,
dpi_calc_pll_cb, ctx);
} else { /* DSS_PLL_TYPE_B */
DSSDBG("ELSE DSS_PLL_TYPE_B");
dss_pll_calc_b(dpi->pll, clkin, pck, &ctx->pll_cinfo);

ctx->dispc_cinfo.lck_div = 1;
ctx->dispc_cinfo.pck_div = 1;
ctx->dispc_cinfo.lck = ctx->pll_cinfo.clkout[0];
ctx->dispc_cinfo.pck = ctx->dispc_cinfo.lck;

DSSDBG("ctx->dispc_cinfo.lck %ld",ctx->dispc_cinfo.lck);
DSSDBG("ctx->dispc_cinfo.pck %ld",ctx->dispc_cinfo.pck);

return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/twl6030-regulator.c
Expand Up @@ -743,7 +743,7 @@ static int twlreg_probe(struct platform_device *pdev)
* - SC_DETECT2 (vusb, vdac, vio, vdd1/2, vpll2)
* - IT_CONFIG
*/

dev_info(&pdev->dev, "always-on %d", c->always_on);
return 0;
}

Expand Down

0 comments on commit 0941a57

Please sign in to comment.