hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
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
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2023 Rockchip Electronics Co. Ltd.
 *
 * Author: Steven Liu <steven.liu@rock-chips.com>
 */
 
#ifndef _PINCTRL_API_H_
#define _PINCTRL_API_H_
 
#include "hal_def.h"
#include "hal_os_def.h"
#include "pinctrl_rkx110_x120.h"
 
static inline int hwpin_set(struct xferpin xfer)
{
   struct hwpin hw;
   int ret;
 
   if (!xfer.read || !xfer.write || !xfer.client || !xfer.name[0]) {
       return HAL_ERROR;
   }
 
   if (xfer.type == PIN_UNDEF || xfer.type >= PIN_MAX) {
       return HAL_INVAL;
   }
 
   memset(&hw, 0, sizeof(hw));
   hw.type = xfer.type;
   hw.xfer = xfer;
   hw.bank = xfer.bank;
   hw.mpins = xfer.mpins;
   hw.param = xfer.param;
 
   ret = HAL_PINCTRL_SetParam(&hw, hw.mpins, hw.param);
 
   return ret;
}
 
static inline int hwpin_init(void)
{
   return HAL_PINCTRL_Init();
}
 
#endif