forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'regmap-v3.13' of git://git.kernel.org/pub/scm/linux/kernel…
…/git/broonie/regmap Pull regmap updates from Mark Brown: "The main thing this time around has been some improvments to async I/O. - Cleaned up the async I/O support and extended it to allow single register writes more easily. This is now used where possible for internally generated I/O, providing performance improvements for devices that can do async I/O. - An API for issuing a sequence of register writes as a single operation. Some devices and buses can take advantage of this to do the I/O faster. - Addition of regmap_field APIs which help drivers for devices with repeated IPs or which move registers around between revisions to share helpers. - Support for SPMI buses" * tag 'regmap-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: add SPMI support regmap: debugfs: Fix a boot time crash with early regmap init regmap: irq: clear status when disable irq regmap: Only send a single buffer for async I/O if writing one register regmap: spi: Handle async writes of only one buffer regmap: new API regmap_multi_reg_write() definition regmap: Use async I/O during cache sync regmap: Use async I/O for patch application regmap: Fix regmap_bulk_write single-rw mutex deadlock regmap: Provide asynchronous write and update bits operations regmap: Simplify the initiation of async I/O regmap: Don't generate gather writes for single register raw writes regmap: Cache async work structures regmap: add helper macro to set min/max range of register regmap: Add regmap_fields APIs regmap: add regmap_field_update_bits()
- Loading branch information
Showing
10 changed files
with
560 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Register map access API - SPMI support | ||
* | ||
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. | ||
* | ||
* Based on regmap-i2c.c: | ||
* Copyright 2011 Wolfson Microelectronics plc | ||
* Author: Mark Brown <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 and | ||
* only version 2 as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
*/ | ||
#include <linux/regmap.h> | ||
#include <linux/spmi.h> | ||
#include <linux/module.h> | ||
#include <linux/init.h> | ||
|
||
static int regmap_spmi_read(void *context, | ||
const void *reg, size_t reg_size, | ||
void *val, size_t val_size) | ||
{ | ||
BUG_ON(reg_size != 2); | ||
return spmi_ext_register_readl(context, *(u16 *)reg, | ||
val, val_size); | ||
} | ||
|
||
static int regmap_spmi_gather_write(void *context, | ||
const void *reg, size_t reg_size, | ||
const void *val, size_t val_size) | ||
{ | ||
BUG_ON(reg_size != 2); | ||
return spmi_ext_register_writel(context, *(u16 *)reg, val, val_size); | ||
} | ||
|
||
static int regmap_spmi_write(void *context, const void *data, | ||
size_t count) | ||
{ | ||
BUG_ON(count < 2); | ||
return regmap_spmi_gather_write(context, data, 2, data + 2, count - 2); | ||
} | ||
|
||
static struct regmap_bus regmap_spmi = { | ||
.read = regmap_spmi_read, | ||
.write = regmap_spmi_write, | ||
.gather_write = regmap_spmi_gather_write, | ||
.reg_format_endian_default = REGMAP_ENDIAN_NATIVE, | ||
.val_format_endian_default = REGMAP_ENDIAN_NATIVE, | ||
}; | ||
|
||
/** | ||
* regmap_init_spmi(): Initialize register map | ||
* | ||
* @sdev: Device that will be interacted with | ||
* @config: Configuration for register map | ||
* | ||
* The return value will be an ERR_PTR() on error or a valid pointer to | ||
* a struct regmap. | ||
*/ | ||
struct regmap *regmap_init_spmi(struct spmi_device *sdev, | ||
const struct regmap_config *config) | ||
{ | ||
return regmap_init(&sdev->dev, ®map_spmi, sdev, config); | ||
} | ||
EXPORT_SYMBOL_GPL(regmap_init_spmi); | ||
|
||
/** | ||
* devm_regmap_init_spmi(): Initialise managed register map | ||
* | ||
* @sdev: Device that will be interacted with | ||
* @config: Configuration for register map | ||
* | ||
* The return value will be an ERR_PTR() on error or a valid pointer | ||
* to a struct regmap. The regmap will be automatically freed by the | ||
* device management code. | ||
*/ | ||
struct regmap *devm_regmap_init_spmi(struct spmi_device *sdev, | ||
const struct regmap_config *config) | ||
{ | ||
return devm_regmap_init(&sdev->dev, ®map_spmi, sdev, config); | ||
} | ||
EXPORT_SYMBOL_GPL(devm_regmap_init_spmi); | ||
|
||
MODULE_LICENSE("GPL"); |
Oops, something went wrong.