2 * TI/National Semiconductor LP3943 Device
4 * Copyright 2013 Texas Instruments
6 * Author: Milo Kim <milo.kim@ti.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #ifndef __MFD_LP3943_H__
15 #define __MFD_LP3943_H__
17 #include <linux/gpio.h>
18 #include <linux/pwm.h>
19 #include <linux/regmap.h>
22 #define LP3943_REG_GPIO_A 0x00
23 #define LP3943_REG_GPIO_B 0x01
24 #define LP3943_REG_PRESCALE0 0x02
25 #define LP3943_REG_PWM0 0x03
26 #define LP3943_REG_PRESCALE1 0x04
27 #define LP3943_REG_PWM1 0x05
28 #define LP3943_REG_MUX0 0x06
29 #define LP3943_REG_MUX1 0x07
30 #define LP3943_REG_MUX2 0x08
31 #define LP3943_REG_MUX3 0x09
33 /* Bit description for LP3943_REG_MUX0 ~ 3 */
34 #define LP3943_GPIO_IN 0x00
35 #define LP3943_GPIO_OUT_HIGH 0x00
36 #define LP3943_GPIO_OUT_LOW 0x01
37 #define LP3943_DIM_PWM0 0x02
38 #define LP3943_DIM_PWM1 0x03
40 #define LP3943_NUM_PWMS 2
42 enum lp3943_pwm_output
{
62 * struct lp3943_pwm_map
63 * @output: Output pins which are mapped to each PWM channel
64 * @num_outputs: Number of outputs
66 struct lp3943_pwm_map
{
67 enum lp3943_pwm_output
*output
;
72 * struct lp3943_platform_data
73 * @pwms: Output channel definitions for PWM channel 0 and 1
75 struct lp3943_platform_data
{
76 struct lp3943_pwm_map
*pwms
[LP3943_NUM_PWMS
];
80 * struct lp3943_reg_cfg
81 * @reg: Register address
82 * @mask: Register bit mask to be updated
83 * @shift: Register bit shift
85 struct lp3943_reg_cfg
{
93 * @dev: Parent device pointer
94 * @regmap: Used for I2C communication on accessing registers
95 * @pdata: LP3943 platform specific data
96 * @mux_cfg: Register configuration for pin MUX
97 * @pin_used: Bit mask for output pin used.
98 * This bitmask is used for pin assignment management.
99 * 1 = pin used, 0 = available.
100 * Only LSB 16 bits are used, but it is unsigned long type
101 * for atomic bitwise operations.
105 struct regmap
*regmap
;
106 struct lp3943_platform_data
*pdata
;
107 const struct lp3943_reg_cfg
*mux_cfg
;
108 unsigned long pin_used
;
111 int lp3943_read_byte(struct lp3943
*lp3943
, u8 reg
, u8
*read
);
112 int lp3943_write_byte(struct lp3943
*lp3943
, u8 reg
, u8 data
);
113 int lp3943_update_bits(struct lp3943
*lp3943
, u8 reg
, u8 mask
, u8 data
);
This page took 0.03269 seconds and 5 git commands to generate.