drivers/staging/sm750fb/sm750_hw.c

Source file repositories/reference/linux-study-clean/drivers/staging/sm750fb/sm750_hw.c

File Facts

System
Linux kernel
Corpus path
drivers/staging/sm750fb/sm750_hw.c
Extension
.c
Size
13612 bytes
Lines
551
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (sm750_dev->nocrt) {
			poke32(MISC_CTRL,
			       peek32(MISC_CTRL) | MISC_CTRL_DAC_POWER_OFF);
			/* shut off dpms */
			val = peek32(SYSTEM_CTRL) & ~SYSTEM_CTRL_DPMS_MASK;
			val |= SYSTEM_CTRL_DPMS_VPHN;
			poke32(SYSTEM_CTRL, val);
		} else {
			poke32(MISC_CTRL,
			       peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF);
			/* turn on dpms */
			val = peek32(SYSTEM_CTRL) & ~SYSTEM_CTRL_DPMS_MASK;
			val |= SYSTEM_CTRL_DPMS_VPHP;
			poke32(SYSTEM_CTRL, val);
		}

		val = peek32(PANEL_DISPLAY_CTRL) &
		      ~(PANEL_DISPLAY_CTRL_DUAL_DISPLAY |
			PANEL_DISPLAY_CTRL_DOUBLE_PIXEL);
		switch (sm750_dev->pnltype) {
		case sm750_24TFT:
			break;
		case sm750_doubleTFT:
			val |= PANEL_DISPLAY_CTRL_DOUBLE_PIXEL;
			break;
		case sm750_dualTFT:
			val |= PANEL_DISPLAY_CTRL_DUAL_DISPLAY;
			break;
		}
		poke32(PANEL_DISPLAY_CTRL, val);
	} else {
		/*
		 * for 750LE, no DVI chip initialization
		 * makes Monitor no signal
		 *
		 * Set up GPIO for software I2C to program DVI chip in the
		 * Xilinx SP605 board, in order to have video signal.
		 */
		sm750_sw_i2c_init(0, 1);

		/*
		 * Customer may NOT use CH7301 DVI chip, which has to be
		 * initialized differently.
		 */
		if (sm750_sw_i2c_read_reg(0xec, 0x4a) == 0x95) {
			/*
			 * The following register values for CH7301 are from
			 * Chrontel app note and our experiment.
			 */
			sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
			sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
			sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
		}
	}

	/* init 2d engine */
	if (!sm750_dev->accel_off)
		hw_sm750_init_accel(sm750_dev);

	return 0;
}

int hw_sm750_output_set_mode(struct lynxfb_output *output,
			     struct fb_var_screeninfo *var,
			     struct fb_fix_screeninfo *fix)
{
	int ret;
	enum disp_output disp_set;
	int channel;

	ret = 0;
	disp_set = 0;
	channel = *output->channel;

	if (sm750_get_chip_type() != SM750LE) {
		if (channel == sm750_primary) {
			if (output->paths & sm750_panel)
				disp_set |= do_LCD1_PRI;
			if (output->paths & sm750_crt)
				disp_set |= do_CRT_PRI;

		} else {
			if (output->paths & sm750_panel)
				disp_set |= do_LCD1_SEC;
			if (output->paths & sm750_crt)
				disp_set |= do_CRT_SEC;
		}
		ddk750_set_logical_disp_out(disp_set);
	} else {
		/* just open DISPLAY_CONTROL_750LE register bit 3:0 */

Annotation

Implementation Notes