misc: rk628: lvds: Add support for media bus format dt-bindings

In previous versions, the bus-format of lvds could be set with prop
"vesa_24", "jeida_24", etc.

In order to maintain consistency with the panel node, this patch adds
support to for set bus-format via the `MEDIA_FORMAT` number macro.

rk628-lvds {
	/* Equivalent to
		bus-format = "vesa_24";
	*/
	bus-format = <MEDIA_BUS_FMT_RGB888_1X7X4_SPWG>;
};

Change-Id: I3a8e51c58cfb52ff6b03917d9b33e96fa419bea1
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
This commit is contained in:
Chaoyi Chen
2024-01-08 18:38:18 +08:00
committed by Tao Huang
parent 331fc6de1e
commit 7fa3e04a00

View File

@@ -5,8 +5,9 @@
* Author: Guochun Huang <hero.huang@rock-chips.com>
*/
#include <linux/media-bus-format.h>
#include "rk628.h"
#include "rk628_lvds.h"
#include "rk628_combtxphy.h"
#include "rk628_config.h"
#include "panel.h"
@@ -24,8 +25,9 @@ static inline void lvds_update_bits(struct rk628 *rk628, u32 reg,
int rk628_lvds_parse(struct rk628 *rk628, struct device_node *lvds_np)
{
const char *string;
const char *string = NULL;
int ret;
u32 bus_format;
if (!of_device_is_available(lvds_np))
return -EINVAL;
@@ -40,6 +42,24 @@ int rk628_lvds_parse(struct rk628 *rk628, struct device_node *lvds_np)
else
rk628->lvds.format = LVDS_FORMAT_VESA_24BIT;
}
/* fallback to u32 type */
if (!string || strlen(string) == 0) {
if (!of_property_read_u32(lvds_np, "bus-format", &bus_format)) {
switch (bus_format) {
case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
rk628->lvds.format = LVDS_FORMAT_JEIDA_24BIT;
break;
case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
rk628->lvds.format = LVDS_FORMAT_JEIDA_18BIT;
break;
case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
rk628->lvds.format = LVDS_FORMAT_VESA_24BIT;
break;
default:
rk628->lvds.format = LVDS_FORMAT_VESA_18BIT;
}
}
}
if (!of_property_read_string(lvds_np, "link-type", &string)) {
if (!strcmp(string, "dual_link_odd_even_pixels"))