1258945Sroberto// Copyright 2018 The Fuchsia Authors. All rights reserved.
2258945Sroberto// Use of this source code is governed by a BSD-style license that can be
3258945Sroberto// found in the LICENSE file.
4258945Sroberto
5258945Sroberto#include <ddk/debug.h>
6258945Sroberto#include <ddk/device.h>
7258945Sroberto#include <ddk/protocol/platform-bus.h>
8258945Sroberto#include <ddk/protocol/platform-defs.h>
9258945Sroberto#include <soc/aml-s912/s912-hw.h>
10258945Sroberto
11258945Sroberto#include "vim.h"
12275970Scy
13258945Srobertostatic const pbus_i2c_channel_t led2472g_channels[] = {
14258945Sroberto    {
15275970Scy        .bus_id = 0,
16258945Sroberto        .address = 0x46,
17258945Sroberto    },
18258945Sroberto};
19258945Sroberto
20258945Srobertostatic const pbus_dev_t led2472g_dev = {
21258945Sroberto    .name = "led2472g",
22258945Sroberto    .vid = PDEV_VID_GENERIC,
23258945Sroberto    .pid = PDEV_PID_GENERIC,
24258945Sroberto    .did = PDEV_DID_LED2472G,
25258945Sroberto    .i2c_channels = led2472g_channels,
26258945Sroberto    .i2c_channel_count = countof(led2472g_channels),
27258945Sroberto};
28258945Sroberto
29258945Srobertozx_status_t vim_led2472g_init(vim_bus_t* bus) {
30258945Sroberto    zx_status_t status;
31258945Sroberto    if ((status = pbus_device_add(&bus->pbus, &led2472g_dev)) != ZX_OK) {
32258945Sroberto        zxlogf(ERROR, "vim_led2472g_init: pbus_device_add() failed for led2472g: %d\n", status);
33258945Sroberto        return status;
34258945Sroberto    }
35258945Sroberto
36258945Sroberto    return ZX_OK;
37258945Sroberto}
38258945Sroberto