Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Lochnagar internals
0004  *
0005  * Copyright (c) 2013-2018 Cirrus Logic, Inc. and
0006  *                         Cirrus Logic International Semiconductor Ltd.
0007  *
0008  * Author: Charles Keepax <ckeepax@opensource.cirrus.com>
0009  */
0010 
0011 #include <linux/device.h>
0012 #include <linux/mutex.h>
0013 #include <linux/regmap.h>
0014 
0015 #ifndef CIRRUS_LOCHNAGAR_H
0016 #define CIRRUS_LOCHNAGAR_H
0017 
0018 enum lochnagar_type {
0019     LOCHNAGAR1,
0020     LOCHNAGAR2,
0021 };
0022 
0023 /**
0024  * struct lochnagar - Core data for the Lochnagar audio board driver.
0025  *
0026  * @type: The type of Lochnagar device connected.
0027  * @dev: A pointer to the struct device for the main MFD.
0028  * @regmap: The devices main register map.
0029  * @analogue_config_lock: Lock used to protect updates in the analogue
0030  * configuration as these must not be changed whilst the hardware is processing
0031  * the last update.
0032  */
0033 struct lochnagar {
0034     enum lochnagar_type type;
0035     struct device *dev;
0036     struct regmap *regmap;
0037 
0038     /* Lock to protect updates to the analogue configuration */
0039     struct mutex analogue_config_lock;
0040 };
0041 
0042 /* Register Addresses */
0043 #define LOCHNAGAR_SOFTWARE_RESET                             0x00
0044 #define LOCHNAGAR_FIRMWARE_ID1                               0x01
0045 #define LOCHNAGAR_FIRMWARE_ID2                               0x02
0046 
0047 /* (0x0000)  Software Reset */
0048 #define LOCHNAGAR_DEVICE_ID_MASK                           0xFFFC
0049 #define LOCHNAGAR_DEVICE_ID_SHIFT                               2
0050 #define LOCHNAGAR_REV_ID_MASK                              0x0003
0051 #define LOCHNAGAR_REV_ID_SHIFT                                  0
0052 
0053 int lochnagar_update_config(struct lochnagar *lochnagar);
0054 
0055 #endif