mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 10:04:12 +08:00
d5acba26bf
Here is the bit set of char/misc drivers for 4.19-rc1 There is a lot here, much more than normal, seems like everyone is writing new driver subsystems these days... Anyway, major things here are: - new FSI driver subsystem, yet-another-powerpc low-level hardware bus - gnss, finally an in-kernel GPS subsystem to try to tame all of the crazy out-of-tree drivers that have been floating around for years, combined with some really hacky userspace implementations. This is only for GNSS receivers, but you have to start somewhere, and this is great to see. Other than that, there are new slimbus drivers, new coresight drivers, new fpga drivers, and loads of DT bindings for all of these and existing drivers. Full details of everything is in the shortlog. All of these have been in linux-next for a while with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCW3g7ew8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ykfBgCeOG0RkSI92XVZe0hs/QYFW9kk8JYAnRBf3Qpm cvW7a+McOoKz/MGmEKsi =TNfn -----END PGP SIGNATURE----- Merge tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver updates from Greg KH: "Here is the bit set of char/misc drivers for 4.19-rc1 There is a lot here, much more than normal, seems like everyone is writing new driver subsystems these days... Anyway, major things here are: - new FSI driver subsystem, yet-another-powerpc low-level hardware bus - gnss, finally an in-kernel GPS subsystem to try to tame all of the crazy out-of-tree drivers that have been floating around for years, combined with some really hacky userspace implementations. This is only for GNSS receivers, but you have to start somewhere, and this is great to see. Other than that, there are new slimbus drivers, new coresight drivers, new fpga drivers, and loads of DT bindings for all of these and existing drivers. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (255 commits) android: binder: Rate-limit debug and userspace triggered err msgs fsi: sbefifo: Bump max command length fsi: scom: Fix NULL dereference misc: mic: SCIF Fix scif_get_new_port() error handling misc: cxl: changed asterisk position genwqe: card_base: Use true and false for boolean values misc: eeprom: assignment outside the if statement uio: potential double frees if __uio_register_device() fails eeprom: idt_89hpesx: clean up an error pointer vs NULL inconsistency misc: ti-st: Fix memory leak in the error path of probe() android: binder: Show extra_buffers_size in trace firmware: vpd: Fix section enabled flag on vpd_section_destroy platform: goldfish: Retire pdev_bus goldfish: Use dedicated macros instead of manual bit shifting goldfish: Add missing includes to goldfish.h mux: adgs1408: new driver for Analog Devices ADGS1408/1409 mux dt-bindings: mux: add adi,adgs1408 Drivers: hv: vmbus: Cleanup synic memory free path Drivers: hv: vmbus: Remove use of slow_virt_to_phys() Drivers: hv: vmbus: Reset the channel callback in vmbus_onoffer_rescind() ...
186 lines
4.2 KiB
C
186 lines
4.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* rcar-fcp.c -- R-Car Frame Compression Processor Driver
|
|
*
|
|
* Copyright (C) 2016 Renesas Electronics Corporation
|
|
*
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/list.h>
|
|
#include <linux/module.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/pm_runtime.h>
|
|
#include <linux/slab.h>
|
|
|
|
#include <media/rcar-fcp.h>
|
|
|
|
struct rcar_fcp_device {
|
|
struct list_head list;
|
|
struct device *dev;
|
|
};
|
|
|
|
static LIST_HEAD(fcp_devices);
|
|
static DEFINE_MUTEX(fcp_lock);
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* Public API
|
|
*/
|
|
|
|
/**
|
|
* rcar_fcp_get - Find and acquire a reference to an FCP instance
|
|
* @np: Device node of the FCP instance
|
|
*
|
|
* Search the list of registered FCP instances for the instance corresponding to
|
|
* the given device node.
|
|
*
|
|
* Return a pointer to the FCP instance, or an ERR_PTR if the instance can't be
|
|
* found.
|
|
*/
|
|
struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np)
|
|
{
|
|
struct rcar_fcp_device *fcp;
|
|
|
|
mutex_lock(&fcp_lock);
|
|
|
|
list_for_each_entry(fcp, &fcp_devices, list) {
|
|
if (fcp->dev->of_node != np)
|
|
continue;
|
|
|
|
get_device(fcp->dev);
|
|
goto done;
|
|
}
|
|
|
|
fcp = ERR_PTR(-EPROBE_DEFER);
|
|
|
|
done:
|
|
mutex_unlock(&fcp_lock);
|
|
return fcp;
|
|
}
|
|
EXPORT_SYMBOL_GPL(rcar_fcp_get);
|
|
|
|
/**
|
|
* rcar_fcp_put - Release a reference to an FCP instance
|
|
* @fcp: The FCP instance
|
|
*
|
|
* Release the FCP instance acquired by a call to rcar_fcp_get().
|
|
*/
|
|
void rcar_fcp_put(struct rcar_fcp_device *fcp)
|
|
{
|
|
if (fcp)
|
|
put_device(fcp->dev);
|
|
}
|
|
EXPORT_SYMBOL_GPL(rcar_fcp_put);
|
|
|
|
struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
|
|
{
|
|
return fcp->dev;
|
|
}
|
|
EXPORT_SYMBOL_GPL(rcar_fcp_get_device);
|
|
|
|
/**
|
|
* rcar_fcp_enable - Enable an FCP
|
|
* @fcp: The FCP instance
|
|
*
|
|
* Before any memory access through an FCP is performed by a module, the FCP
|
|
* must be enabled by a call to this function. The enable calls are reference
|
|
* counted, each successful call must be followed by one rcar_fcp_disable()
|
|
* call when no more memory transfer can occur through the FCP.
|
|
*
|
|
* Return 0 on success or a negative error code if an error occurs. The enable
|
|
* reference count isn't increased when this function returns an error.
|
|
*/
|
|
int rcar_fcp_enable(struct rcar_fcp_device *fcp)
|
|
{
|
|
int ret;
|
|
|
|
if (!fcp)
|
|
return 0;
|
|
|
|
ret = pm_runtime_get_sync(fcp->dev);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(rcar_fcp_enable);
|
|
|
|
/**
|
|
* rcar_fcp_disable - Disable an FCP
|
|
* @fcp: The FCP instance
|
|
*
|
|
* This function is the counterpart of rcar_fcp_enable(). As enable calls are
|
|
* reference counted a disable call may not disable the FCP synchronously.
|
|
*/
|
|
void rcar_fcp_disable(struct rcar_fcp_device *fcp)
|
|
{
|
|
if (fcp)
|
|
pm_runtime_put(fcp->dev);
|
|
}
|
|
EXPORT_SYMBOL_GPL(rcar_fcp_disable);
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* Platform Driver
|
|
*/
|
|
|
|
static int rcar_fcp_probe(struct platform_device *pdev)
|
|
{
|
|
struct rcar_fcp_device *fcp;
|
|
|
|
fcp = devm_kzalloc(&pdev->dev, sizeof(*fcp), GFP_KERNEL);
|
|
if (fcp == NULL)
|
|
return -ENOMEM;
|
|
|
|
fcp->dev = &pdev->dev;
|
|
|
|
pm_runtime_enable(&pdev->dev);
|
|
|
|
mutex_lock(&fcp_lock);
|
|
list_add_tail(&fcp->list, &fcp_devices);
|
|
mutex_unlock(&fcp_lock);
|
|
|
|
platform_set_drvdata(pdev, fcp);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int rcar_fcp_remove(struct platform_device *pdev)
|
|
{
|
|
struct rcar_fcp_device *fcp = platform_get_drvdata(pdev);
|
|
|
|
mutex_lock(&fcp_lock);
|
|
list_del(&fcp->list);
|
|
mutex_unlock(&fcp_lock);
|
|
|
|
pm_runtime_disable(&pdev->dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id rcar_fcp_of_match[] = {
|
|
{ .compatible = "renesas,fcpf" },
|
|
{ .compatible = "renesas,fcpv" },
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(of, rcar_fcp_of_match);
|
|
|
|
static struct platform_driver rcar_fcp_platform_driver = {
|
|
.probe = rcar_fcp_probe,
|
|
.remove = rcar_fcp_remove,
|
|
.driver = {
|
|
.name = "rcar-fcp",
|
|
.of_match_table = rcar_fcp_of_match,
|
|
.suppress_bind_attrs = true,
|
|
},
|
|
};
|
|
|
|
module_platform_driver(rcar_fcp_platform_driver);
|
|
|
|
MODULE_ALIAS("rcar-fcp");
|
|
MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
|
|
MODULE_DESCRIPTION("Renesas FCP Driver");
|
|
MODULE_LICENSE("GPL");
|