cregit-Linux how code gets into the kernel

Release 4.14 arch/sparc/kernel/pmc.c

// SPDX-License-Identifier: GPL-2.0
/* pmc - Driver implementation for power management functions
 * of Power Management Controller (PMC) on SPARCstation-Voyager.
 *
 * Copyright (c) 2002 Eric Brower (ebrower@usa.net)
 */

#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/module.h>

#include <asm/io.h>
#include <asm/oplib.h>
#include <linux/uaccess.h>
#include <asm/auxio.h>
#include <asm/processor.h>

/* Debug
 *
 * #define PMC_DEBUG_LED
 * #define PMC_NO_IDLE
 */


#define PMC_OBPNAME	"SUNW,pmc"

#define PMC_DEVNAME	"pmc"


#define PMC_IDLE_REG	0x00

#define PMC_IDLE_ON	0x01


static u8 __iomem *regs;


#define pmc_readb(offs)		(sbus_readb(regs+offs))

#define pmc_writeb(val, offs)	(sbus_writeb(val, regs+offs))

/*
 * CPU idle callback function
 * See .../arch/sparc/kernel/process.c
 */

static void pmc_swift_idle(void) { #ifdef PMC_DEBUG_LED set_auxio(0x00, AUXIO_LED); #endif pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG); #ifdef PMC_DEBUG_LED set_auxio(AUXIO_LED, 0x00); #endif }

Contributors

PersonTokensPropCommitsCommitProp
Eric Brower4397.73%150.00%
Sam Ravnborg12.27%150.00%
Total44100.00%2100.00%


static int pmc_probe(struct platform_device *op) { regs = of_ioremap(&op->resource[0], 0, resource_size(&op->resource[0]), PMC_OBPNAME); if (!regs) { printk(KERN_ERR "%s: unable to map registers\n", PMC_DEVNAME); return -ENODEV; } #ifndef PMC_NO_IDLE /* Assign power management IDLE handler */ sparc_idle = pmc_swift_idle; #endif printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Brower6278.48%120.00%
David S. Miller1417.72%120.00%
Al Viro11.27%120.00%
Grant C. Likely11.27%120.00%
Len Brown11.27%120.00%
Total79100.00%5100.00%

static const struct of_device_id pmc_match[] = { { .name = PMC_OBPNAME, }, {}, }; MODULE_DEVICE_TABLE(of, pmc_match); static struct platform_driver pmc_driver = { .driver = { .name = "pmc", .of_match_table = pmc_match, }, .probe = pmc_probe, };
static int __init pmc_init(void) { return platform_driver_register(&pmc_driver); }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller1593.75%150.00%
Grant C. Likely16.25%150.00%
Total16100.00%2100.00%

/* This driver is not critical to the boot process * and is easiest to ioremap when SBus is already * initialized, so we install ourselves thusly: */ __initcall(pmc_init);

Overall Contributors

PersonTokensPropCommitsCommitProp
Eric Brower17562.95%17.14%
David S. Miller8028.78%214.29%
Grant C. Likely93.24%321.43%
Len Brown41.44%17.14%
Paul Gortmaker31.08%17.14%
Sam Ravnborg20.72%214.29%
Al Viro20.72%17.14%
Arvind Yadav10.36%17.14%
Linus Torvalds10.36%17.14%
Greg Kroah-Hartman10.36%17.14%
Total278100.00%14100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.