atmel_lcdfb_setcolreg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ atmel_lcdfb_setcolreg(9) ✨

okay so bestie, we're in the Kernel API Manual today and the function we're stanning is atmel_lcdfb_setcolreg πŸ’… it's a kernel function, it lives in the framebuffer world, and it has one (1) job: setting a color register. that's it. that's the whole gig. let me walk you through it 🫢


🌸 NAME 🌸

atmel_lcdfb_setcolreg β€” it's an optional function, and what it does is set a color register ✨ lowkey iconic of it.


πŸŽ€ SYNOPSIS πŸŽ€

int atmel_lcdfb_setcolreg (unsigned int regno , unsigned int red ,
       unsigned int green , unsigned int blue , unsigned int transp ,
       struct fb_info *info );

like, look at that signature. it ate. five unsigned ints and one struct fb_info * and it returns an int πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • regno β€” which register in the CLUT we're programming. yes bestie, that CLUT πŸ‘€
  • red β€” the red value, and it can be up to 16 bits wide 🌹
  • green β€” the green value, also up to 16 bits wide 🌿
  • blue β€” the blue value, up to 16 bits wide too 🫐 (the original literally puts a period on this one's description, so respect the period πŸŽ€)
  • transp β€” if it's supported, this is the alpha value, and yep, it can be up to 16 bits wide too 🫧
  • info β€” the frame buffer info structure, the main character of the whole story πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

so what are we actually doing here? we're setting a single color register πŸ”₯ the values you hand in have a 16 bit magnitude, and that magnitude needs to be scaled inside this function for the hardware. so like, do the math, bestie β€” the hardware doesn't speak raw 16-bit, you have to translate 🧚

things to take into consideration (and there are several, ngl):

  • how many color registers are supported, if any, with the current color visual πŸ‘€
  • with truecolor mode, no color palettes are supported, periodt. here a pseudo palette gets created, and we store the value in pseudo_palette in struct fb_info πŸ’«
  • for pseudocolor mode we have a limited color palette, and to deal with that we can program what color is displayed for a particular pixel value 🎨
  • DirectColor is similar in that we can program each color field 🌈
  • if we have a static colormap, we don't need to implement this function at all. no thoughts, head empty, skip it πŸ’€
now the return value lore, because it's a whole saga 😭 it returns negative errno on error, or zero on success. in an ideal world, that would have been the case β€” but as it turns out, the other drivers return 1 on failure, so that's what we're going to do. fr fr. we're matching the group chat, not the textbook πŸ™ˆ

πŸ” SEE ALSO πŸ”

the whole squad 🫢


and that's the page!! mwah πŸ’‹ it lives in ./drivers/video/fbdev and it's dated October 2026 β€” so like, future vibes only ⭐ slay, you understood the color register, I'm so proud of you, go program a palette πŸ‘‘πŸ’–

πŸ“¦ where this page comes from