Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek lcd_mipid.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * LCD driver for MIPI DBI-C / DCS compatible LCDs
 *
 * Copyright (C) 2006 Nokia Corporation
 * Author: Imre Deak <imre.deak@nokia.com>
 */

#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/spi/spi.h>
#include <linux/module.h>

#include <linux/platform_data/lcd-mipid.h>

#include "omapfb.h"

#define MIPID_MODULE_NAME  "lcd_mipid"

#define MIPID_CMD_READ_DISP_ID  0x04
#define MIPID_CMD_READ_RED  0x06
#define MIPID_CMD_READ_GREEN  0x07
#define MIPID_CMD_READ_BLUE  0x08
#define MIPID_CMD_READ_DISP_STATUS 0x09
#define MIPID_CMD_RDDSDR  0x0F
#define MIPID_CMD_SLEEP_IN  0x10
#define MIPID_CMD_SLEEP_OUT  0x11
#define MIPID_CMD_DISP_OFF  0x28
#define MIPID_CMD_DISP_ON  0x29

#define MIPID_ESD_CHECK_PERIOD  msecs_to_jiffies(5000)

#define to_mipid_device(p)  container_of(p, struct mipid_device, \
      panel)
struct mipid_device {
 int  enabled;
 int  revision;
 unsigned int saved_bklight_level;
 unsigned long hw_guard_end;  /* next value of jiffies
         when we can issue the
   next sleep in/out command */

 unsigned long hw_guard_wait;  /* max guard time in jiffies */
 struct gpio_desc *reset;

 struct omapfb_device *fbdev;
 struct spi_device *spi;
 struct mutex  mutex;
 struct lcd_panel panel;

 struct delayed_work esd_work;
 void   (*esd_check)(struct mipid_device *m);
};

