]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/demo/demo-uclass.c
2 * Copyright (c) 2013 Google, Inc
5 * Pavel Herrmann <morpheus.ibis@gmail.com>
7 * SPDX-License-Identifier: GPL-2.0+
17 #include <linux/list.h>
19 DECLARE_GLOBAL_DATA_PTR
;
21 UCLASS_DRIVER(demo
) = {
26 int demo_hello(struct udevice
*dev
, int ch
)
28 const struct demo_ops
*ops
= device_get_ops(dev
);
33 return ops
->hello(dev
, ch
);
36 int demo_status(struct udevice
*dev
, int *status
)
38 const struct demo_ops
*ops
= device_get_ops(dev
);
43 return ops
->status(dev
, status
);
46 int demo_get_light(struct udevice
*dev
)
48 const struct demo_ops
*ops
= device_get_ops(dev
);
53 return ops
->get_light(dev
);
56 int demo_set_light(struct udevice
*dev
, int light
)
58 const struct demo_ops
*ops
= device_get_ops(dev
);
63 return ops
->set_light(dev
, light
);
66 int demo_parse_dt(struct udevice
*dev
)
68 struct dm_demo_pdata
*pdata
= dev_get_platdata(dev
);
69 int dn
= dev
->of_offset
;
71 pdata
->sides
= fdtdec_get_int(gd
->fdt_blob
, dn
, "sides", 0);
72 pdata
->colour
= fdt_getprop(gd
->fdt_blob
, dn
, "colour", NULL
);
73 if (!pdata
->sides
|| !pdata
->colour
) {
74 debug("%s: Invalid device tree data\n", __func__
);