From c1652f17fa6990a97a84cc3047329159f6be0e28 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 17:30:10 +0300 Subject: [PATCH 1/7] mfd: max8907: Remove IRQF_NO_AUTOEN flag IRQF_NO_AUTOEN flag doesn't go well with IRQF_SHARED flag - the check in request_threaded_irq fails and exits with EINVAL. So we ignore the flag and enable it on the first IRQ request. No interrupt should arrive from the chip as all interrupts are masked by default. Signed-off-by: Sergey Larin --- drivers/mfd/max8907.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index 40e70ab889569..41f566e6a0965 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c @@ -229,7 +229,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c, } ret = regmap_add_irq_chip(max8907->regmap_gen, max8907->i2c_gen->irq, - IRQF_ONESHOT | IRQF_SHARED | IRQF_NO_AUTOEN, + IRQF_ONESHOT | IRQF_SHARED, -1, &max8907_chg_irq_chip, &max8907->irqc_chg); if (ret != 0) { @@ -253,8 +253,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c, goto err_irqc_rtc; } - enable_irq(max8907->i2c_gen->irq); - ret = mfd_add_devices(max8907->dev, -1, max8907_cells, ARRAY_SIZE(max8907_cells), NULL, 0, NULL); if (ret != 0) { From 868e4b85c4ec63e3e5d2da00dab1143aa3178dc9 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 17:38:12 +0300 Subject: [PATCH 2/7] drm/tegra: Temporary pixel format fix for i927 Pixel format of the panel on this device is ABGR, not the typical RGBA format. There's no way to switch the pixel format in panel as there's no documenation, so do this in DRM driver instead. The proper solution would require checking MEDIA_BUS_FMT_* values in DRM driver and setting this value correctly in panel driver. Signed-off-by: Sergey Larin --- drivers/gpu/drm/grate/rgb.c | 4 ++++ drivers/gpu/drm/tegra/rgb.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/grate/rgb.c b/drivers/gpu/drm/grate/rgb.c index a652026f79438..44fe3c0f059fb 100644 --- a/drivers/gpu/drm/grate/rgb.c +++ b/drivers/gpu/drm/grate/rgb.c @@ -127,6 +127,10 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) tegra_dc_writel(rgb->dc, value, DC_COM_PIN_OUTPUT_POLARITY(1)); /* XXX: parameterize? */ + if (of_machine_is_compatible("samsung,i927")) { + /* Set DISP_COLOR_SWAP bit to swap red and blue colors */ + tegra_dc_writel(rgb->dc, (1 << 16), DC_DISP_DISP_COLOR_CONTROL); + } value = DISP_DATA_FORMAT_DF1P1C | DISP_ALIGNMENT_MSB | DISP_ORDER_RED_BLUE; tegra_dc_writel(rgb->dc, value, DC_DISP_DISP_INTERFACE_CONTROL); diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 45b474096a49b..ac3ca245a22b1 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -125,6 +125,10 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder) tegra_dc_writel(rgb->dc, value, DC_COM_PIN_OUTPUT_POLARITY(1)); /* XXX: parameterize? */ + if (of_machine_is_compatible("samsung,i927")) { + /* Set DISP_COLOR_SWAP bit to swap red and blue colors */ + tegra_dc_writel(rgb->dc, (1 << 16), DC_DISP_DISP_COLOR_CONTROL); + } value = DISP_DATA_FORMAT_DF1P1C | DISP_ALIGNMENT_MSB | DISP_ORDER_RED_BLUE; tegra_dc_writel(rgb->dc, value, DC_DISP_DISP_INTERFACE_CONTROL); From 1e16a65dd418d404e5815d52d8c2d03eb0790e20 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 17:46:29 +0300 Subject: [PATCH 3/7] power: supply: max8903: OTG disable fix The GPIO value wasn't changed after GPIO API changes - the GPIO is now ACTIVE_LOW in device tree instead of ACTIVE_HIGH. Signed-off-by: Sergey Larin --- drivers/power/supply/max8903_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/max8903_charger.c b/drivers/power/supply/max8903_charger.c index 309cb6b0dee20..22b6e0a8726b0 100644 --- a/drivers/power/supply/max8903_charger.c +++ b/drivers/power/supply/max8903_charger.c @@ -340,7 +340,7 @@ static int max8903_otg_enable(struct regulator_dev *rdev) /* Disable charging */ data->otg_en = true; if (data->usb_in) - gpiod_set_value(data->cen, 1); + gpiod_set_value(data->cen, 0); data->usb_in = false; if (data->psy_desc.type != POWER_SUPPLY_TYPE_BATTERY) From 5b518f01862aa2ab8f0cdd8ca6109db46d6550b2 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 17:55:02 +0300 Subject: [PATCH 4/7] ASoC: tegra_wm8994: Fix codec name The codec name in wm8994 driver is 'wm8994-aif1', not the 'wm8994-hifi' as there are 2 interfaces. Signed-off-by: Sergey Larin --- sound/soc/tegra/tegra_wm8994.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/tegra/tegra_wm8994.c b/sound/soc/tegra/tegra_wm8994.c index c62c02d3fa3a3..ab21360e34ab5 100644 --- a/sound/soc/tegra/tegra_wm8994.c +++ b/sound/soc/tegra/tegra_wm8994.c @@ -125,7 +125,7 @@ static int tegra_wm8994_remove(struct snd_soc_card *card) SND_SOC_DAILINK_DEFS(wm8994_hifi, DAILINK_COMP_ARRAY(COMP_EMPTY()), - DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-hifi")), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif1")), DAILINK_COMP_ARRAY(COMP_EMPTY())); static struct snd_soc_dai_link tegra_wm8994_dai = { From afd9811a60040214ed1548853846af56677facd7 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 18:02:29 +0300 Subject: [PATCH 5/7] ASoC: tegra_wm8994: Set mclk ID value The mclk_id value wasn't set, so setting clocks in wm8994_set_dai_sysclk failed with an error. This led to other failures in output configuration. Signed-off-by: Sergey Larin --- sound/soc/tegra/tegra_wm8994.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/tegra/tegra_wm8994.c b/sound/soc/tegra/tegra_wm8994.c index ab21360e34ab5..a6fa31d0b8916 100644 --- a/sound/soc/tegra/tegra_wm8994.c +++ b/sound/soc/tegra/tegra_wm8994.c @@ -149,6 +149,7 @@ static struct snd_soc_card snd_soc_tegra_wm8994 = { static const struct tegra_asoc_data tegra_wm8994_data = { .mclk_rate = tegra_wm8994_mclk_rate, + .mclk_id = WM8994_SYSCLK_MCLK1, .dapm_event = tegra_wm8994_event, .card = &snd_soc_tegra_wm8994, .add_common_dapm_widgets = true, From bb79152fe36a9eebcb5989175e7c7f165b12a6e5 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 18:09:46 +0300 Subject: [PATCH 6/7] ARM: dts: tegra20-glide: Fix GPIO polarity for max8903 Recent max8903 driver changes assume that GPIO polarity is active-low by default, while older driver assumes it's active-high. Adjust the values accordingly. Signed-off-by: Sergey Larin --- arch/arm/boot/dts/tegra20-glide.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/tegra20-glide.dts b/arch/arm/boot/dts/tegra20-glide.dts index fbd80573a50d4..d4b7fe4b04c14 100644 --- a/arch/arm/boot/dts/tegra20-glide.dts +++ b/arch/arm/boot/dts/tegra20-glide.dts @@ -869,8 +869,8 @@ usb_ta_charger: max8922-charger { compatible = "maxim,max8903"; chg-gpios = <&stmpegpio 16 GPIO_ACTIVE_LOW>; - cen-gpios = <&gpio TEGRA_GPIO(R, 3) GPIO_ACTIVE_HIGH>; - uok-gpios = <&gpio TEGRA_GPIO(T, 0) GPIO_ACTIVE_HIGH>; + cen-gpios = <&gpio TEGRA_GPIO(R, 3) GPIO_ACTIVE_LOW>; + uok-gpios = <&gpio TEGRA_GPIO(T, 0) GPIO_ACTIVE_LOW>; /* * Original sources also use FSA9480 for USB charger * detection, but it's on extcon and not GPIO, From 81857cfecfb7eac9dc08d8a742dc9e698b6deb26 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Mon, 14 Jun 2021 18:15:42 +0300 Subject: [PATCH 7/7] ARM: dts: tegra20-glide: Fix wm8994 codec config The wlf_ldo regulator is not enabled now by default, so the initialization routine failed because the device was powered off. Make the regulator always-on for now to avoid this. Also routing was changed to work with new tegra_wm8994 driver. Signed-off-by: Sergey Larin --- arch/arm/boot/dts/tegra20-glide.dts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/tegra20-glide.dts b/arch/arm/boot/dts/tegra20-glide.dts index d4b7fe4b04c14..a1a22a0b26a73 100644 --- a/arch/arm/boot/dts/tegra20-glide.dts +++ b/arch/arm/boot/dts/tegra20-glide.dts @@ -1777,6 +1777,7 @@ gpio = <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_HIGH>; regulator-enable-ramp-delay = <125000>; regulator-boot-on; + regulator-always-on; enable-active-high; }; @@ -1798,12 +1799,12 @@ nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(L, 3) GPIO_ACTIVE_HIGH>; nvidia,audio-routing = - "Int Spk", "SPKOUTLP", - "Int Spk", "SPKOUTLN", + "Speakers", "SPKOUTLP", + "Speakers", "SPKOUTLN", "Headphone Jack", "HPOUT1L", "Headphone Jack", "HPOUT1R", - "Earpiece Spk", "HPOUT2P", - "Earpiece Spk", "HPOUT2N", + "Int Spk", "HPOUT2P", + "Int Spk", "HPOUT2N", "IN1LP", "Mic Jack", "IN1LN", "Mic Jack"; /* TODO: routes for modem and, probably, BT SCO */