Ejemplo n.º 1
0
static int lms283gf05_power_set(struct lcd_device *ld, int power)
{
	struct lms283gf05_state *st = lcd_get_data(ld);
	struct spi_device *spi = st->spi;
	struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);

	if (power <= FB_BLANK_NORMAL) {
		if (pdata)
			lms283gf05_reset(pdata->reset_gpio,
					pdata->reset_inverted);
		lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));
	} else {
		lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq));
		if (pdata)
			gpio_set_value(pdata->reset_gpio,
					pdata->reset_inverted);
	}

	return 0;
}
Ejemplo n.º 2
0
static int __devinit lms283gf05_probe(struct spi_device *spi)
{
    struct lms283gf05_state *st;
    struct lms283gf05_pdata *pdata = spi->dev.platform_data;
    struct lcd_device *ld;
    int ret = 0;

    if (pdata != NULL) {
        ret = gpio_request(pdata->reset_gpio, "LMS285GF05 RESET");
        if (ret)
            return ret;

        ret = gpio_direction_output(pdata->reset_gpio,
                                    !pdata->reset_inverted);
        if (ret)
            goto err;
    }

    st = kzalloc(sizeof(struct lms283gf05_state), GFP_KERNEL);
    if (st == NULL) {
        dev_err(&spi->dev, "No memory for device state\n");
        ret = -ENOMEM;
        goto err;
    }

    ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
    if (IS_ERR(ld)) {
        ret = PTR_ERR(ld);
        goto err2;
    }

    st->spi = spi;
    st->ld = ld;

    dev_set_drvdata(&spi->dev, st);

    /* kick in the LCD */
    if (pdata)
        lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted);
    lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));

    return 0;

err2:
    kfree(st);
err:
    if (pdata != NULL)
        gpio_free(pdata->reset_gpio);

    return ret;
}
Ejemplo n.º 3
0
static int lms283gf05_probe(struct spi_device *spi)
{
	struct lms283gf05_state *st;
	struct lms283gf05_pdata *pdata = spi->dev.platform_data;
	struct lcd_device *ld;
	int ret = 0;

	if (pdata != NULL) {
		ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
				GPIOF_DIR_OUT | (!pdata->reset_inverted ?
				GPIOF_INIT_HIGH : GPIOF_INIT_LOW),
				"LMS285GF05 RESET");
		if (ret)
			return ret;
	}

	st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
				GFP_KERNEL);
	if (st == NULL) {
		dev_err(&spi->dev, "No memory for device state\n");
		return -ENOMEM;
	}

	ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
	if (IS_ERR(ld))
		return PTR_ERR(ld);

	st->spi = spi;
	st->ld = ld;

	dev_set_drvdata(&spi->dev, st);

	/* kick in the LCD */
	if (pdata)
		lms283gf05_reset(pdata->reset_gpio, pdata->reset_inverted);
	lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq));

	return 0;
}