FILE
dss-of.c
File preview with syntax highlighting.
linux-6.19.14/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2013 Texas Instruments 4 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> 5 */ 6 7#include <linux/device.h> 8#include <linux/err.h> 9#include <linux/export.h> 10#include <linux/module.h> 11#include <linux/of.h> 12#include <linux/of_graph.h> 13#include <linux/seq_file.h> 14 15#include <video/omapfb_dss.h> 16 17#include "dss.h" 18 19struct device_node *dss_of_port_get_parent_device(struct device_node *port) 20{ 21 struct device_node *np; 22 int i; 23 24 if (!port) 25 return NULL; 26 27 np = of_get_parent(port); 28 29 for (i = 0; i < 2 && np; ++i) { 30 struct property *prop; 31 32 prop = of_find_property(np, "compatible", NULL); 33 34 if (prop) 35 return np; 36 37 np = of_get_next_parent(np); 38 } 39 40 of_node_put(np); 41 return NULL; 42} 43 44u32 dss_of_port_get_port_number(struct device_node *port) 45{ 46 int r; 47 u32 reg; 48 49 r = of_property_read_u32(port, "reg", ®); 50 if (r) 51 reg = 0; 52 53 return reg; 54} 55 56struct omap_dss_device * 57omapdss_of_find_source_for_first_ep(struct device_node *node) 58{ 59 struct device_node *ep; 60 struct device_node *src_port; 61 struct omap_dss_device *src; 62 63 ep = of_graph_get_endpoint_by_regs(node, 0, -1); 64 if (!ep) 65 return ERR_PTR(-EINVAL); 66 67 src_port = of_graph_get_remote_port(ep); 68 of_node_put(ep); 69 if (!src_port) 70 return ERR_PTR(-EINVAL); 71 72 src = omap_dss_find_output_by_port_node(src_port); 73 74 of_node_put(src_port); 75 76 return src ? src : ERR_PTR(-EPROBE_DEFER); 77} 78EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep);
~/
Read-only file preview.