aboutsummaryrefslogtreecommitdiff
path: root/product/sgm776/scp_ramfw/config_sensor.c
blob: 75c77a591784acd16ac95ddbf947833df3cac96c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Arm SCP/MCP Software
 * Copyright (c) 2015-2020, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stddef.h>
#include <fwk_element.h>
#include <fwk_module.h>
#include <fwk_module_idx.h>
#include <mod_reg_sensor.h>
#include <mod_sensor.h>
#include <system_mmap.h>

enum REG_SENSOR_DEVICES {
    REG_SENSOR_DEV_SOC_TEMP,
    REG_SENSOR_DEV_COUNT,
};

/*
 * Register Sensor driver config
 */

static struct mod_sensor_info info_soc_temperature = {
    .type = MOD_SENSOR_TYPE_DEGREES_C,
    .update_interval = 0,
    .update_interval_multiplier = 0,
    .unit_multiplier = 0,
};

static const struct fwk_element reg_sensor_element_table[] = {
    [REG_SENSOR_DEV_SOC_TEMP] = {
        .name = "Soc Temperature",
        .data = &((struct mod_reg_sensor_dev_config) {
            .reg = (uintptr_t)(SENSOR_SOC_TEMP),
            .info = &info_soc_temperature,
        }),
    },
    [REG_SENSOR_DEV_COUNT] = { 0 },
};

static const struct fwk_element *get_reg_sensor_element_table(fwk_id_t id)
{
    return reg_sensor_element_table;
}

struct fwk_module_config config_reg_sensor = {
    .get_element_table = get_reg_sensor_element_table,
};

/*
 * Sensor module config
 */
static const struct fwk_element sensor_element_table[] = {
    [0] = {
        .name = "Soc Temperature",
        .data = &((const struct mod_sensor_dev_config) {
            .driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_REG_SENSOR,
                                             REG_SENSOR_DEV_SOC_TEMP),
            .driver_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_REG_SENSOR, 0),
        }),
    },
    [1] = { 0 },
};

static const struct fwk_element *get_sensor_element_table(fwk_id_t module_id)
{
    return sensor_element_table;
}

const struct fwk_module_config config_sensor = {
    .get_element_table = get_sensor_element_table,
    .data = NULL,
};