arch/arm/mach-sa1100/h3600.c

Source file repositories/reference/linux-study-clean/arch/arm/mach-sa1100/h3600.c

File Facts

System
Linux kernel
Corpus path
arch/arm/mach-sa1100/h3600.c
Extension
.c
Size
2975 bytes
Lines
135
Domain
Architecture Layer
Bucket
arch/arm
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Support for Compaq iPAQ H3600 handheld computer
 *
 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
 */

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>

#include <video/sa1100fb.h>

#include <asm/mach-types.h>
#include <asm/mach/arch.h>

#include <mach/h3xxx.h>
#include <mach/irqs.h>

#include "generic.h"

static bool h3600_lcd_request(void)
{
	static bool h3600_lcd_ok;
	int rc;

	if (h3600_lcd_ok)
		return true;

	rc = gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power");
	if (rc)
		goto out;
	rc = gpio_direction_output(H3XXX_EGPIO_LCD_ON, 0);
	if (rc)
		goto out_free_on;
	rc = gpio_request(H3600_EGPIO_LCD_PCI, "LCD control");
	if (rc)
		goto out_free_on;
	rc = gpio_direction_output(H3600_EGPIO_LCD_PCI, 0);
	if (rc)
		goto out_free_pci;
	rc = gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v");
	if (rc)
		goto out_free_pci;
	rc = gpio_direction_output(H3600_EGPIO_LCD_5V_ON, 0);
	if (rc)
		goto out_free_5v_on;
	rc = gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v");
	if (rc)
		goto out_free_5v_on;
	rc = gpio_direction_output(H3600_EGPIO_LVDD_ON, 0);
	if (rc)
		goto out_free_lvdd_on;

	goto out;

out_free_lvdd_on:
	gpio_free(H3600_EGPIO_LVDD_ON);
out_free_5v_on:
	gpio_free(H3600_EGPIO_LCD_5V_ON);
out_free_pci:
	gpio_free(H3600_EGPIO_LCD_PCI);
out_free_on:
	gpio_free(H3XXX_EGPIO_LCD_ON);
out:
	if (rc)
		pr_err("%s: can't request GPIOs\n", __func__);
	else
		h3600_lcd_ok = true;

	return h3600_lcd_ok;
}

static void h3600_lcd_power(int enable)
{
	if (!h3600_lcd_request())
		return;

	gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
	gpio_direction_output(H3600_EGPIO_LCD_PCI, enable);
	gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable);
	gpio_direction_output(H3600_EGPIO_LVDD_ON, enable);
}

static const struct sa1100fb_rgb h3600_rgb_16 = {
	.red	= { .offset = 12, .length = 4, },
	.green	= { .offset = 7,  .length = 4, },
	.blue	= { .offset = 1,  .length = 4, },
	.transp	= { .offset = 0,  .length = 0, },

Annotation

Implementation Notes