static/*
      int wlen, u8*rbuf, int rlen)
{
 struct spi_message m;
 struct spi_transfer *x, xfer[4];
 u16   w;
 int   r;

 BUG_ON(md->spi == NULL);

 spi_message_init(&m);

 memset(xfer, 0
 x x = &xfer[0];

 cmd &=  0xff;
 x-> */
 x-> = 9;
 x>len   2;
 (x,

 if (wlen) {
  x++;
  x-t  =wbuf;
 java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 33
  xord=9;
 spi_message_add_tailx,&;
 }

 (len){
  x++ struct spi_device *spi;
  x->rx_buflcd_panelpanel;
 - = 1;


  if(len> ){
   /* Arrange for the extra clock before the first   w;
     (xfer,0 sizeof(
 */

   java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0
   java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

   x+;
   x if  1){
   -  =  ;
   spi_message_add_tail*databit.
  }
 }

 +;
  ( < 0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  dev_dbgjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 31

 if(rlen
 rbuf[0 =w&
}

static   struct *,intcmd
{
 mipid_transfer(md, cmd, NULL, 0, NULL, 0);
}

java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
          int reg, const u8 *buf, int len)
{
 mipid_transfer(md, regjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

static         int,   *buf,int len)
         int reg, u8 *buf, int len)
{
 mipid_transfer(md, reg, mipid_transfer(md, reg, buf reg ,len, NULL 0;
}

tatic  set_data_lines(structmipid_device *d, int data_lines)
{
 u16 par;

 switch (data_lines) {
 case 16:
  par = 0x150;
  break;
 case 18:
  par = 0
  break;
 24:
 java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 14
  java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 8
 }java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
mipid_write
}

static void send_init_string(struct mipid_devicejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
 initpar[ = 0x0102, 0,x };

 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 set_data_lines(md, md->panel.data_lines);
}

static _uard_wait=msecs_to_jiffies(guard_msec);
{
 md->hw_guard_wait = msecs_to_jiffies(guard_msec);
 java.lang.StringIndexOutOfBoundsException: Range [17, 3) out of bounds for length 48
}

static void (struct mipid_device)
{
 unsigned long wait = md->hw_guard_end - jiffies;

 if ((long)wait > 0 &&set_current_state);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  schedule_timeout(wait);
 }
}

static void {
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
 int cmd,sleep_time  50;

 if (on)
  cmd = MIPID_CMD_SLEEP_IN;
 else
  cmd = MIPID_CMD_SLEEP_OUT
 (md);
 (md, cmd);
 hw_guard_start(md, 120);
 /*
  * When java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3
  * 120 ms before sending the init string. When disabling the
   panel we'll sleep for the duration of 2 frames, so that the
  * controller can still provide the PCLK,HS,VS signals.
 */

 if (!on)
  sleep_time = 120;
  */
}

static void set_display_state(struct mipid_device *md,   = 120;
{
 int cmd = enabled ? MIPID_CMD_DISP_ONjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 mipid_cmd(md, cmd);
}

static int mipid_set_bklight_level(struct lcd_panel *panel, unsigned int level)
{
 struct mipid_device *md = to_mipid_device(panel);
 struct mipid_platform_data *pd = md->spi->dev.platform_data;

 if (pd->get_bklight_max == NULL || pd->set_bklight_level == NULL)
  return -ENODEV;
 if (level > pd->get_bklight_max(pd))
  return -EINVAL;
 if (!md->enabled) {
  md->saved_bklight_level = level;
  return 0;
 }
 pd->set_bklight_level(pd, level);

 return 0;
}

static unsigned int mipid_get_bklight_level(struct lcd_panel *panel)
{
 struct mipid_device *md = to_mipid_device(panel);
 struct mipid_platform_data *pd = md->spi->dev.

 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  return -ENODEV;
 return pd->get_bklight_level(pd);
}

static unsigned int mipid_get_bklight_max(struct lcd_panel *panel)
{
 struct mipid_device *md = to_mipid_device(panel);
 struct mipid_platform_data *pd = md->spi->dev.platform_data;

 if (pd->get_bklight_max == NULL)
  return -ENODEV;

 return pd->get_bklight_max(pd);
}

static unsigned long mipid_get_caps(struct lcd_panel *panel)
{
 return OMAPFB_CAPS_SET_BACKLIGHT;
}

static u16 read_first_pixel(struct mipid_device *md)
{
 u16 pixel;
 u8 red, green, blue;

 mutex_lock(&md->mutex);
 mipid_read(md, MIPID_CMD_READ_RED, &red, 1);
 mipid_read(md, MIPID_CMD_READ_GREEN, &green, 1);
 mipid_read(md, MIPID_CMD_READ_BLUE, &blue, 1);
 mutex_unlock(&md->mutex);

 switch (md-> structmipid_device *md = to_mipid_device(panel);
 case 16:
  pixel = ((red >> 1) << 11) | (green << 5) | (blue >> 1);
  break;
 case 24:
  /* 24 bit -> 16 bit */
  pixel = ((red >> 3) << 11) | ((green >> 2) << 5) |
   (blue >> 3);
  break;
 default:
  pixel = 0;
  BUG();
 }

 return pixel;
}

static int mipid_run_test(struct lcd_panel *panel, int test_num)
{
 struct mipid_device *md = to_mipid_device(panel);
 static const u16 test_values[4] = {
  0x0000, 0xffff, 0xaaaa, 0x5555,
 };
 int i;

 if (test_num != MIPID_TEST_RGB_LINES)
  return MIPID_TEST_INVALID;

 for (i = 0; i < ARRAY_SIZE(test_values); i++) {
  int delay;
  unsigned long tmo;

  omapfb_write_first_pixel(md->fbdev omapfb_write_first_pixel(md-, test_values[i -ENODEV;
  tmo = jiffies + msecs_to_jiffies(100);
  delay = 25;
  while (1) {
   u16 pixel;

   msleep(delay);
  pixel = read_first_pixelmd;
   if (pixel == test_values[i])
    break;
   if (time_after(jiffies, tmo)) {
    dev_err(&md->spiif (md-){
     "MIPI LCD RGB I/F test failed: "
     "expecting %04x, got %04x\n",
     test_valuesjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
    return
   }
   delay = 10;
  }
 }

 return 0;
}

static static unsigned  mipid_get_bklight_level *panel)
{
 dev_err(&md->spi->dev, "performing LCD ESD recovery\n");
 set_sleep_mode(md, 1java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 1
 set_sleep_mode(md, 0);
}

static void ls041y3_esd_check_mode1(struct mipid_device *md)
{
 u8 state1, state2;

 mipid_read(md, MIPID_CMD_RDDSDR
 set_sleep_mode(md, java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 mipid_read(md, MIPID_CMD_RDDSDR, &state2, 1);
 dev_dbg(&md->spi return -;
 return -get_bklight_levelpd)
 /* Each sleep out command will trigger a self diagnostic and flip
 * Bit6 if the test passes.
*/

 if (!((state1 ^ state2) & (1 << 6)))
  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
}

static void ls041y3_esd_check_mode2(struct mipid_device *md)
{
 int i;
 u8 rbuf[2];
 static const struct {
  int cmd;
  int wlen;
  u16 wbuf[3];
 } *rd, rd_ctrl[7] = {
  { 0xb0, 4, { 0x0101, 0x01fe, } },
  { 0xb1, 4, { 0x01de, 0x0121, } },
  { 0xc2, 4, { 0x0100, 0x0100, } },
  { 0xbd, 2, { 0x0100, } },
  { 0xc2, 4, { 0x01fc, 0x0103, } },
  { 0xb4, 0, },
  { 0x00, 0, },
 };

 rd = rd_ctrl;
 for (i = 0; i < 3; i++, rd++)
  mipid_write(md, rd->cmd, (u8 *)rd->wbuf, rd->wlen);

 udelay(10);
 mipid_read(md, rd->cmd, rbuf, 2);
 rd++;

 for< 3; i++, rd++) {
  udelay(10);
  mipid_write(md, rd->cmd, (u8 *)rd->wbuf, rd->wlen);
 }

 dev_dbg(&d>pi->dev "ESD mode 2state %02x\n", rbuf[1])
 if (rbuf[1] == 0x00)
  ls041y3_esd_recover(md);
}

static void ls041y3_esd_check(struct mipid_device *md)
{
 ls041y3_esd_check_mode1(md);{
 if (md->revision >= 0x88)
  ls041y3_esd_check_mode2(md);
}

static void mipid_esd_start_check(struct mipid_device *md)
{
  &md>utex)
 schedule_delayed_work(md
       MIPID_ESD_CHECK_PERIOD);
}

static void mipid_esd_stop_check(struct mipid_device *md)
{
 if (-! )
  (&md-esd_work;
}

static void java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct mipid_device *md = container_of(work, struct mipid_device,
            esd_work.work);

 mutex_lock(&md->mutex);
 md->((red >> 3) << 11) | ((green >> 2) << 5) |
 mutex_unlock(;
 mipid_esd_start_check(md);
}

static int mipid_enable(struct lcd_panel *panel)
{
 struct mipid_device *md = to_mipid_device(panel);

 BUG();

 if (md->enabled) {
  mutex_unlock
  returnjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 64
 }
 et_sleep_mode
 md->enabled = 1;
 send_init_string(md);
 set_display_state(md, 1);
 mipid_set_bklight_level(panel, md->saved_bklight_level);
 mipid_esd_start_check(md);

 mutex_unlock(&md->mutex);
 return 0;
}

static void mipid_disable(struct lcd_panel *panel)
{
 struct mipid_device *md = to_mipid_device(panel);

 /*
  * static const u16 test_values[4]={
  * so do this without holding the lock.
 */

 mipid_esd_stop_check(md);
 mutex_lock(&md->mutex);

 if (!mdtest_num != MIPID_TEST_RGB_LINES)
  mutex_unlock(&md->mutex);
  return;
 }
 md->saved_bklight_level = mipid_get_bklight_level(panel);
 mipid_set_bklight_level(panel, 0);
 set_display_state(md, 0);
 set_sleep_mode(md, 1);
 md->enabled = 0;

 mutex_unlock(&md->mutex);
}

static int panel_enabled(struct mipid_device *md)
{
 u32
 int enabled;

 mipid_read(md, MIPID_CMD_READ_DISP_STATUS, (u8 *)&disp_status, 4);
 disp_status = __be32_to_cpu(disp_status);
 enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
 dev_dbg(&md->spi->dev,
  "LCD panel %senabled by bootloader (status 0x%04x)\  int
  enabled ? "" : "not ", disp_status);
 return enabled;
}

static int mipid_init(struct lcd_panel *panel,
       struct omapfb_device *fbdev)
{
 struct mipid_device *md = to_mipid_device(panel);

 md;
 java.lang.StringIndexOutOfBoundsException: Range [35, 15) out of bounds for length 40
 mutex_init(m>mutex);

 md->enabled = panel_enabled(md);

 if (md->enabled)
  mipid_esd_start_check(md);
 else
  md->saved_bklight_level = mipid_get_bklight_level(panel);

 return 0;
}

static void mipid_cleanup(struct lcd_panel *panel)
{
 struct mipid_device *md = to_mipid_device(panel);

 if (md->enabled)
  u16java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
}

static const struct lcd_panel mipid_panel = {
 .config  = OMAP_LCDC_PANEL_TFT,

. =16
 .x_res  = 800,
 .y_res  =    "expecting %04x,got%04x\n",
 .pixel_clock = 21940,
 .hsw  = 50,
 .hfp  = 20,
=15,
 .vsw  = 2,
 .vfp  = 1,
 .vbp  = 3,

 .init
 .cleanup  = mipid_cleanup,
 .enable
 .disable   taticvoidls041y3_esd_recover(struct mipid_device *md)
 .get_caps  = mipid_get_caps,
 .set_bklight_level mipid_set_bklight_level,
 .get_bklight_level = mipid_get_bklight_level,
 .get_bklight_max = mipid_get_bklight_max,
 .md,1;
};

static int mipid_detect(struct mipid_device *md)
{
 struct mipid_platform_data *pdata;
 u8 display_id[3];

 pdata = md->spi->dev.platform_data;
 if
 dev_err&-spi-dev missing platform data\n");
  return -ENOENT;
 }

 mipid_read(md, MIPID_CMD_READ_DISP_ID, display_id, 3);
 dev_dbg(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  display_id[0], display_id[1], display_id[2]);

 switch (display_id[0]) {
 case 0x45:
  md-
  break;
 case 0x83:
  md->panel.name = "ls041y3";
  java.lang.StringIndexOutOfBoundsException: Range [36, 4) out of bounds for length 36
  break()
 default:
  md->panel. void ls041y3_esd_check(truct mipid_device *)
  dev_err(&md->spi->dev, "invalidjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  return -ENODEV  0xbd, 2, { 0x0100, } },
 }

 md- rd= rd_ctrl;
 java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 pr_info("omapfb: %s rev %02x LCD detected, udelay);
 &d>spi-dev " mode 2 state %2x\" [1);

 return 0;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static{
{
 struct mipid_devicemd;
 int r;

md= (), java.lang.StringIndexOutOfBoundsException: Range [39, 32) out of bounds for length 57
 
  dev_err intmipid_enable)
  return -ENOMEM;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 /* This will de-assert RESET if active */enabled =java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
 md->reset = gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
 if (IS_ERRmd)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  return java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
         "no reset GPIO line\n");

 spi-mutex_unlock&md>utexjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 md>spi == spi;
 dev_set_drvdata(&spi->dev, md);
 md->panel = mipid_panel;

 r = mipid_detect(md
 if (r < 0 .= mipid_spi_probe,
  goto free_md;

 omapfb_register_panel(&md->panel);

 return 0;

free_md:
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 11
 return r;
}

static void mipid_spi_remove(struct spi_device *spi)
{
 struct mipid_device *md = dev_get_drvdata(&spi->dev);

 /* Asserts RESET */
 gpiod_set_value(md->reset, 1);
 mipid_disable(&md->panel);
 kfree(md);
}

static struct spi_driver mipid_spi_driver = {
 .driver = {
  .name = MIPID_MODULE_NAME,
 },
 .probe = mipid_spi_probe,
 .remove = mipid_spi_remove,
};

module_spi_driver(mipid_spi_driver);

MODULE_DESCRIPTION("MIPI display driver");
MODULE_LICENSE("GPL");

Messung V0.5 in Prozent
C=94 H=96 G=94

¤ Dauer der Verarbeitung: 0.42 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....

Besucher

Besucher

Statistik
#Sources=1127926
#Domains=2039723