···8080CONFIG_USB_GADGET_PRODUCT_NUM=0x0c02
8181CONFIG_CI_UDC=y
8282CONFIG_VIDEO=y
8383+CONFIG_VIDEO_BRIDGE=y
8384# CONFIG_VIDEO_LOGO is not set
8485CONFIG_VIDEO_LCD_ENDEAVORU=y
8586CONFIG_VIDEO_DSI_TEGRA30=y
+86
configs/ouya_defconfig
···11+CONFIG_ARM=y
22+CONFIG_ARCH_TEGRA=y
33+CONFIG_SUPPORT_PASSING_ATAGS=y
44+CONFIG_CMDLINE_TAG=y
55+CONFIG_INITRD_TAG=y
66+CONFIG_TEXT_BASE=0x80110000
77+CONFIG_NR_DRAM_BANKS=2
88+CONFIG_ENV_SOURCE_FILE="ouya"
99+CONFIG_ENV_SIZE=0x3000
1010+CONFIG_ENV_OFFSET=0xFFFFD000
1111+CONFIG_DEFAULT_DEVICE_TREE="tegra30-ouya"
1212+CONFIG_SPL_STACK=0x800ffffc
1313+CONFIG_SPL_TEXT_BASE=0x80108000
1414+CONFIG_SYS_LOAD_ADDR=0x82000000
1515+CONFIG_TEGRA30=y
1616+CONFIG_TARGET_OUYA=y
1717+CONFIG_TEGRA_ENABLE_UARTD=y
1818+CONFIG_CMD_EBTUPDATE=y
1919+CONFIG_BUTTON_CMD=y
2020+CONFIG_BOOTDELAY=3
2121+CONFIG_OF_BOARD_SETUP=y
2222+CONFIG_OF_SYSTEM_SETUP=y
2323+CONFIG_BOOTCOMMAND="bootflow scan; echo 'Boot configuration not found... Power off in 3 sec'; sleep 3; poweroff"
2424+CONFIG_USE_PREBOOT=y
2525+CONFIG_SYS_PBSIZE=2084
2626+CONFIG_SPL_FOOTPRINT_LIMIT=y
2727+CONFIG_SPL_MAX_FOOTPRINT=0x8000
2828+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
2929+CONFIG_SPL_SYS_MALLOC=y
3030+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
3131+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x80090000
3232+CONFIG_SPL_SYS_MALLOC_SIZE=0x10000
3333+CONFIG_SYS_PROMPT="Tegra30 (Ouya) # "
3434+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
3535+CONFIG_CMD_BOOTMENU=y
3636+# CONFIG_CMD_IMI is not set
3737+CONFIG_CMD_GPIO=y
3838+CONFIG_CMD_GPT=y
3939+CONFIG_CMD_GPT_RENAME=y
4040+CONFIG_CMD_I2C=y
4141+CONFIG_CMD_MMC=y
4242+CONFIG_CMD_POWEROFF=y
4343+CONFIG_CMD_USB=y
4444+CONFIG_CMD_USB_MASS_STORAGE=y
4545+CONFIG_CMD_UMS_ABORT_KEYED=y
4646+# CONFIG_CMD_SETEXPR is not set
4747+CONFIG_CMD_PAUSE=y
4848+CONFIG_CMD_REGULATOR=y
4949+CONFIG_CMD_EXT4_WRITE=y
5050+# CONFIG_SPL_DOS_PARTITION is not set
5151+# CONFIG_SPL_EFI_PARTITION is not set
5252+CONFIG_ENV_OVERWRITE=y
5353+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
5454+CONFIG_SYS_MMC_ENV_PART=2
5555+CONFIG_BUTTON=y
5656+CONFIG_USB_FUNCTION_FASTBOOT=y
5757+CONFIG_FASTBOOT_BUF_ADDR=0x91000000
5858+CONFIG_FASTBOOT_BUF_SIZE=0x10000000
5959+CONFIG_FASTBOOT_FLASH=y
6060+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
6161+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
6262+CONFIG_GPIO_HOG=y
6363+CONFIG_SYS_I2C_TEGRA=y
6464+CONFIG_BUTTON_KEYBOARD=y
6565+CONFIG_LED=y
6666+CONFIG_LED_BLINK=y
6767+CONFIG_LED_GPIO=y
6868+CONFIG_DM_PMIC=y
6969+CONFIG_DM_PMIC_TPS65910=y
7070+CONFIG_DM_REGULATOR=y
7171+CONFIG_DM_REGULATOR_FIXED=y
7272+CONFIG_DM_REGULATOR_TPS65911=y
7373+CONFIG_PWM_TEGRA=y
7474+CONFIG_SYS_NS16550=y
7575+CONFIG_SYSRESET_TPS65910=y
7676+CONFIG_USB=y
7777+CONFIG_USB_EHCI_HCD=y
7878+CONFIG_USB_EHCI_TEGRA=y
7979+CONFIG_USB_KEYBOARD=y
8080+CONFIG_USB_GADGET=y
8181+CONFIG_CI_UDC=y
8282+CONFIG_VIDEO=y
8383+# CONFIG_VIDEO_LOGO is not set
8484+CONFIG_I2C_EDID_STANDARD=y
8585+CONFIG_VIDEO_BRIDGE=y
8686+CONFIG_VIDEO_HDMI_TEGRA=y
+2
configs/transformer_t30_defconfig
···9090CONFIG_USB_GADGET_PRODUCT_NUM=0x4daf
9191CONFIG_CI_UDC=y
9292CONFIG_VIDEO=y
9393+CONFIG_VIDEO_BRIDGE=y
9394# CONFIG_VIDEO_LOGO is not set
9495CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768=y
9596CONFIG_VIDEO_TEGRA20=y
9797+CONFIG_VIDEO_HDMI_TEGRA=y
+1
configs/x3_t30_defconfig
···8383CONFIG_USB_GADGET_PRODUCT_NUM=0x7100
8484CONFIG_CI_UDC=y
8585CONFIG_VIDEO=y
8686+CONFIG_VIDEO_BRIDGE=y
8687# CONFIG_VIDEO_LOGO is not set
8788CONFIG_BACKLIGHT_LM3533=y
8889CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825=y
···11+.. SPDX-License-Identifier: GPL-2.0+
22+33+U-Boot for the Ouya Game Console (ouya)
44+=======================================
55+66+``DISCLAMER!`` Moving your Ouya to use U-Boot assumes replacement of the
77+vendor bootloader. Vendor android firmwares will no longer be able to run on the
88+device. This replacement IS reversible.
99+1010+Quick Start
1111+-----------
1212+1313+- Build U-Boot
1414+- Process U-Boot
1515+- Flashing U-Boot into the eMMC
1616+- Boot
1717+- Self Upgrading
1818+1919+Build U-Boot
2020+------------
2121+2222+.. code-block:: bash
2323+2424+ $ export CROSS_COMPILE=arm-none-eabi-
2525+ $ make ouya_defconfig
2626+ $ make
2727+2828+After the build succeeds, you will obtain the final ``u-boot-dtb-tegra.bin``
2929+image, ready for further processing.
3030+3131+Process U-Boot
3232+--------------
3333+3434+``DISCLAMER!`` All questions related to the re-crypt work should be asked
3535+in re-crypt repo issues. NOT HERE!
3636+3737+re-crypt is a tool that processes the ``u-boot-dtb-tegra.bin`` binary into form
3838+usable by device. This process is required only on the first installation or
3939+to recover the device in case of a failed update.
4040+4141+Permanent installation can be performed either by using the nv3p protocol or by
4242+pre-loading just built U-Boot into RAM.
4343+4444+Processing for the NV3P protocol
4545+********************************
4646+4747+.. code-block:: bash
4848+4949+ $ git clone https://gitlab.com/grate-driver/re-crypt.git
5050+ $ cd re-crypt # place your u-boot-dtb-tegra.bin here
5151+ $ ./re-crypt.py --dev ouya
5252+5353+The script will produce a ``repart-block.bin`` ready to flash.
5454+5555+Processing for pre-loaded U-Boot
5656+********************************
5757+5858+The procedure is the same, but the ``--split`` argument is used with the
5959+``re-crypt.py``. The script will produce ``bct.img`` and ``ebt.img`` ready
6060+to flash.
6161+6262+Flashing U-Boot into the eMMC
6363+-----------------------------
6464+6565+Permanent installation can be performed either by using the nv3p protocol or by
6666+pre-loading just built U-Boot into RAM. Regardless of the method bct and bootloader
6767+will end up in boot0 and boot1 partitions of eMMC.
6868+6969+Flashing with the NV3P protocol
7070+*******************************
7171+7272+``DISCLAMER!`` All questions related to NvFlash should be asked in the proper
7373+place. NOT HERE! Flashing U-Boot will erase all eMMC, so make a backup before!
7474+7575+Nv3p is a custom Nvidia protocol used to recover bricked devices. Devices can
7676+enter it by pre-loading vendor bootloader with the Fusée Gelée.
7777+7878+With nv3p, ``repart-block.bin`` is used. It contains BCT and a bootloader in
7979+encrypted state in form, which can just be written RAW at the start of eMMC.
8080+8181+.. code-block:: bash
8282+8383+ $ ./run_bootloader.sh -s T30 -t ./bct/ouya.bct -b android_bootloader.bin
8484+ $ ./utiils/nvflash_v1.13.87205 --resume --rawdevicewrite 0 1024 repart-block.bin
8585+8686+When flashing is done, reboot the device.
8787+8888+Flashing with a pre-loaded U-Boot
8989+*********************************
9090+9191+U-Boot pre-loaded into RAM acts the same as when it was booted "cold". Currently
9292+U-Boot supports bootmenu entry fastboot, which allows to write a processed copy
9393+of U-Boot permanently into eMMC.
9494+9595+While pre-loading U-Boot, interrupt bootflow by pressing ``CTRL + C`` (USB keyboard
9696+must be plugged in before U-Boot is preloaded, else it will not work), input
9797+``bootmenu`` from the keyboard and hit enter. The bootmenu will appear. There, select
9898+``fastboot`` using the up and down arrows and enter key. After, on host PC, do:
9999+100100+.. code-block:: bash
101101+102102+ $ fastboot flash 0.1 bct.img
103103+ $ fastboot flash 0.2 ebt.img
104104+ $ fastboot reboot
105105+106106+Device will reboot.
107107+108108+Boot
109109+----
110110+111111+To boot Linux, U-Boot will look for an ``extlinux.conf`` on eMMC. Additionally,
112112+bootmenu provides entries to mount eMMC as mass storage, fastboot, reboot,
113113+reboot RCM, poweroff, enter U-Boot console and update bootloader (check
114114+the next chapter).
115115+116116+Flashing ``repart-block.bin`` eliminates vendor restrictions on eMMC and allows
117117+the user to use/partition it in any way the user desires.
118118+119119+Self Upgrading
120120+--------------
121121+122122+Place your ``u-boot-dtb-tegra.bin`` on the first partition of the USB. Enter
123123+bootmenu, choose update bootloader option with Enter and U-Boot should update
124124+itself. Once the process is completed, U-Boot will ask to press any button to reboot.
···700700 help
701701 This enables library for accessing EDID data from an LCD panel.
702702703703+config I2C_EDID_STANDARD
704704+ bool "Enable standard timings EDID library expansion"
705705+ depends on I2C_EDID
706706+ help
707707+ This enables standard timings expansion for EDID data from an LCD panel.
708708+703709config DISPLAY
704710 bool "Enable Display support"
705711 depends on DM
+4-4
drivers/video/bridge/Kconfig
···991010config VIDEO_BRIDGE_PARADE_DP501
1111 bool "Support Parade DP501 DP & DVI/HDMI dual mode transmitter"
1212- depends on PANEL && DM_GPIO
1212+ depends on VIDEO_BRIDGE && PANEL && DM_GPIO
1313 select DM_I2C
1414 help
1515 The Parade DP501 is a DP & DVI/HDMI dual-mode transmitter. It
···46464747config VIDEO_BRIDGE_SOLOMON_SSD2825
4848 bool "Solomon SSD2825 bridge driver"
4949- depends on PANEL && DM_GPIO
4949+ depends on VIDEO_BRIDGE && PANEL && DM_GPIO
5050 select VIDEO_MIPI_DSI
5151 help
5252- Solomon SSD2824 SPI RGB-DSI bridge driver wrapped into panel uClass.
5252+ Solomon SSD2824 SPI RGB-DSI bridge driver.
53535454config VIDEO_BRIDGE_TOSHIBA_TC358768
5555 bool "Support Toshiba TC358768 MIPI DSI bridge"
5656- depends on PANEL && DM_GPIO
5656+ depends on VIDEO_BRIDGE && PANEL && DM_GPIO
5757 select VIDEO_MIPI_DSI
5858 select DM_I2C
5959 help
···6677#include <clk.h>
88#include <dm.h>
99+#include <dm/ofnode_graph.h>
910#include <i2c.h>
1011#include <log.h>
1112#include <mipi_display.h>
1213#include <mipi_dsi.h>
1314#include <backlight.h>
1415#include <panel.h>
1616+#include <video_bridge.h>
1517#include <linux/delay.h>
1618#include <linux/err.h>
1719#include <linux/kernel.h>
···122124#define NANO 1000000000UL
123125#define PICO 1000000000000ULL
124126127127+static const char * const tc358768_supplies[] = {
128128+ "vddc-supply", "vddmipi-supply", "vddio-supply"
129129+};
130130+125131struct tc358768_priv {
126132 struct mipi_dsi_host host;
127133 struct mipi_dsi_device device;
···129135 struct udevice *panel;
130136 struct display_timing timing;
131137132132- struct udevice *vddc;
133133- struct udevice *vddmipi;
134134- struct udevice *vddio;
138138+ struct udevice *supplies[ARRAY_SIZE(tc358768_supplies)];
135139136140 struct clk *refclk;
137141···265269 tc358768_write(dev, TC358768_SYSCTL, 0);
266270}
267271268268-static void tc358768_hw_enable(struct tc358768_priv *priv)
272272+static void tc358768_hw_enable(struct udevice *dev)
269273{
274274+ struct tc358768_priv *priv = dev_get_priv(dev);
275275+ struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
270276 int ret;
271277272278 ret = clk_prepare_enable(priv->refclk);
273279 if (ret)
274280 log_debug("%s: error enabling refclk (%d)\n", __func__, ret);
275281276276- ret = regulator_set_enable_if_allowed(priv->vddc, true);
282282+ ret = regulator_set_enable_if_allowed(priv->supplies[0], true);
277283 if (ret)
278284 log_debug("%s: error enabling vddc (%d)\n", __func__, ret);
279285280280- ret = regulator_set_enable_if_allowed(priv->vddmipi, true);
286286+ ret = regulator_set_enable_if_allowed(priv->supplies[1], true);
281287 if (ret)
282288 log_debug("%s: error enabling vddmipi (%d)\n", __func__, ret);
283289284290 mdelay(10);
285291286286- ret = regulator_set_enable_if_allowed(priv->vddio, true);
292292+ ret = regulator_set_enable_if_allowed(priv->supplies[2], true);
287293 if (ret)
288294 log_debug("%s: error enabling vddio (%d)\n", __func__, ret);
289295···293299 * The RESX is active low (GPIO_ACTIVE_LOW).
294300 * DEASSERT (value = 0) the reset_gpio to enable the chip
295301 */
296296- ret = dm_gpio_set_value(&priv->reset_gpio, 0);
302302+ ret = dm_gpio_set_value(&uc_priv->reset, 0);
297303 if (ret)
298304 log_debug("%s: error changing reset-gpio (%d)\n", __func__, ret);
299305···477483 device->mode_flags &= ~MIPI_DSI_CLOCK_NON_CONTINUOUS;
478484 }
479485480480- tc358768_hw_enable(priv);
486486+ tc358768_hw_enable(dev);
481487 tc358768_sw_reset(dev);
482488483489 tc358768_setup_pll(dev);
···874880 return 0;
875881}
876882883883+static int tc358768_get_panel(struct udevice *dev)
884884+{
885885+ struct tc358768_priv *priv = dev_get_priv(dev);
886886+ int i, ret;
887887+888888+ u32 num = ofnode_graph_get_port_count(dev_ofnode(dev));
889889+890890+ for (i = 0; i < num; i++) {
891891+ ofnode remote = ofnode_graph_get_remote_node(dev_ofnode(dev), i, -1);
892892+893893+ ret = uclass_get_device_by_ofnode(UCLASS_PANEL, remote,
894894+ &priv->panel);
895895+ if (!ret)
896896+ return 0;
897897+ }
898898+899899+ /* If this point is reached, no panels were found */
900900+ return -ENODEV;
901901+}
902902+877903static int tc358768_setup(struct udevice *dev)
878904{
879905 struct tc358768_priv *priv = dev_get_priv(dev);
906906+ struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
880907 struct mipi_dsi_device *device = &priv->device;
881908 struct mipi_dsi_panel_plat *mipi_plat;
882882- int ret;
909909+ int i, ret;
883910884911 /* The bridge uses 16 bit registers */
885912 ret = i2c_set_chip_offset_len(dev, 2);
···889916 return ret;
890917 }
891918892892- ret = uclass_get_device_by_phandle(UCLASS_PANEL, dev,
893893- "panel", &priv->panel);
919919+ ret = tc358768_get_panel(dev);
894920 if (ret) {
895895- log_debug("%s: Cannot get panel: ret=%d\n", __func__, ret);
896896- return log_ret(ret);
921921+ log_debug("%s: panel not found, ret %d\n", __func__, ret);
922922+ return ret;
897923 }
898924899925 panel_get_display_timing(priv->panel, &priv->timing);
···913939 priv->dsi_lanes = device->lanes;
914940915941 /* get regulators */
916916- ret = device_get_supply_regulator(dev, "vddc-supply", &priv->vddc);
917917- if (ret) {
918918- log_debug("%s: vddc regulator error: %d\n", __func__, ret);
919919- if (ret != -ENOENT)
920920- return log_ret(ret);
921921- }
922922-923923- ret = device_get_supply_regulator(dev, "vddmipi-supply", &priv->vddmipi);
924924- if (ret) {
925925- log_debug("%s: vddmipi regulator error: %d\n", __func__, ret);
926926- if (ret != -ENOENT)
927927- return log_ret(ret);
928928- }
929929-930930- ret = device_get_supply_regulator(dev, "vddio-supply", &priv->vddio);
931931- if (ret) {
932932- log_debug("%s: vddio regulator error: %d\n", __func__, ret);
933933- if (ret != -ENOENT)
934934- return log_ret(ret);
942942+ for (i = 0; i < ARRAY_SIZE(tc358768_supplies); i++) {
943943+ ret = device_get_supply_regulator(dev, tc358768_supplies[i],
944944+ &priv->supplies[i]);
945945+ if (ret) {
946946+ log_debug("%s: cannot get %s %d\n", __func__,
947947+ tc358768_supplies[i], ret);
948948+ if (ret != -ENOENT)
949949+ return log_ret(ret);
950950+ }
935951 }
936952937953 /* get clk */
938938- priv->refclk = devm_clk_get(dev, "refclk");
954954+ priv->refclk = devm_clk_get(dev, NULL);
939955 if (IS_ERR(priv->refclk)) {
940956 log_debug("%s: Could not get refclk: %ld\n",
941957 __func__, PTR_ERR(priv->refclk));
942958 return PTR_ERR(priv->refclk);
943959 }
944960945945- /* get gpios */
946946- ret = gpio_request_by_name(dev, "reset-gpios", 0,
947947- &priv->reset_gpio, GPIOD_IS_OUT);
948948- if (ret) {
949949- log_debug("%s: Could not decode reset-gpios (%d)\n", __func__, ret);
950950- return ret;
951951- }
952952-953953- dm_gpio_set_value(&priv->reset_gpio, 1);
961961+ dm_gpio_set_value(&uc_priv->reset, 1);
954962955963 return 0;
956964}
···963971 return tc358768_setup(dev);
964972}
965973966966-struct panel_ops tc358768_ops = {
967967- .enable_backlight = tc358768_attach,
974974+static const struct video_bridge_ops tc358768_ops = {
975975+ .attach = tc358768_attach,
968976 .set_backlight = tc358768_set_backlight,
969977 .get_display_timing = tc358768_panel_timings,
970978};
···977985978986U_BOOT_DRIVER(tc358768) = {
979987 .name = "tc358768",
980980- .id = UCLASS_PANEL,
988988+ .id = UCLASS_VIDEO_BRIDGE,
981989 .of_match = tc358768_ids,
982990 .ops = &tc358768_ops,
991991+ .bind = dm_scan_fdt_dev,
983992 .probe = tc358768_probe,
984993 .priv_auto = sizeof(struct tc358768_priv),
985994};
+13-8
drivers/video/endeavoru-panel.c
···117117 struct endeavoru_panel_priv *priv = dev_get_priv(dev);
118118 int ret;
119119120120+ /*
121121+ * Due to the use of the Tegra DC backlight feature, backlight
122122+ * requests MUST NOT be made during probe or earlier. This is
123123+ * because it creates a loop, as the backlight is a DC child.
124124+ */
125125+ ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
126126+ "backlight", &priv->backlight);
127127+ if (ret) {
128128+ log_err("cannot get backlight: ret = %d\n", ret);
129129+ return ret;
130130+ }
131131+120132 ret = backlight_enable(priv->backlight);
121133 if (ret)
122134 return ret;
···135147{
136148 struct endeavoru_panel_priv *priv = dev_get_priv(dev);
137149 int ret;
138138-139139- ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
140140- "backlight", &priv->backlight);
141141- if (ret) {
142142- log_err("cannot get backlight: ret = %d\n", ret);
143143- return ret;
144144- }
145150146151 ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
147152 "vdd-supply", &priv->vdd);
···231236 /* fill characteristics of DSI data link */
232237 plat->lanes = 2;
233238 plat->format = MIPI_DSI_FMT_RGB888;
234234- plat->mode_flags = MIPI_DSI_MODE_VIDEO;
239239+ plat->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM;
235240236241 return endeavoru_panel_hw_init(dev);
237242}
+1-1
drivers/video/lg-ld070wx3.c
···158158 /* fill characteristics of DSI data link */
159159 plat->lanes = 4;
160160 plat->format = MIPI_DSI_FMT_RGB888;
161161- plat->mode_flags = MIPI_DSI_MODE_VIDEO;
161161+ plat->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM;
162162163163 return lg_ld070wx3_hw_init(dev);
164164}
+112-30
drivers/video/lm3533_backlight.c
···7788#include <backlight.h>
99#include <dm.h>
1010+#include <dm/ofnode.h>
1011#include <i2c.h>
1112#include <log.h>
1213#include <linux/delay.h>
···1718#define LM3533_BL_MAX_BRIGHTNESS 0xFF
18191920#define LM3533_SINK_OUTPUT_CONFIG_1 0x10
2020-#define LM3533_CONTROL_BANK_A_PWM 0x14
2121+#define LM3533_CONTROL_PWM_BASE 0x14
2222+#define PWM_MAX GENMASK(5, 0)
2123#define LM3533_CONTROL_BANK_AB_BRIGHTNESS 0x1A
2222-#define LM3533_CONTROL_BANK_A_FULLSCALE_CURRENT 0x1F
2424+#define LM3533_CONTROL_FULLSCALE_CURRENT_BASE 0x1F
2525+#define MAX_CURRENT_MIN 5000
2626+#define MAX_CURRENT_MAX 29800
2727+#define MAX_CURRENT_STEP 800
2328#define LM3533_CONTROL_BANK_ENABLE 0x27
2429#define LM3533_OVP_FREQUENCY_PWM_POLARITY 0x2C
3030+#define BOOST_OVP_MASK GENMASK(2, 1)
3131+#define BOOST_OVP_SHIFT 1
3232+#define BOOST_FREQ_MASK BIT(0)
3333+#define BOOST_FREQ_SHIFT 0
2534#define LM3533_BRIGHTNESS_REGISTER_A 0x40
26353636+#define LM3533_BOOST_OVP_16V 16000000UL
3737+#define LM3533_BOOST_FREQ_500KHZ 500000UL
3838+2739struct lm3533_backlight_priv {
2840 struct gpio_desc enable_gpio;
2941 u32 def_bl_lvl;
4242+4343+ /* Core */
4444+ u32 boost_ovp;
4545+ u32 boost_freq;
4646+4747+ /* Backlight */
4848+ u32 reg;
4949+ u16 max_current; /* 5000 - 29800 uA (800 uA step) */
5050+ u8 pwm; /* 0 - 0x3f */
5151+ bool linear;
5252+ bool hvled;
3053};
31543255static int lm3533_backlight_enable(struct udevice *dev)
3356{
3457 struct lm3533_backlight_priv *priv = dev_get_priv(dev);
5858+ u8 val, id = priv->reg;
3559 int ret;
36603737- dm_gpio_set_value(&priv->enable_gpio, 1);
3838- mdelay(5);
6161+ if (priv->linear) {
6262+ ret = dm_i2c_reg_clrset(dev, LM3533_CONTROL_BANK_AB_BRIGHTNESS,
6363+ BIT(2 * id + 1), BIT(2 * id + 1));
6464+ if (ret)
6565+ return ret;
6666+ }
39674040- /* HVLED 1 & 2 are controlled by Bank A */
4141- ret = dm_i2c_reg_write(dev, LM3533_SINK_OUTPUT_CONFIG_1, 0x00);
4242- if (ret)
4343- return ret;
6868+ if (priv->hvled) {
6969+ ret = dm_i2c_reg_clrset(dev, LM3533_SINK_OUTPUT_CONFIG_1,
7070+ BIT(0) | BIT(1), id | id << 1);
7171+ if (ret)
7272+ return ret;
7373+ }
44744545- /* PWM input is disabled for CABC */
4646- ret = dm_i2c_reg_write(dev, LM3533_CONTROL_BANK_A_PWM, 0x00);
4747- if (ret)
4848- return ret;
7575+ /* Set current */
7676+ if (priv->max_current < MAX_CURRENT_MIN || priv->max_current > MAX_CURRENT_MAX)
7777+ return -EINVAL;
49785050- /* Linear & Control Bank A is configured for register Current control */
5151- ret = dm_i2c_reg_write(dev, LM3533_CONTROL_BANK_AB_BRIGHTNESS, 0x02);
7979+ val = (priv->max_current - MAX_CURRENT_MIN) / MAX_CURRENT_STEP;
8080+ ret = dm_i2c_reg_write(dev, LM3533_CONTROL_FULLSCALE_CURRENT_BASE + id, val);
5281 if (ret)
5382 return ret;
54835555- /* Full-Scale Current (20.2mA) */
5656- ret = dm_i2c_reg_write(dev, LM3533_CONTROL_BANK_A_FULLSCALE_CURRENT, 0x13);
5757- if (ret)
5858- return ret;
8484+ /* Set PWM mask */
8585+ if (priv->pwm > PWM_MAX)
8686+ return -EINVAL;
59876060- /* Control Bank A is enable */
6161- ret = dm_i2c_reg_write(dev, LM3533_CONTROL_BANK_ENABLE, 0x01);
6262- if (ret)
6363- return ret;
6464-6565- ret = dm_i2c_reg_write(dev, LM3533_OVP_FREQUENCY_PWM_POLARITY, 0x0A);
8888+ ret = dm_i2c_reg_write(dev, LM3533_CONTROL_PWM_BASE + id, priv->pwm);
6689 if (ret)
6790 return ret;
68916969- return 0;
9292+ /* Enable Control Bank */
9393+ return dm_i2c_reg_clrset(dev, LM3533_CONTROL_BANK_ENABLE, BIT(id), BIT(id));
7094}
71957296static int lm3533_backlight_set_brightness(struct udevice *dev, int percent)
···92116 return 0;
93117}
94118119119+static int lm3533_backlight_of_to_plat(struct udevice *dev)
120120+{
121121+ struct lm3533_backlight_priv *priv = dev_get_priv(dev);
122122+ ofnode child;
123123+ int ret;
124124+125125+ ret = gpio_request_by_name(dev, "enable-gpios", 0,
126126+ &priv->enable_gpio, GPIOD_IS_OUT);
127127+ if (ret) {
128128+ log_err("Could not decode enable-gpios (%d)\n", ret);
129129+ return ret;
130130+ }
131131+132132+ priv->boost_ovp = dev_read_u32_default(dev, "ti,boost-ovp-microvolt",
133133+ LM3533_BOOST_OVP_16V);
134134+135135+ /* boost_ovp is defined in microvolts, convert to enum value */
136136+ priv->boost_ovp = priv->boost_ovp / (8 * 1000 * 1000) - 2;
137137+138138+ priv->boost_freq = dev_read_u32_default(dev, "ti,boost-freq-hz",
139139+ LM3533_BOOST_FREQ_500KHZ);
140140+141141+ /* boost_freq is defined in Hz, convert to enum value */
142142+ priv->boost_freq = priv->boost_freq / (500 * 1000) - 1;
143143+144144+ /* Backlight is one of children but has no dedicated driver */
145145+ ofnode_for_each_subnode(child, dev_ofnode(dev)) {
146146+ if (ofnode_device_is_compatible(child, "ti,lm3533-backlight")) {
147147+ const char *node_name = ofnode_get_name(child);
148148+149149+ if (!strcmp(&node_name[10], "1"))
150150+ priv->reg = 1;
151151+ else
152152+ priv->reg = 0;
153153+154154+ priv->max_current = ofnode_read_u32_default(child, "ti,max-current-microamp",
155155+ 5000);
156156+ priv->pwm = ofnode_read_u32_default(child, "ti,pwm-config-mask", 0);
157157+158158+ priv->def_bl_lvl = ofnode_read_u32_default(child, "default-brightness",
159159+ LM3533_BL_MAX_BRIGHTNESS);
160160+161161+ priv->linear = ofnode_read_bool(child, "ti,linear-mapping-mode");
162162+ priv->hvled = ofnode_read_bool(child, "ti,hardware-controlled");
163163+ }
164164+ }
165165+166166+ return 0;
167167+}
168168+95169static int lm3533_backlight_probe(struct udevice *dev)
96170{
97171 struct lm3533_backlight_priv *priv = dev_get_priv(dev);
···100174 if (device_get_uclass_id(dev->parent) != UCLASS_I2C)
101175 return -EPROTONOSUPPORT;
102176103103- ret = gpio_request_by_name(dev, "enable-gpios", 0,
104104- &priv->enable_gpio, GPIOD_IS_OUT);
177177+ dm_gpio_set_value(&priv->enable_gpio, 1);
178178+ mdelay(5);
179179+180180+ ret = dm_i2c_reg_clrset(dev, LM3533_OVP_FREQUENCY_PWM_POLARITY,
181181+ BOOST_FREQ_MASK, priv->boost_freq << BOOST_FREQ_SHIFT);
105182 if (ret) {
106106- log_err("Could not decode enable-gpios (%d)\n", ret);
183183+ log_debug("%s: freq config failed %d\n", __func__, ret);
107184 return ret;
108185 }
109186110110- priv->def_bl_lvl = dev_read_u32_default(dev, "default-brightness-level",
111111- LM3533_BL_MAX_BRIGHTNESS);
187187+ ret = dm_i2c_reg_clrset(dev, LM3533_OVP_FREQUENCY_PWM_POLARITY,
188188+ BOOST_OVP_MASK, priv->boost_ovp << BOOST_OVP_SHIFT);
189189+ if (ret) {
190190+ log_debug("%s: ovp config failed %d\n", __func__, ret);
191191+ return ret;
192192+ }
112193113194 return 0;
114195}
···127208 .name = "lm3533_backlight",
128209 .id = UCLASS_PANEL_BACKLIGHT,
129210 .of_match = lm3533_backlight_ids,
211211+ .of_to_plat = lm3533_backlight_of_to_plat,
130212 .probe = lm3533_backlight_probe,
131213 .ops = &lm3533_backlight_ops,
132214 .priv_auto = sizeof(struct lm3533_backlight_priv),
···129129 /* fill characteristics of DSI data link */
130130 plat->lanes = 4;
131131 plat->format = MIPI_DSI_FMT_RGB888;
132132- plat->mode_flags = MIPI_DSI_MODE_VIDEO;
132132+ plat->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM;
133133134134 return samsung_ltl106hl02_hw_init(dev);
135135}
+1
drivers/video/sharp-lq101r1sx01.c
···255255 /* fill characteristics of DSI data link */
256256 plat->lanes = 4;
257257 plat->format = MIPI_DSI_FMT_RGB888;
258258+ plat->mode_flags = MIPI_DSI_MODE_LPM;
258259259260 return sharp_lq101r1sx01_hw_init(dev);
260261}
+15-1
drivers/video/tegra20/Kconfig
···11+config HOST1X_TEGRA
22+ bool "NVIDIA Tegra host1x BUS support"
33+ depends on SIMPLE_BUS
44+15config VIDEO_TEGRA20
26 bool "Enable Display Controller support on Tegra20 and Tegra 30"
37 depends on OF_CONTROL
88+ select HOST1X_TEGRA
49 help
510 T20/T30 support video output to an attached LCD panel as well as
611 other options such as HDMI. Only the LCD is supported in U-Boot.
···9141015config VIDEO_DSI_TEGRA30
1116 bool "Enable Tegra 30 DSI support"
1212- depends on PANEL && DM_GPIO
1717+ depends on VIDEO_BRIDGE && PANEL && DM_GPIO
1318 select VIDEO_TEGRA20
1419 select VIDEO_MIPI_DSI
1520 help
1621 T30 has native support for DSI panels. This option enables support
1722 for such panels which can be used on endeavoru and tf600t.
2323+2424+config VIDEO_HDMI_TEGRA
2525+ bool "Enable Tegra HDMI support"
2626+ depends on VIDEO_BRIDGE && DM_I2C
2727+ select I2C_EDID
2828+ select VIDEO_TEGRA20
2929+ help
3030+ Tegra has native support for HDMI. This option enables support
3131+ for such connection and can be used for any supported device.
18321933config TEGRA_BACKLIGHT_PWM
2034 bool "Enable Tegra DC PWM backlight support"