mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
02e2af20f4
Here is the big set of char/misc and other small driver subsystem updates for 5.18-rc1. Included in here are merges from driver subsystems which contain: - iio driver updates and new drivers - fsi driver updates - fpga driver updates - habanalabs driver updates and support for new hardware - soundwire driver updates and new drivers - phy driver updates and new drivers - coresight driver updates - icc driver updates Individual changes include: - mei driver updates - interconnect driver updates - new PECI driver subsystem added - vmci driver updates - lots of tiny misc/char driver updates There will be two merge conflicts with your tree, one in MAINTAINERS which is obvious to fix up, and one in drivers/phy/freescale/Kconfig which also should be easy to resolve. All of these have been in linux-next for a while with no reported problems. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYkG3fQ8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ykNEgCfaRG8CRxewDXOO4+GSeA3NGK+AIoAnR89donC R4bgCjfg8BWIBcVVXg3/ =WWXC -----END PGP SIGNATURE----- Merge tag 'char-misc-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc and other driver updates from Greg KH: "Here is the big set of char/misc and other small driver subsystem updates for 5.18-rc1. Included in here are merges from driver subsystems which contain: - iio driver updates and new drivers - fsi driver updates - fpga driver updates - habanalabs driver updates and support for new hardware - soundwire driver updates and new drivers - phy driver updates and new drivers - coresight driver updates - icc driver updates Individual changes include: - mei driver updates - interconnect driver updates - new PECI driver subsystem added - vmci driver updates - lots of tiny misc/char driver updates All of these have been in linux-next for a while with no reported problems" * tag 'char-misc-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (556 commits) firmware: google: Properly state IOMEM dependency kgdbts: fix return value of __setup handler firmware: sysfb: fix platform-device leak in error path firmware: stratix10-svc: add missing callback parameter on RSU arm64: dts: qcom: add non-secure domain property to fastrpc nodes misc: fastrpc: Add dma handle implementation misc: fastrpc: Add fdlist implementation misc: fastrpc: Add helper function to get list and page misc: fastrpc: Add support to secure memory map dt-bindings: misc: add fastrpc domain vmid property misc: fastrpc: check before loading process to the DSP misc: fastrpc: add secure domain support dt-bindings: misc: add property to support non-secure DSP misc: fastrpc: Add support to get DSP capabilities misc: fastrpc: add support for FASTRPC_IOCTL_MEM_MAP/UNMAP misc: fastrpc: separate fastrpc device from channel context dt-bindings: nvmem: brcm,nvram: add basic NVMEM cells dt-bindings: nvmem: make "reg" property optional nvmem: brcm_nvram: parse NVRAM content into NVMEM cells nvmem: dt-bindings: Fix the error of dt-bindings check ...
139 lines
3.1 KiB
C
139 lines
3.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* AD5672R, AD5674R, AD5676, AD5676R, AD5679R,
|
|
* AD5681R, AD5682R, AD5683, AD5683R, AD5684,
|
|
* AD5684R, AD5685R, AD5686, AD5686R
|
|
* Digital to analog converters driver
|
|
*
|
|
* Copyright 2018 Analog Devices Inc.
|
|
*/
|
|
|
|
#include "ad5686.h"
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
static int ad5686_spi_write(struct ad5686_state *st,
|
|
u8 cmd, u8 addr, u16 val)
|
|
{
|
|
struct spi_device *spi = to_spi_device(st->dev);
|
|
u8 tx_len, *buf;
|
|
|
|
switch (st->chip_info->regmap_type) {
|
|
case AD5310_REGMAP:
|
|
st->data[0].d16 = cpu_to_be16(AD5310_CMD(cmd) |
|
|
val);
|
|
buf = &st->data[0].d8[0];
|
|
tx_len = 2;
|
|
break;
|
|
case AD5683_REGMAP:
|
|
st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
|
|
AD5683_DATA(val));
|
|
buf = &st->data[0].d8[1];
|
|
tx_len = 3;
|
|
break;
|
|
case AD5686_REGMAP:
|
|
st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
|
|
AD5686_ADDR(addr) |
|
|
val);
|
|
buf = &st->data[0].d8[1];
|
|
tx_len = 3;
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
return spi_write(spi, buf, tx_len);
|
|
}
|
|
|
|
static int ad5686_spi_read(struct ad5686_state *st, u8 addr)
|
|
{
|
|
struct spi_transfer t[] = {
|
|
{
|
|
.tx_buf = &st->data[0].d8[1],
|
|
.len = 3,
|
|
.cs_change = 1,
|
|
}, {
|
|
.tx_buf = &st->data[1].d8[1],
|
|
.rx_buf = &st->data[2].d8[1],
|
|
.len = 3,
|
|
},
|
|
};
|
|
struct spi_device *spi = to_spi_device(st->dev);
|
|
u8 cmd = 0;
|
|
int ret;
|
|
|
|
switch (st->chip_info->regmap_type) {
|
|
case AD5310_REGMAP:
|
|
return -ENOTSUPP;
|
|
case AD5683_REGMAP:
|
|
cmd = AD5686_CMD_READBACK_ENABLE_V2;
|
|
break;
|
|
case AD5686_REGMAP:
|
|
cmd = AD5686_CMD_READBACK_ENABLE;
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
|
|
AD5686_ADDR(addr));
|
|
st->data[1].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_NOOP));
|
|
|
|
ret = spi_sync_transfer(spi, t, ARRAY_SIZE(t));
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return be32_to_cpu(st->data[2].d32);
|
|
}
|
|
|
|
static int ad5686_spi_probe(struct spi_device *spi)
|
|
{
|
|
const struct spi_device_id *id = spi_get_device_id(spi);
|
|
|
|
return ad5686_probe(&spi->dev, id->driver_data, id->name,
|
|
ad5686_spi_write, ad5686_spi_read);
|
|
}
|
|
|
|
static void ad5686_spi_remove(struct spi_device *spi)
|
|
{
|
|
ad5686_remove(&spi->dev);
|
|
}
|
|
|
|
static const struct spi_device_id ad5686_spi_id[] = {
|
|
{"ad5310r", ID_AD5310R},
|
|
{"ad5672r", ID_AD5672R},
|
|
{"ad5674r", ID_AD5674R},
|
|
{"ad5676", ID_AD5676},
|
|
{"ad5676r", ID_AD5676R},
|
|
{"ad5679r", ID_AD5679R},
|
|
{"ad5681r", ID_AD5681R},
|
|
{"ad5682r", ID_AD5682R},
|
|
{"ad5683", ID_AD5683},
|
|
{"ad5683r", ID_AD5683R},
|
|
{"ad5684", ID_AD5684},
|
|
{"ad5684r", ID_AD5684R},
|
|
{"ad5685", ID_AD5685R}, /* Does not exist */
|
|
{"ad5685r", ID_AD5685R},
|
|
{"ad5686", ID_AD5686},
|
|
{"ad5686r", ID_AD5686R},
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, ad5686_spi_id);
|
|
|
|
static struct spi_driver ad5686_spi_driver = {
|
|
.driver = {
|
|
.name = "ad5686",
|
|
},
|
|
.probe = ad5686_spi_probe,
|
|
.remove = ad5686_spi_remove,
|
|
.id_table = ad5686_spi_id,
|
|
};
|
|
|
|
module_spi_driver(ad5686_spi_driver);
|
|
|
|
MODULE_AUTHOR("Stefan Popa <stefan.popa@analog.com>");
|
|
MODULE_DESCRIPTION("Analog Devices AD5686 and similar multi-channel DACs");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_IMPORT_NS(IIO_AD5686);
|