1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Google, Inc
6 * Pavel Herrmann <morpheus.ibis@gmail.com>
16 #include <linux/list.h>
18 DECLARE_GLOBAL_DATA_PTR;
20 UCLASS_DRIVER(demo) = {
25 int demo_hello(struct udevice *dev, int ch)
27 const struct demo_ops *ops = device_get_ops(dev);
32 return ops->hello(dev, ch);
35 int demo_status(struct udevice *dev, int *status)
37 const struct demo_ops *ops = device_get_ops(dev);
42 return ops->status(dev, status);
45 int demo_get_light(struct udevice *dev)
47 const struct demo_ops *ops = device_get_ops(dev);
52 return ops->get_light(dev);
55 int demo_set_light(struct udevice *dev, int light)
57 const struct demo_ops *ops = device_get_ops(dev);
62 return ops->set_light(dev, light);
65 int demo_parse_dt(struct udevice *dev)
67 struct dm_demo_pdata *pdata = dev_get_platdata(dev);
68 int dn = dev_of_offset(dev);
70 pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0);
71 pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);
72 if (!pdata->sides || !pdata->colour) {
73 debug("%s: Invalid device tree data\n", __func__);