~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/lp3943.h

Version: ~ [ linux-5.15-rc1 ] ~ [ linux-5.14.5 ] ~ [ linux-5.13.18 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.66 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.147 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.206 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.246 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.282 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.283 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * TI/National Semiconductor LP3943 Device
  3  *
  4  * Copyright 2013 Texas Instruments
  5  *
  6  * Author: Milo Kim <milo.kim@ti.com>
  7  *
  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.
 11  *
 12  */
 13 
 14 #ifndef __MFD_LP3943_H__
 15 #define __MFD_LP3943_H__
 16 
 17 #include <linux/gpio.h>
 18 #include <linux/pwm.h>
 19 #include <linux/regmap.h>
 20 
 21 /* Registers */
 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
 32 
 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
 39 
 40 #define LP3943_NUM_PWMS                 2
 41 
 42 enum lp3943_pwm_output {
 43         LP3943_PWM_OUT0,
 44         LP3943_PWM_OUT1,
 45         LP3943_PWM_OUT2,
 46         LP3943_PWM_OUT3,
 47         LP3943_PWM_OUT4,
 48         LP3943_PWM_OUT5,
 49         LP3943_PWM_OUT6,
 50         LP3943_PWM_OUT7,
 51         LP3943_PWM_OUT8,
 52         LP3943_PWM_OUT9,
 53         LP3943_PWM_OUT10,
 54         LP3943_PWM_OUT11,
 55         LP3943_PWM_OUT12,
 56         LP3943_PWM_OUT13,
 57         LP3943_PWM_OUT14,
 58         LP3943_PWM_OUT15,
 59 };
 60 
 61 /*
 62  * struct lp3943_pwm_map
 63  * @output: Output pins which are mapped to each PWM channel
 64  * @num_outputs: Number of outputs
 65  */
 66 struct lp3943_pwm_map {
 67         enum lp3943_pwm_output *output;
 68         int num_outputs;
 69 };
 70 
 71 /*
 72  * struct lp3943_platform_data
 73  * @pwms: Output channel definitions for PWM channel 0 and 1
 74  */
 75 struct lp3943_platform_data {
 76         struct lp3943_pwm_map *pwms[LP3943_NUM_PWMS];
 77 };
 78 
 79 /*
 80  * struct lp3943_reg_cfg
 81  * @reg: Register address
 82  * @mask: Register bit mask to be updated
 83  * @shift: Register bit shift
 84  */
 85 struct lp3943_reg_cfg {
 86         u8 reg;
 87         u8 mask;
 88         u8 shift;
 89 };
 90 
 91 /*
 92  * struct lp3943
 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.
102  */
103 struct lp3943 {
104         struct device *dev;
105         struct regmap *regmap;
106         struct lp3943_platform_data *pdata;
107         const struct lp3943_reg_cfg *mux_cfg;
108         unsigned long pin_used;
109 };
110 
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);
114 #endif
115 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp