mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
Merge branches 'ib-mfd-iio-input-4.20', 'ib-mfd-irqchip-4.20', 'ib-mfd-rtc-4.20' and 'ib-mfd-spi-tty-4.20-1' into ibs-for-mfd-merged
This commit is contained in:
commit
92af5c130c
13 changed files with 618 additions and 21 deletions
|
|
@ -99,6 +99,15 @@ config MFD_AAT2870_CORE
|
|||
additional drivers must be enabled in order to use the
|
||||
functionality of the device.
|
||||
|
||||
config MFD_AT91_USART
|
||||
tristate "AT91 USART Driver"
|
||||
select MFD_CORE
|
||||
help
|
||||
Select this to get support for AT91 USART IP. This is a wrapper
|
||||
over at91-usart-serial driver and usart-spi-driver. Only one function
|
||||
can be used at a time. The choice is done at boot time by the probe
|
||||
function of this MFD driver according to a device tree property.
|
||||
|
||||
config MFD_ATMEL_FLEXCOM
|
||||
tristate "Atmel Flexcom (Flexible Serial Communication Unit)"
|
||||
select MFD_CORE
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o
|
|||
obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
|
||||
obj-$(CONFIG_MFD_TPS65090) += tps65090.o
|
||||
obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
|
||||
obj-$(CONFIG_MFD_AT91_USART) += at91-usart.o
|
||||
obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o
|
||||
obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o
|
||||
obj-$(CONFIG_MFD_ATMEL_SMC) += atmel-smc.o
|
||||
|
|
|
|||
72
drivers/mfd/at91-usart.c
Normal file
72
drivers/mfd/at91-usart.c
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Driver for AT91 USART
|
||||
*
|
||||
* Copyright (C) 2018 Microchip Technology
|
||||
*
|
||||
* Author: Radu Pirea <radu.pirea@microchip.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <dt-bindings/mfd/at91-usart.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/property.h>
|
||||
|
||||
static struct mfd_cell at91_usart_spi_subdev = {
|
||||
.name = "at91_usart_spi",
|
||||
.of_compatible = "microchip,at91sam9g45-usart-spi",
|
||||
};
|
||||
|
||||
static struct mfd_cell at91_usart_serial_subdev = {
|
||||
.name = "atmel_usart_serial",
|
||||
.of_compatible = "atmel,at91rm9200-usart-serial",
|
||||
};
|
||||
|
||||
static int at91_usart_mode_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct mfd_cell cell;
|
||||
u32 opmode = AT91_USART_MODE_SERIAL;
|
||||
|
||||
device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode);
|
||||
|
||||
switch (opmode) {
|
||||
case AT91_USART_MODE_SPI:
|
||||
cell = at91_usart_spi_subdev;
|
||||
break;
|
||||
case AT91_USART_MODE_SERIAL:
|
||||
cell = at91_usart_serial_subdev;
|
||||
break;
|
||||
default:
|
||||
dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n",
|
||||
opmode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1,
|
||||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static const struct of_device_id at91_usart_mode_of_match[] = {
|
||||
{ .compatible = "atmel,at91rm9200-usart" },
|
||||
{ .compatible = "atmel,at91sam9260-usart" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, at91_usart_mode_of_match);
|
||||
|
||||
static struct platform_driver at91_usart_mfd = {
|
||||
.probe = at91_usart_mode_probe,
|
||||
.driver = {
|
||||
.name = "at91_usart_mode",
|
||||
.of_match_table = at91_usart_mode_of_match,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(at91_usart_mfd);
|
||||
|
||||
MODULE_AUTHOR("Radu Pirea <[email protected]>");
|
||||
MODULE_DESCRIPTION("AT91 USART MFD driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
@ -1094,6 +1094,7 @@ static void menelaus_rtc_alarm_work(struct menelaus_chip *m)
|
|||
static inline void menelaus_rtc_init(struct menelaus_chip *m)
|
||||
{
|
||||
int alarm = (m->client->irq > 0);
|
||||
int err;
|
||||
|
||||
/* assume 32KDETEN pin is pulled high */
|
||||
if (!(menelaus_read_reg(MENELAUS_OSC_CTRL) & 0x80)) {
|
||||
|
|
@ -1101,6 +1102,12 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m)
|
|||
return;
|
||||
}
|
||||
|
||||
m->rtc = devm_rtc_allocate_device(&m->client->dev);
|
||||
if (IS_ERR(m->rtc))
|
||||
return;
|
||||
|
||||
m->rtc->ops = &menelaus_rtc_ops;
|
||||
|
||||
/* support RTC alarm; it can issue wakeups */
|
||||
if (alarm) {
|
||||
if (menelaus_add_irq_work(MENELAUS_RTCALM_IRQ,
|
||||
|
|
@ -1125,10 +1132,8 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m)
|
|||
menelaus_write_reg(MENELAUS_RTC_CTRL, m->rtc_control);
|
||||
}
|
||||
|
||||
m->rtc = rtc_device_register(DRIVER_NAME,
|
||||
&m->client->dev,
|
||||
&menelaus_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(m->rtc)) {
|
||||
err = rtc_register_device(m->rtc);
|
||||
if (err) {
|
||||
if (alarm) {
|
||||
menelaus_remove_irq_work(MENELAUS_RTCALM_IRQ);
|
||||
device_init_wakeup(&m->client->dev, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue